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-2019 PCOpt/NTUA
9  Copyright (C) 2013-2019 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 mapPolyMesh;
64 
65 /*---------------------------------------------------------------------------*\
66  Class elasticityMotionSolver Declaration
67 \*---------------------------------------------------------------------------*/
68 
70 :
71  public motionSolver
72 {
73 protected:
74 
75  // Protected data
76 
77  //- Since the mesh deformation is broken down to multiple steps,
78  //- mesh points need to be moved here.
79  //- Hence, the non-const mesh reference
83 
84  //- Interpolation used to transfer cell displacement to the points
86 
87  //- Inverse cell volume diffusivity
89 
90  //- Exponent to stiffen highly morphed cells
91  scalar exponent_;
92 
93  //- Intermediate steps to solve the PDEs
94  label nSteps_;
95 
96  //- Number of laplacian iterations per solution step
97  label nIters_;
98 
99  //- Residual threshold
100  scalar tolerance_;
101 
102 
103  // Protected Member Functions
104 
105  //- Set boundary conditions of cellMotionU based on pointMotionU.
106  // Avoiding the use of the cellMotionFvPatchField bc
107  // due to the use of the registry in order to grab pointMotionU, which
108  // may give problems if multiple objects of this class are constructed
109  // at the same time
110  void setBoundaryConditions();
111 
112 
113 private:
114 
115  // Private Member Functions
116 
117  //- No copy construct
119 
120  //- No copy assignment
121  void operator=(const elasticityMotionSolver&) = delete;
122 
123 
124 public:
125 
126  //- Runtime type information
127  TypeName("elasticityMotionSolver");
128 
129 
130  // Constructors
131 
132  //- Construct from mesh and dictionary
134  (
135  const polyMesh& mesh,
136  const IOdictionary& dict
137  );
138 
139 
140  //- Destructor
141  virtual ~elasticityMotionSolver() = default;
142 
143 
144  // Member Functions
145 
146  //- Get const and non-const references to pointMotionU
147  inline pointVectorField& pointMotionU();
148  inline const pointVectorField& pointMotionU() const;
149 
150  //- Get const and non-const references to cellMotionU
151  inline volVectorField& cellMotionU();
152  inline const volVectorField& cellMotionU() const;
153 
154  //- Return point location. Mesh is actually moved in solve()
155  virtual tmp<pointField> curPoints() const;
156 
157  //- Solve for motion.
158  // Does the actual mesh displacement here, since it is broken down
159  // into multiple steps
160  virtual void solve();
161 
162  //- Update local data for geometry changes
163  virtual void movePoints(const pointField&);
164 
165  //- Update the mesh corresponding to given map
166  virtual void updateMesh(const mapPolyMesh&);
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #include "elasticityMotionSolverI.H"
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #endif
181 
182 // ************************************************************************* //
volFields.H
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::elasticityMotionSolver::pointMotionU
pointVectorField & pointMotionU()
Get const and non-const references to pointMotionU.
Definition: elasticityMotionSolverI.H:32
motionSolver.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::elasticityMotionSolver::solve
virtual void solve()
Solve for motion.
Definition: elasticityMotionSolver.C:175
Foam::elasticityMotionSolver::nIters_
label nIters_
Number of laplacian iterations per solution step.
Definition: elasticityMotionSolver.H:96
Foam::elasticityMotionSolver::curPoints
virtual tmp< pointField > curPoints() const
Return point location. Mesh is actually moved in solve()
Definition: elasticityMotionSolver.C:167
Foam::elasticityMotionSolver::cellMotionU
volVectorField & cellMotionU()
Get const and non-const references to cellMotionU.
Definition: elasticityMotionSolverI.H:45
Foam::elasticityMotionSolver::TypeName
TypeName("elasticityMotionSolver")
Runtime type information.
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::elasticityMotionSolver::cellMotionU_
volVectorField cellMotionU_
Definition: elasticityMotionSolver.H:81
Foam::elasticityMotionSolver::tolerance_
scalar tolerance_
Residual threshold.
Definition: elasticityMotionSolver.H:99
Foam::Field< vector >
Foam::elasticityMotionSolver
Mesh deformation based on the linear elasticity equations. The boundary displacement is set as a boun...
Definition: elasticityMotionSolver.H:68
Foam::elasticityMotionSolver::exponent_
scalar exponent_
Exponent to stiffen highly morphed cells.
Definition: elasticityMotionSolver.H:90
elasticityMotionSolverI.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::elasticityMotionSolver::fvMesh_
fvMesh & fvMesh_
Definition: elasticityMotionSolver.H:79
Foam::elasticityMotionSolver::~elasticityMotionSolver
virtual ~elasticityMotionSolver()=default
Destructor.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::elasticityMotionSolver::movePoints
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Definition: elasticityMotionSolver.C:254
Foam::elasticityMotionSolver::E_
volScalarField E_
Inverse cell volume diffusivity.
Definition: elasticityMotionSolver.H:87
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::motionSolver
Virtual base class for mesh motion solver.
Definition: motionSolver.H:58
Foam::motionSolver::mesh
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:144
Foam::elasticityMotionSolver::interpolationPtr_
autoPtr< motionInterpolation > interpolationPtr_
Interpolation used to transfer cell displacement to the points.
Definition: elasticityMotionSolver.H:84
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::elasticityMotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update the mesh corresponding to given map.
Definition: elasticityMotionSolver.C:260
Foam::elasticityMotionSolver::setBoundaryConditions
void setBoundaryConditions()
Set boundary conditions of cellMotionU based on pointMotionU.
Definition: elasticityMotionSolver.C:58
Foam::GeometricField< vector, pointPatchField, pointMesh >
pointFields.H
Foam::elasticityMotionSolver::pointMotionU_
pointVectorField pointMotionU_
Definition: elasticityMotionSolver.H:80
Foam::elasticityMotionSolver::nSteps_
label nSteps_
Intermediate steps to solve the PDEs.
Definition: elasticityMotionSolver.H:93