laplacianMotionSolver.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 
29 Class
30  Foam::laplacianMotionSolver
31 
32 Description
33  Similar to velocityLaplacian but iteratively solves the mesh displacement
34  PDEs to account for non-orthogonality.
35  The boundary displacement is set as a boundary condition
36  on pointMotionU; the latter is generated automatically if not found.
37  Assumes uniform diffusivity
38 
39 SourceFiles
40  laplacianMotionSolver.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef laplacianMotionSolver_H
45 #define laplacianMotionSolver_H
46 
47 #include "velocityMotionSolver.H"
48 #include "fvMotionSolver.H"
49 #include "volPointInterpolation.H"
50 #include "polyMesh.H"
51 #include "pointMesh.H"
52 #include "pointPatchField.H"
53 #include "pointPatchFieldsFwd.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 // Forward class declarations
61 class motionInterpolation;
62 class motionDiffusivity;
63 class mapPolyMesh;
64 
65 /*---------------------------------------------------------------------------*\
66  Class laplacianMotionSolver Declaration
67 \*---------------------------------------------------------------------------*/
68 
70 :
71  public motionSolver,
72  public fvMotionSolver
73 {
74 protected:
75 
76  // Protected data
77 
80 
81  //- Interpolation used to transfer cell displacement to the points
83 
84  //- Diffusivity used to control the motion
86 
87  //- Number of laplacian iterations per solution step
88  label nIters_;
89 
90  //- Residual threshold
91  scalar tolerance_;
92 
93 
94 private:
95 
96 
97  // Private Member Functions
98 
99  //- No copy construct
101 
102  //- No copy assignment
103  void operator=(const laplacianMotionSolver&) = delete;
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("laplacianMotionSolver");
109 
110 
111  // Constructors
112 
113  //- Construct from mesh and dictionary
115  (
116  const polyMesh& mesh,
117  const IOdictionary& dict
118  );
119 
120 
121  //- Destructor
122  virtual ~laplacianMotionSolver() = default;
123 
124 
125  // Member Functions
126 
127  //- Get const and non-const references to pointMotionU
128  inline pointVectorField& pointMotionU();
129  inline const pointVectorField& pointMotionU() const;
130 
131  //- Get const and non-const references to cellMotionU
132  inline volVectorField& cellMotionU();
133  inline const volVectorField& cellMotionU() const;
134 
135  //- Return point location obtained from the current motion field
136  virtual tmp<pointField> curPoints() const;
137 
138  //- Solve for motion
139  virtual void solve();
140 
141  //- Set boundary conditions of cellMotionU based on pointMotionU.
142  // Avoiding the use of the cellMotionFvPatchField bc
143  // due to the use of the registry in order to grab pointMotionU, which
144  // may give problems if multiple objects of this class are constructed
145  // at the same time
146  void setBoundaryConditions();
147 
148  //- Update local data for geometry changes
149  virtual void movePoints(const pointField&);
150 
151  //- Update the mesh corresponding to given map
152  virtual void updateMesh(const mapPolyMesh&);
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #include "laplacianMotionSolverI.H"
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
dictionary dict
virtual void movePoints(const pointField &)
Update local data for geometry changes.
pointVectorField & pointMotionU()
Get const and non-const references to pointMotionU.
virtual void solve()
Solve for motion.
Virtual base class for mesh motion solver.
Definition: motionSolver.H:54
Similar to velocityLaplacian but iteratively solves the mesh displacement PDEs to account for non-ort...
volVectorField & cellMotionU()
Get const and non-const references to cellMotionU.
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
label nIters_
Number of laplacian iterations per solution step.
Base class for fvMesh based motionSolvers.
TypeName("laplacianMotionSolver")
Runtime type information.
autoPtr< motionInterpolation > interpolationPtr_
Interpolation used to transfer cell displacement to the points.
virtual void updateMesh(const mapPolyMesh &)
Update the mesh corresponding to given map.
scalar tolerance_
Residual threshold.
virtual ~laplacianMotionSolver()=default
Destructor.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
autoPtr< motionDiffusivity > diffusivityPtr_
Diffusivity used to control the motion.
void setBoundaryConditions()
Set boundary conditions of cellMotionU based on pointMotionU.
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:165
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.