displacementMeshMoverMotionSolver.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-2024 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 
28 #include "localPointRegion.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
35 
37  (
41  );
42 }
43 
44 
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 
48 (
49  const word& name,
50  const polyMesh& mesh,
51  const dictionary& dict
52 )
53 :
55  dict_(dict)
56 {}
57 
58 
59 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
60 
63 {}
64 
65 
66 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
67 
70 {
71  if (!meshMoverPtr_.valid())
72  {
73  const word moverType(dict_.lookup("meshMover"));
74 
76  (
77  moverType,
78  dict_,
80  pointDisplacement_
81  );
82  }
83  return meshMoverPtr_();
84 }
85 
86 
89 {
90  // Return actual points. Cannot do a reference since complains about
91  // assignment to self in polyMesh::movePoints
92  return tmp<pointField>(new pointField(mesh().points()));
93 }
94 
95 
97 {
98  // The points have moved so before calculation update
99  // the mesh and motionSolver accordingly
100  movePoints(mesh().points());
101 
102  // Update any point motion bcs (e.g. timevarying)
103  pointDisplacement().boundaryFieldRef().updateCoeffs();
104 
105  label nAllowableErrors = 0;
106  labelList checkFaces(identityMap(mesh().nFaces()));
107  meshMover().move
108  (
109  dict_,
110  nAllowableErrors,
111  checkFaces
112  );
113 
114  // This will have updated the mesh and implicitly the pointDisplacement
115  pointDisplacement().correctBoundaryConditions();
116 }
117 
118 
120 {
122 
123  // Update meshMover for new geometry
124  if (meshMoverPtr_.valid())
125  {
126  meshMover().movePoints(p);
127  }
128 }
129 
130 
132 (
133  const polyTopoChangeMap& map
134 )
135 {
137 
138  // Update meshMover for new topology
139  meshMoverPtr_.clear();
140 }
141 
142 
143 // ************************************************************************* //
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
Mesh motion solver for an fvMesh. Based on solving the cell-centre Laplacian for the motion displacem...
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
virtual void topoChange(const polyTopoChangeMap &)
Update topology.
displacementMeshMoverMotionSolver(const word &name, const polyMesh &, const dictionary &)
Construct from polyMesh and dictionary.
externalDisplacementMeshMover & meshMover() const
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Virtual base class for displacement motion solver.
Virtual base class for mesh movers with externally provided displacement field giving the boundary co...
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.
Virtual base class for mesh motion solver.
Definition: motionSolver.H:57
virtual void topoChange(const polyTopoChangeMap &)
Update local data for topology changes.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const pointField & points
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
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
defineTypeNameAndDebug(combustionModel, 0)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
dictionary dict
volScalarField & p