pLaplacianMotionSolver.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) 2021-2023 PCOpt/NTUA
9  Copyright (C) 2021-2023 FOSS GP
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 
28 Class
29  Foam::pLaplacianMotionSolver
30 
31 Description
32  Similar to velocityLaplacian but with a variable diffusivity, based
33  on the gradient of the displacement.
34  The boundary displacement is set as a boundary condition
35  on pointMotionU; the latter is generated automatically if not found.
36 
37 SourceFiles
38  pLaplacianMotionSolver.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef pLaplacianMotionSolver_H
43 #define pLaplacianMotionSolver_H
44 
45 #include "velocityMotionSolver.H"
46 #include "fvMotionSolver.H"
47 #include "volPointInterpolation.H"
48 #include "polyMesh.H"
49 #include "pointMesh.H"
50 #include "pointPatchField.H"
51 #include "pointPatchFieldsFwd.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward class declarations
59 class motionInterpolation;
60 class mapPolyMesh;
61 
62 /*---------------------------------------------------------------------------*\
63  Class pLaplacianMotionSolver Declaration
64 \*---------------------------------------------------------------------------*/
65 
67 :
68  public motionSolver,
69  public fvMotionSolver
70 {
71 protected:
72 
73  // Protected data
74 
75  // Use a fixedValue boundary condition for the moving patches? When
76  // using this motionSolver in an optimisation context, we usually go
77  // from point movement to face movement, solve the grid dispalcement
78  // PDE and then interpolate the movement back to the points. If the
79  // boundary conditions of pointMotionU are fixedValue, the initial
80  // values will be retained, otherwise they will be overwritten by the
81  // face-to-point interpolation. The latter is usually beneficial for
82  // the resulting mesh quality but does not give us the exact geometry.
84 
87 
88  //- Interpolation used to transfer cell displacement to the points
90 
91  //- Number of pLaplacian iterations per solution step
92  label nIters_;
93 
94  //- Residual threshold
95  scalar tolerance_;
96 
97  //- Residual threshold for intermediate exponents
99 
100  //- Exponent defining the order or the p-Laplacian
101  label exponent_;
102 
103 
104 private:
105 
107  // Private Member Functions
108 
109  //- No copy construct
111 
112  //- No copy assignment
113  void operator=(const pLaplacianMotionSolver&) = delete;
114 
115 public:
116 
117  //- Runtime type information
118  TypeName("pLaplacianMotionSolver");
119 
120 
121  // Constructors
122 
123  //- Construct from mesh and dictionary
125  (
126  const polyMesh& mesh,
127  const IOdictionary& dict
128  );
129 
130 
131  //- Destructor
132  virtual ~pLaplacianMotionSolver() = default;
133 
134 
135  // Member Functions
136 
137  //- Set boundary conditions of cellMotionU based on pointMotionU.
138  // Avoiding the use of the cellMotionFvPatchField bc
139  // due to the use of the registry in order to grab pointMotionU, which
140  // may give problems if multiple objects of this class are constructed
141  // at the same time
142  void setBoundaryConditions();
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 obtained from the current motion field
153  virtual tmp<pointField> curPoints() const;
154 
155  //- Solve for motion
156  virtual void solve();
157 
158  //- Update local data for geometry changes
159  virtual void movePoints(const pointField&);
160 
161  //- Update the mesh corresponding to given map
162  virtual void updateMesh(const mapPolyMesh&);
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #include "pLaplacianMotionSolverI.H"
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
label nIters_
Number of pLaplacian iterations per solution step.
dictionary dict
virtual ~pLaplacianMotionSolver()=default
Destructor.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
pointVectorField & pointMotionU()
Get const and non-const references to pointMotionU.
virtual void updateMesh(const mapPolyMesh &)
Update the mesh corresponding to given map.
Virtual base class for mesh motion solver.
Definition: motionSolver.H:54
Similar to velocityLaplacian but with a variable diffusivity, based on the gradient of the displaceme...
virtual void solve()
Solve for motion.
TypeName("pLaplacianMotionSolver")
Runtime type information.
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
Base class for fvMesh based motionSolvers.
scalar tolerance_
Residual threshold.
scalar toleranceIntermediate_
Residual threshold for intermediate exponents.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
autoPtr< motionInterpolation > interpolationPtr_
Interpolation used to transfer cell displacement to the points.
label exponent_
Exponent defining the order or the p-Laplacian.
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
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:165
A class for managing temporary objects.
Definition: HashPtrTable.H:50
volVectorField & cellMotionU()
Get const and non-const references to cellMotionU.
Namespace for OpenFOAM.