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-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 \*---------------------------------------------------------------------------*/
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 :
54  displacementMotionSolver(name, mesh, dict, typeName)
55 {}
56 
57 
58 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
59 
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 
69 {
70  if (!meshMoverPtr_.valid())
71  {
72  const word moverType(coeffDict().lookup("meshMover"));
73 
75  (
76  moverType,
77  coeffDict().optionalSubDict(moverType + "Coeffs"),
79  pointDisplacement_
80  );
81  }
82  return meshMoverPtr_();
83 }
84 
85 
88 {
89  // Return actual points. Cannot do a reference since complains about
90  // assignment to self in polyMesh::movePoints
91  return tmp<pointField>(new pointField(mesh().points()));
92 }
93 
94 
96 {
97  // The points have moved so before calculation update
98  // the mesh and motionSolver accordingly
99  movePoints(mesh().points());
100 
101  // Update any point motion bcs (e.g. timevarying)
102  pointDisplacement().boundaryFieldRef().updateCoeffs();
103 
104  label nAllowableErrors = 0;
105  labelList checkFaces(identityMap(mesh().nFaces()));
106  meshMover().move
107  (
108  coeffDict().optionalSubDict(meshMover().type() + "Coeffs"),
109  nAllowableErrors,
110  checkFaces
111  );
112 
113  // This will have updated the mesh and implicitly the pointDisplacement
114  pointDisplacement().correctBoundaryConditions();
115 }
116 
117 
119 {
121 
122  // Update meshMover for new geometry
123  if (meshMoverPtr_.valid())
124  {
125  meshMover().movePoints(p);
126  }
127 }
128 
129 
131 (
132  const polyTopoChangeMap& map
133 )
134 {
136 
137  // Update meshMover for new topology
138  meshMoverPtr_.clear();
139 }
140 
141 
142 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
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
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
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
defineTypeNameAndDebug(combustionModel, 0)
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
dictionary dict
volScalarField & p