displacementMeshMoverMotionSolver.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2013-2016 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 {
34  defineTypeNameAndDebug(displacementMeshMoverMotionSolver, 0);
35 
37  (
38  motionSolver,
39  displacementMeshMoverMotionSolver,
40  dictionary
41  );
42 }
43 
44 
45 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
50 Foam::displacementMeshMoverMotionSolver::displacementMeshMoverMotionSolver
51 (
52  const polyMesh& mesh,
53  const IOdictionary& dict
54 )
55 :
56  displacementMotionSolver(mesh, dict, typeName) // read pointDisplacement
57 {}
58 
59 
60 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
61 
64 {}
65 
66 
67 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
68 
69 
72 {
73  if (!meshMoverPtr_.valid())
74  {
75  const word moverType(coeffDict().lookup("meshMover"));
76 
78  (
79  moverType,
80  coeffDict().subDict(moverType + "Coeffs"),
82  pointDisplacement_
83  );
84  }
85  return meshMoverPtr_();
86 }
87 
88 
91 {
92  // Return actual points. Cannot do a reference since complains about
93  // assignment to self in polyMesh::movePoints
94  return tmp<pointField>(new pointField(mesh().points()));
95 }
96 
97 
99 {
100  // The points have moved so before calculation update
101  // the mesh and motionSolver accordingly
102  movePoints(mesh().points());
103 
104  // Update any point motion bcs (e.g. timevarying)
105  pointDisplacement().boundaryFieldRef().updateCoeffs();
106 
107  label nAllowableErrors = 0;
108  labelList checkFaces(identity(mesh().nFaces()));
109  meshMover().move
110  (
111  coeffDict().subDict(meshMover().type() + "Coeffs"),
112  nAllowableErrors,
113  checkFaces
114  );
115 
116  // This will have updated the mesh and implicitly the pointDisplacement
117  pointDisplacement().correctBoundaryConditions();
118 }
119 
120 
122 {
124 
125  // Update meshMover for new geometry
126  if (meshMoverPtr_.valid())
127  {
128  meshMover().movePoints(p);
129  }
130 }
131 
132 
134 (
135  const mapPolyMesh& map
136 )
137 {
139 
140  // Update meshMover for new topology
141  meshMoverPtr_.clear();
142 }
143 
144 
145 // ************************************************************************* //
Virtual base class for displacement motion solver.
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
virtual void updateMesh(const mapPolyMesh &)
Update topology.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
static autoPtr< externalDisplacementMeshMover > New(const word &type, const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement)
Return a reference to the selected meshMover model.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Macros for easy insertion into run-time selection tables.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
virtual void movePoints(const pointField &)
Update local data for geometry changes.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
stressControl lookup("compactNormalStress") >> compactNormalStress
dynamicFvMesh & mesh
externalDisplacementMeshMover & meshMover() const
const pointField & points
A class for handling words, derived from string.
Definition: word.H:59
virtual void movePoints(const pointField &)
Update local data for geometry changes.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
Virtual base class for mesh movers with externally provided displacement field giving the boundary co...
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:461
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:54
Namespace for OpenFOAM.