motionSmoother.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) 2013-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::motionSmoother
28 
29 Description
30  Given a displacement moves the mesh by scaling the displacement back
31  until there are no more mesh errors.
32 
33  Holds displacement field (read upon construction since need boundary
34  conditions) and scaling factor and optional patch number on which to
35  scale back displacement.
36 
37  E.g.
38  \verbatim
39  // Construct iterative mesh mover.
40  motionSmoother meshMover(mesh, labelList(1, patchi));
41 
42  // Set desired displacement:
43  meshMover.displacement() = ..
44 
45  for (label iter = 0; iter < maxIter; iter++)
46  {
47  if (meshMover.scaleMesh(true))
48  {
49  Info<< "Successfully moved mesh" << endl;
50  return true;
51  }
52  }
53  \endverbatim
54 
55 Note
56  - Shared points (parallel): a processor can have points which are part of
57  pp on another processor but have no pp itself (i.e. it has points
58  and/or edges but no faces of pp). Hence we have to be careful when e.g.
59  synchronising displacements that the value from the processor which has
60  faces of pp get priority. This is currently handled in setDisplacement
61  by resetting the internal displacement to zero before doing anything
62  else. The combine operator used will give preference to non-zero
63  values.
64 
65  - Various routines take baffles. These are sets of boundary faces that
66  are treated as a single internal face. This is a hack used to apply
67  movement to internal faces.
68 
69  - Mesh constraints are looked up from the supplied dictionary. (uses
70  recursive lookup)
71 
72 SourceFiles
73  motionSmoother.C
74 
75 \*---------------------------------------------------------------------------*/
76 
77 #ifndef motionSmoother_H
78 #define motionSmoother_H
79 
80 #include "motionSmootherData.H"
81 #include "motionSmootherAlgo.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 namespace Foam
86 {
87 
88 /*---------------------------------------------------------------------------*\
89  Class motionSmoother Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 class motionSmoother
93 :
94  public motionSmootherData,
95  public motionSmootherAlgo
96 
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& mesh,
109  pointMesh& pMesh,
111  const labelList& adaptPatchIDs,
112  const dictionary& paramDict,
113  const bool dryRun = false
114  );
115 
116  //- Construct from mesh, patches to work on and smoothing parameters and
117  // displacementfield (only boundary conditions used)
119  (
120  polyMesh& mesh,
122  const labelList& adaptPatchIDs,
124  const dictionary& paramDict,
125  const bool dryRun = false
126  );
127 };
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
Foam::motionSmoother::motionSmoother
motionSmoother(polyMesh &mesh, pointMesh &pMesh, indirectPrimitivePatch &pp, const labelList &adaptPatchIDs, const dictionary &paramDict, const bool dryRun=false)
Construct from mesh, patches to work on and smoothing parameters.
Definition: motionSmoother.C:41
Foam::motionSmootherAlgo::adaptPatchIDs
const labelList & adaptPatchIDs() const
Patch labels that are being adapted.
Definition: motionSmootherAlgo.C:379
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::motionSmootherData
Definition: motionSmootherData.H:49
Foam::motionSmootherAlgo
Given a displacement moves the mesh by scaling the displacement back until there are no more mesh err...
Definition: motionSmootherAlgo.H:100
Foam::motionSmoother
Given a displacement moves the mesh by scaling the displacement back until there are no more mesh err...
Definition: motionSmoother.H:91
motionSmootherData.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::pointMesh
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:51
Foam::motionSmootherAlgo::paramDict
const dictionary & paramDict() const
Definition: motionSmootherAlgo.C:385
Foam::motionSmoother::ClassName
ClassName("motionSmoother")
Foam::List< label >
Foam::motionSmootherAlgo::mesh
const polyMesh & mesh() const
Reference to mesh.
Definition: motionSmootherAlgo.C:361
motionSmootherAlgo.H
Foam::motionSmootherAlgo::pMesh
const pointMesh & pMesh() const
Reference to pointMesh.
Definition: motionSmootherAlgo.C:367
Foam::GeometricField< vector, pointPatchField, pointMesh >
Foam::motionSmootherData::displacement
pointVectorField & displacement()
Reference to displacement field.
Definition: motionSmootherData.C:102
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79