displacementMethod.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) 2007-2023 PCOpt/NTUA
9  Copyright (C) 2013-2023 FOSS GP
10  Copyright (C) 2019 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
13  This file is part of OpenFOAM.
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28 
29 Class
30  Foam::displacementMethod
31 
32 Description
33  Abstract base class for displacement methods, which are a set or
34  wrapper classes allowing to change the driving force of mesh motion solvers
35 
36 SourceFiles
37  displacementMethod.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef displacementMethod_H
42 #define displacementMethod_H
43 
44 #include "fvm.H"
45 #include "fvc.H"
46 #include "runTimeSelectionTables.H"
48 
49 #include "motionSolver.H"
50 #include "volPointInterpolation.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class displacementMethod Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 {
62 protected:
63 
64  // Protected data
65 
67 
68  //- IDs of the patches to be moved
70 
72 
73  scalar maxDisplacement_;
74 
75  //- Whether the motion solver prefers a point of a vol field as input
76  bool preferPointField_;
77 
78 
79 private:
80 
81  // Private Member Functions
82 
83  //- No copy construct
84  displacementMethod(const displacementMethod&) = delete;
85 
86  //- No copy assignment
87  void operator=(const displacementMethod&) = delete;
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeName("displacementMethod");
94 
95 
96  // Declare run-time constructor selection table
97 
99  (
100  autoPtr,
102  dictionary,
103  (
104  fvMesh& mesh,
105  const labelList& patchIDs
106  ),
107  (mesh, patchIDs)
108  );
109 
110 
111  // Constructors
112 
113  //- Construct from components
115  (
116  fvMesh& mesh,
117  const labelList& patchIDs
118  );
119 
120  // Selectors
121 
122  //- Return a reference to the selected turbulence model
124  (
125  fvMesh& mesh,
126  const labelList& patchIDs
127  );
128 
129 
130  //- Destructor
131  virtual ~displacementMethod() = default;
132 
133 
134  // Member Functions
135 
136  //- Whether the motion solver prefers a point of a vol field as input
137  virtual bool preferPointField() const;
138 
139  //- Set motion filed related to model based on given motion
140  virtual void setMotionField(const pointVectorField& pointMovement) = 0;
141 
142  //- Set motion filed related to model based on given motion
143  virtual void setMotionField(const volVectorField& cellMovement) = 0;
144 
145  //- Set control field as a vectorField. For methods working with
146  //- parameters (RBF etc)
147  virtual void setControlField(const vectorField& controlField) = 0;
148 
149  //- Set control field as a vectorField. For methods working with
150  //- parameters (RBF etc)
151  virtual void setControlField(const scalarField& controlField) = 0;
152 
153  //- Bound control field in certain directions etc. For methods working
154  //- with parameters (RBF etc)
155  //- does nothing by default
156  virtual void boundControlField(vectorField& controlField);
157 
158  //- Get access to motionSolver
160 
161  //- Get max displacement
162  scalar getMaxDisplacement() const;
163 
164  //- Set parametertised patch IDs
165  inline void setPatchIDs(const labelList& patchIDs)
166  {
168  }
169 
170  //- Update mesh
171  void update();
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
const labelList patchIDs(pbm.indices(polyPatchNames, true))
void update()
Update mesh.
TypeName("displacementMethod")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
autoPtr< motionSolver > motionPtr_
Macros for easy insertion into run-time selection tables.
bool preferPointField_
Whether the motion solver prefers a point of a vol field as input.
dynamicFvMesh & mesh
virtual ~displacementMethod()=default
Destructor.
virtual void setMotionField(const pointVectorField &pointMovement)=0
Set motion filed related to model based on given motion.
declareRunTimeSelectionTable(autoPtr, displacementMethod, dictionary,(fvMesh &mesh, const labelList &patchIDs),(mesh, patchIDs))
virtual void boundControlField(vectorField &controlField)
Bound control field in certain directions etc. For methods working with parameters (RBF etc) does not...
Abstract base class for displacement methods, which are a set or wrapper classes allowing to change t...
static autoPtr< displacementMethod > New(fvMesh &mesh, const labelList &patchIDs)
Return a reference to the selected turbulence model.
autoPtr< motionSolver > & getMotionSolver()
Get access to motionSolver.
scalar getMaxDisplacement() const
Get max displacement.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
labelList patchIDs_
IDs of the patches to be moved.
virtual void setControlField(const vectorField &controlField)=0
Set control field as a vectorField. For methods working with parameters (RBF etc) ...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Macros to ease declaration of run-time selection tables.
virtual bool preferPointField() const
Whether the motion solver prefers a point of a vol field as input.
Namespace for OpenFOAM.
void setPatchIDs(const labelList &patchIDs)
Set parametertised patch IDs.