motionSmoother.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::motionSmoother
26 
27 Description
28  Given a displacement moves the mesh by scaling the displacement back
29  until there are no more mesh errors.
30 
31  Holds displacement field (read upon construction since need boundary
32  conditions) and scaling factor and optional patch number on which to
33  scale back displacement.
34 
35  E.g.
36  \verbatim
37  // Construct iterative mesh mover.
38  motionSmoother meshMover(mesh, labelList(1, patchi));
39 
40  // Set desired displacement:
41  meshMover.displacement() = ..
42 
43  for (label iter = 0; iter < maxIter; iter++)
44  {
45  if (meshMover.scaleMesh(true))
46  {
47  Info<< "Successfully moved mesh" << endl;
48  return true;
49  }
50  }
51  \endverbatim
52 
53  Note:
54  - Shared points (parallel): a processor can have points which are part of
55  pp on another processor but have no pp itself (i.e. it has points
56  and/or edges but no faces of pp). Hence we have to be careful when e.g.
57  synchronising displacements that the value from the processor which has
58  faces of pp get priority. This is currently handled in setDisplacement
59  by resetting the internal displacement to zero before doing anything
60  else. The combine operator used will give preference to non-zero
61  values.
62 
63  - Various routines take baffles. These are sets of boundary faces that
64  are treated as a single internal face. This is a hack used to apply
65  movement to internal faces.
66 
67  - Mesh constraints are looked up from the supplied dictionary. (uses
68  recursive lookup)
69 
70 SourceFiles
71  motionSmoother.C
72 
73 \*---------------------------------------------------------------------------*/
74 
75 #ifndef motionSmoother_H
76 #define motionSmoother_H
77 
78 #include "motionSmootherData.H"
79 #include "motionSmootherAlgo.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 /*---------------------------------------------------------------------------*\
87  Class motionSmoother Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 class motionSmoother
91 :
92  public motionSmootherData,
93  public motionSmootherAlgo
94 
95 {
96  // Private class
97 
98 public:
99 
100  ClassName("motionSmoother");
101 
102  // Constructors
103 
104  //- Construct from mesh, patches to work on and smoothing parameters.
105  // Reads displacement field (only boundary conditions used)
107  (
108  polyMesh&,
109  pointMesh&,
110  indirectPrimitivePatch& pp, // 'outside' points
111  const labelList& adaptPatchIDs, // patches forming 'outside'
112  const dictionary& paramDict
113  );
114 
115  //- Construct from mesh, patches to work on and smoothing parameters and
116  // displacementfield (only boundary conditions used)
118  (
119  polyMesh&,
120  indirectPrimitivePatch& pp, // 'outside' points
121  const labelList& adaptPatchIDs, // patches forming 'outside'
122  const pointVectorField&,
123  const dictionary& paramDict
124  );
125 
126 };
127 
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 } // End namespace Foam
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 #endif
136 
137 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Given a displacement moves the mesh by scaling the displacement back until there are no more mesh err...
const dictionary & paramDict() const
Given a displacement moves the mesh by scaling the displacement back until there are no more mesh err...
motionSmoother(polyMesh &, pointMesh &, indirectPrimitivePatch &pp, const labelList &adaptPatchIDs, const dictionary &paramDict)
Construct from mesh, patches to work on and smoothing parameters.
ClassName("motionSmoother")
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:53
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Namespace for OpenFOAM.