externalDisplacement_pointMeshMover.C
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-2026 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 \*---------------------------------------------------------------------------*/
25 
27 #include "localPointRegion.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace pointMeshMovers
35 {
37 
39  (
43  );
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
51 (
52  const polyMesh& mesh,
53  const dictionary& dict
54 )
55 :
56  pointMeshMovers::displacement(mesh, dict, typeName),
57  dict_(dict)
58 {}
59 
60 
61 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
62 
64 {}
65 
66 
67 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
68 
71 {
72  if (!meshMoverPtr_.valid())
73  {
74  const word moverType(dict_.lookup("meshMover"));
75 
77  (
78  moverType,
79  dict_,
81  pointDisplacement_
82  );
83  }
84  return meshMoverPtr_();
85 }
86 
87 
90 {
91  // The points have moved so before calculation update
92  // the mesh and pointMeshMover accordingly
93  movePoints(poly().points());
94 
95  // Update any point motion bcs (e.g. timevarying)
96  pointDisplacement().boundaryFieldRef().updateCoeffs();
97 
98  label nAllowableErrors = 0;
99  labelList checkFaces(identityMap(poly().nFaces()));
100  meshMover().move
101  (
102  dict_,
103  nAllowableErrors,
104  checkFaces
105  );
106 
107  // This will have updated the mesh and implicitly the pointDisplacement
108  pointDisplacement().correctBoundaryConditions();
109 
110  return points();
111 }
112 
113 
115 (
116  const pointField& p
117 )
118 {
120 
121  // Update meshMover for new geometry
122  if (meshMoverPtr_.valid())
123  {
124  meshMover().movePoints(p);
125  }
126 }
127 
128 
130 (
131  const polyTopoChangeMap& map
132 )
133 {
135 
136  // Update meshMover for new topology
137  meshMoverPtr_.clear();
138 }
139 
140 
141 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base class for mesh movers with externally provided displacement field giving the boundary c...
static autoPtr< externalDisplacementMeshMover > New(const word &type, const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement)
Return a reference to the selected meshMover model.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
Abstract base class for pointMesh movers.
virtual void topoChange(const polyTopoChangeMap &)
Update local data for topology changes.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Abstract base class for displacement pointMesh movers.
Mesh motion solver for an fvMesh. Based on solving the cell-centre Laplacian for the motion displacem...
virtual void topoChange(const polyTopoChangeMap &)
Update topology.
virtual tmp< pointField > newPoints()
Return point location obtained from the current motion field.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
externalDisplacement(const polyMesh &, const dictionary &)
Construct from polyMesh and dictionary.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for managing temporary objects.
Definition: tmp.H:55
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const pointField & points
addToRunTimeSelectionTable(pointMeshMover, externalDisplacement, dictionary)
defineTypeNameAndDebug(externalDisplacement, 0)
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
dictionary dict
volScalarField & p