Loading...
Searching...
No Matches
displacementSmartPointSmoothingMotionSolver.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) 2024 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::displacementSmartPointSmoothingMotionSolver
28
29Description
30 Quality-based under-relaxation for run-time selectable point smoothing. WIP.
31
32Usage
33 \table
34 Property | Description | Required | Default value
35 untangler | pointSmoother for untangling | yes |
36 untangleQ | quality below which untangling is applied | yes |
37
38 pointSmoother | pointSmoother in 'normal' mode | yes
39 minQ | quality below which pointSmoother is applied | yes
40 nPointSmootherIter | max number of iterations
41 \endtable
42
43 Example of the motion solver specification in dynamicMeshDict:
44 \verbatim
45 motionSolver displacementSmartPointSmoothing;
46 displacementSmartPointSmoothingCoeffs
47 {
48 //- Overall max number of smoothing iterations
49 nPointSmootherIter 10;
50
51 //- If any faces have quality below untangleQ apply untangler
52 untangleQ 0.001;
53 untangler laplacian;
54
55 //- If any faces have quality below minQ apply 'normal' smoother
56 minQ 0.9;
57 pointSmoother geometricElementTransform;
58 transformationParameter 0.667;
59 }
60 \endverbatim
61
62SourceFiles
63 displacementSmartPointSmoothingMotionSolver.C
64
65\*---------------------------------------------------------------------------*/
66
67#ifndef displacementSmartPointSmoothingMotionSolver_H
68#define displacementSmartPointSmoothingMotionSolver_H
69
71#include "pointSmoother.H"
72#include "polyMeshGeometry.H"
73
74// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
75
76namespace Foam
77{
78
79/*---------------------------------------------------------------------------*\
80 Class displacementSmartPointSmoothingMotionSolver Declaration
81\*---------------------------------------------------------------------------*/
82
84:
86{
87protected:
88
89 // Protected Data
90
91 //- Part-updatable mesh geometry
92 polyMeshGeometry meshGeometry_;
93
94 //- Point untangler method
95 autoPtr<pointSmoother> pointUntangler_;
96
97 //- Minimum allowed quality
98 const scalar untangleQ_;
99
100 //- Minimum allowed quality
101 const scalar minQ_;
102
103 //- Point smoothing method
104 autoPtr<pointSmoother> pointSmoother_;
105
106 //- Number of point smoother iterations per timestep
107 const label nPointSmootherIter_;
108
110 // Mesh quality based relaxation of smoothed position
111
112 //- Relaxation factors to use in each iteration
114
115 //- Relaxed point field
117
118 //- Set of the faces which are to be moved
121 //- Mesh quality dictionary
123
124
125 // Private Member Functions
126
127 //- Mark affected faces
129 (
130 const labelHashSet& changedFaces,
131 labelHashSet& affectedFaces
132 );
133
134 //- Relax the points
135 bool relax();
136
137 //- Set all the faces to be moved
138 void virtual setFacesToMove(const dictionary&);
139
140 //- Handle 2D & empty bcs. Assume in both cases the starting mesh
141 // - has all edges aligned with 3rd dimension
142 // - is on planes of the empty patches
144
146public:
147
148 //- Runtime type information
149 TypeName("displacementSmartPointSmoothing");
150
151
152 // Constructors
154 //- Construct from a polyMesh and an IOdictionary
156 (
157 const polyMesh&,
159 );
160
161 //- Construct from components
164 const polyMesh& mesh,
165 const IOdictionary& dict,
167 const pointIOField& points0
168 );
169
170
171 //- Destructor
173
174
175 // Member Functions
176
177 //- Return point location obtained from the current motion field
178 virtual tmp<pointField> curPoints() const;
179
180 //- Solve for motion
181 virtual void solve();
182};
183
184
185// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186
187} // End namespace Foam
188
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191#endif
192
193// ************************************************************************* //
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
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Virtual base class for displacement motion solver.
pointVectorField & pointDisplacement() noexcept
Return reference to the point motion displacement field.
displacementMotionSolver(const displacementMotionSolver &)=delete
No copy construct.
Quality-based under-relaxation for run-time selectable point smoothing. WIP.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
labelHashSet facesToMove_
Set of the faces which are to be moved.
scalarList relaxationFactors_
Relaxation factors to use in each iteration.
void markAffectedFaces(const labelHashSet &changedFaces, labelHashSet &affectedFaces)
Mark affected faces.
virtual ~displacementSmartPointSmoothingMotionSolver()=default
Destructor.
TypeName("displacementSmartPointSmoothing")
Runtime type information.
const label nPointSmootherIter_
Number of point smoother iterations per timestep.
void emptyCorrectPoints(pointVectorField &pointDisplacement)
Handle 2D & empty bcs. Assume in both cases the starting mesh.
virtual void setFacesToMove(const dictionary &)
Set all the faces to be moved.
displacementSmartPointSmoothingMotionSolver(const polyMesh &, const IOdictionary &)
Construct from a polyMesh and an IOdictionary.
const polyMesh & mesh() const
Return reference to mesh.
pointField & points0() noexcept
Return reference to the reference ('0') pointField.
Updateable mesh geometry and checking routines.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A class for managing temporary objects.
Definition tmp.H:75
tmp< GeometricField< Type, faPatchField, areaMesh > > laplacian(const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Namespace for OpenFOAM.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition HashSet.H:85
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
vectorIOField pointIOField
pointIOField is a vectorIOField.
vectorField pointField
pointField is a vectorField.
List< scalar > scalarList
List of scalar.
Definition scalarList.H:32
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68