elasticityMotionSolver.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2007-2023 PCOpt/NTUA
9  Copyright (C) 2013-2023 FOSS GP
10  Copyright (C) 2019 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
13  This file is part of OpenFOAM.
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28 Class
29  Foam::elasticityMotionSolver
30 
31 Description
32  Mesh deformation based on the linear elasticity equations.
33  The boundary displacement is set as a boundary condition
34  on the pointMotionU field.
35 
36  Reference:
37  \verbatim
38  Dwight, R. P., (2009).
39  Robust Mesh Deformation using the Linear Elasticity Equations.
40  Computational Fluid Dynamics 2006, 401-406.
41  Springer Berlin Heidelberg.
42  \endverbatim
43 
44 SourceFiles
45  elasticityMotionSolver.C
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef elasticityMotionSolver_H
50 #define elasticityMotionSolver_H
51 
52 #include "motionSolver.H"
53 #include "volFields.H"
54 #include "pointFields.H"
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace Foam
59 {
60 
61 // Forward class declarations
62 class motionInterpolation;
63 class motionDiffusivity;
64 class mapPolyMesh;
65 
66 /*---------------------------------------------------------------------------*\
67  Class elasticityMotionSolver Declaration
68 \*---------------------------------------------------------------------------*/
69 
71 :
72  public motionSolver
73 {
74 protected:
75 
76  // Protected data
77 
78  //- Since the mesh deformation is broken down to multiple steps,
79  //- mesh points need to be moved here.
80  //- Hence, the non-const mesh reference
81  fvMesh& fvMesh_;
84 
85  //- Interpolation used to transfer cell displacement to the points
87 
88  //- Diffusivity used to control the motion
90 
91  //- Intermediate steps to solve the PDEs
92  label nSteps_;
93 
94  //- Number of laplacian iterations per solution step
95  label nIters_;
96 
97  //- Residual threshold
98  scalar tolerance_;
99 
101  // Protected Member Functions
102 
103  //- Set boundary conditions of cellMotionU based on pointMotionU.
104  // Avoiding the use of the cellMotionFvPatchField bc
105  // due to the use of the registry in order to grab pointMotionU, which
106  // may give problems if multiple objects of this class are constructed
107  // at the same time
108  void setBoundaryConditions();
109 
110 
111 private:
112 
113  // Private Member Functions
114 
115  //- No copy construct
117 
118  //- No copy assignment
119  void operator=(const elasticityMotionSolver&) = delete;
120 
121 
122 public:
123 
124  //- Runtime type information
125  TypeName("elasticityMotionSolver");
126 
127 
128  // Constructors
129 
130  //- Construct from mesh and dictionary
132  (
133  const polyMesh& mesh,
134  const IOdictionary& dict
135  );
136 
137 
138  //- Destructor
139  virtual ~elasticityMotionSolver() = default;
140 
141 
142  // Member Functions
143 
144  //- Get const and non-const references to pointMotionU
145  inline pointVectorField& pointMotionU();
146  inline const pointVectorField& pointMotionU() const;
147 
148  //- Get const and non-const references to cellMotionU
149  inline volVectorField& cellMotionU();
150  inline const volVectorField& cellMotionU() const;
151 
152  //- Return point location. Mesh is actually moved in solve()
153  virtual tmp<pointField> curPoints() const;
154 
155  //- Solve for motion.
156  // Does the actual mesh displacement here, since it is broken down
157  // into multiple steps
158  virtual void solve();
159 
160  //- Update local data for geometry changes
161  virtual void movePoints(const pointField&);
162 
163  //- Update the mesh corresponding to given map
164  virtual void updateMesh(const mapPolyMesh&);
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #include "elasticityMotionSolverI.H"
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
dictionary dict
label nSteps_
Intermediate steps to solve the PDEs.
TypeName("elasticityMotionSolver")
Runtime type information.
scalar tolerance_
Residual threshold.
virtual void solve()
Solve for motion.
Virtual base class for mesh motion solver.
Definition: motionSolver.H:54
virtual void movePoints(const pointField &)
Update local data for geometry changes.
void setBoundaryConditions()
Set boundary conditions of cellMotionU based on pointMotionU.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:157
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
pointVectorField & pointMotionU()
Get const and non-const references to pointMotionU.
virtual void updateMesh(const mapPolyMesh &)
Update the mesh corresponding to given map.
volVectorField & cellMotionU()
Get const and non-const references to cellMotionU.
label nIters_
Number of laplacian iterations per solution step.
autoPtr< motionInterpolation > interpolationPtr_
Interpolation used to transfer cell displacement to the points.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual ~elasticityMotionSolver()=default
Destructor.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
autoPtr< motionDiffusivity > diffusivityPtr_
Diffusivity used to control the motion.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:165
A class for managing temporary objects.
Definition: HashPtrTable.H:50
fvMesh & fvMesh_
Since the mesh deformation is broken down to multiple steps, mesh points need to be moved here...
Namespace for OpenFOAM.
virtual tmp< pointField > curPoints() const
Return point location. Mesh is actually moved in solve()
Mesh deformation based on the linear elasticity equations. The boundary displacement is set as a boun...