fvMeshTopoChanger.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::fvMeshTopoChanger
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  fvMeshTopoChanger.C
35  fvMeshTopoChangerNew.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef fvMeshTopoChanger_H
40 #define fvMeshTopoChanger_H
41 
42 #include "fvMesh.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class fvMeshTopoChanger Declaration
51 \*---------------------------------------------------------------------------*/
52 
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("fvMeshTopoChanger");
68 
69 
70  // Declare run-time constructor selection table
71 
73  (
74  autoPtr,
76  fvMesh,
77  (fvMesh& mesh, const dictionary& dict),
78  (mesh, dict)
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 fvMeshTopoChanger(fvMesh&);
113 
114  //- Disallow default bitwise copy construction
115  fvMeshTopoChanger(const fvMeshTopoChanger&) = delete;
116 
117 
118  // Selectors
119 
120  //- Select, construct and return the fvMeshTopoChanger
121  static autoPtr<fvMeshTopoChanger> New(fvMesh&, const dictionary& dict);
122 
123  //- Select, construct and return the fvMeshTopoChanger
125 
126 
127  //- Destructor
128  virtual ~fvMeshTopoChanger();
129 
130 
131  // Member Functions
132 
133  //- Return the fvMesh
134  fvMesh& mesh()
135  {
136  return mesh_;
137  }
138 
139  //- Return the fvMesh
140  const fvMesh& mesh() const
141  {
142  return mesh_;
143  }
144 
145  //- Is mesh dynamic, i.e. might it change?
146  // Defaults to true, set to false in the fvMeshTopoChangers::none
147  virtual bool dynamic() const
148  {
149  return true;
150  }
151 
152  //- Update the mesh for both mesh motion and topology change
153  virtual bool update() = 0;
154 
155  //- Update corresponding to the given map
156  virtual void topoChange(const polyTopoChangeMap&) = 0;
157 
158  //- Update from another mesh using the given map
159  virtual void mapMesh(const polyMeshMap&) = 0;
160 
161  //- Update corresponding to the given distribution map
162  virtual void distribute(const polyDistributionMap&) = 0;
163 
164  //- Write the mover state
165  virtual bool write(const bool write = true) const
166  {
167  return true;
168  }
169 
170 
171  // Member Operators
172 
173  //- Disallow default bitwise assignment
174  void operator=(const fvMeshTopoChanger&) = delete;
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
declareRunTimeSelectionTable(autoPtr, fvMeshTopoChanger, fvMesh,(fvMesh &mesh, const dictionary &dict),(mesh, dict))
dictionary dict
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
fvMesh & mesh()
Return the fvMesh.
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?
virtual ~fvMeshTopoChanger()
Destructor.
virtual void mapMesh(const polyMeshMap &)=0
Update from another mesh using the given map.
fvMeshTopoChanger(fvMesh &)
Construct from fvMesh.
static autoPtr< fvMeshTopoChanger > New(fvMesh &, const dictionary &dict)
Select, construct and return the fvMeshTopoChanger.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
virtual void distribute(const polyDistributionMap &)=0
Update corresponding to the given distribution map.
virtual void topoChange(const polyTopoChangeMap &)=0
Update corresponding to the given map.
void operator=(const fvMeshTopoChanger &)=delete
Disallow default bitwise assignment.
TypeName("fvMeshTopoChanger")
Runtime type information.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
virtual bool write(const bool write=true) const
Write the mover state.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
velocityMotionCorrection(const fvMesh &mesh, const dictionary &dict)
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:50
Helper class to update the velocity boundary conditions.
Abstract base class for fvMesh movers.
Namespace for OpenFOAM.