Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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
28Class
29 Foam::pLaplacianMotionSolver
30
31Description
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
37SourceFiles
38 pLaplacianMotionSolver.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef pLaplacianMotionSolver_H
43#define pLaplacianMotionSolver_H
44
46#include "fvMotionSolver.H"
48#include "polyMesh.H"
49#include "pointMesh.H"
50#include "pointPatchField.H"
51#include "pointPatchFieldsFwd.H"
52
53// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54
55namespace Foam
56{
57
58// Forward class declarations
60class mapPolyMesh;
62/*---------------------------------------------------------------------------*\
63 Class pLaplacianMotionSolver Declaration
64\*---------------------------------------------------------------------------*/
65
66class pLaplacianMotionSolver
67:
68 public motionSolver,
69 public fvMotionSolver
70{
71protected:
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_;
97 //- Residual threshold for intermediate exponents
99
100 //- Exponent defining the order or the p-Laplacian
102
103
104private:
105
107 // Private Member Functions
108
109 //- No copy construct
110 pLaplacianMotionSolver(const pLaplacianMotionSolver&) = delete;
111
112 //- No copy assignment
113 void operator=(const pLaplacianMotionSolver&) = delete;
114
115public:
116
117 //- Runtime type information
118 TypeName("pLaplacianMotionSolver");
119
120
121 // Constructors
122
123 //- Construct from mesh and dictionary
124 pLaplacianMotionSolver
125 (
126 const polyMesh& mesh,
127 const IOdictionary& dict
128 );
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
143
144 //- Get const and non-const references to pointMotionU
146 inline const pointVectorField& pointMotionU() const;
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
173
174// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175
176#endif
177
178// ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
fvMotionSolver(const polyMesh &)
Construct from polyMesh.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Base class for interpolation of cell displacement fields, generated by fvMotionSolvers,...
const polyMesh & mesh() const
Return reference to mesh.
motionSolver(const polyMesh &mesh)
Construct from polyMesh.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
scalar tolerance_
Residual threshold.
virtual ~pLaplacianMotionSolver()=default
Destructor.
label nIters_
Number of pLaplacian iterations per solution step.
void setBoundaryConditions()
Set boundary conditions of cellMotionU based on pointMotionU.
label exponent_
Exponent defining the order or the p-Laplacian.
volVectorField & cellMotionU()
Get const and non-const references to cellMotionU.
autoPtr< motionInterpolation > interpolationPtr_
Interpolation used to transfer cell displacement to the points.
scalar toleranceIntermediate_
Residual threshold for intermediate exponents.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
TypeName("pLaplacianMotionSolver")
Runtime type information.
virtual void updateMesh(const mapPolyMesh &)
Update the mesh corresponding to given map.
virtual void solve()
Solve for motion.
pointVectorField & pointMotionU()
Get const and non-const references to pointMotionU.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A class for managing temporary objects.
Definition tmp.H:75
Namespace for OpenFOAM.
GeometricField< vector, fvPatchField, volMesh > volVectorField
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
vectorField pointField
pointField is a vectorField.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68