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-2019 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 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 
48 (
49  const polyMesh& mesh,
50  const dictionary& dict
51 )
52 :
53  displacementMotionSolver(mesh, dict, typeName) // read pointDisplacement
54 {}
55 
56 
57 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
58 
61 {}
62 
63 
64 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
65 
68 {
69  if (!meshMoverPtr_.valid())
70  {
71  const word moverType(coeffDict().lookup("meshMover"));
72 
74  (
75  moverType,
76  coeffDict().optionalSubDict(moverType + "Coeffs"),
78  pointDisplacement_
79  );
80  }
81  return meshMoverPtr_();
82 }
83 
84 
87 {
88  // Return actual points. Cannot do a reference since complains about
89  // assignment to self in polyMesh::movePoints
90  return tmp<pointField>(new pointField(mesh().points()));
91 }
92 
93 
95 {
96  // The points have moved so before calculation update
97  // the mesh and motionSolver accordingly
98  movePoints(mesh().points());
99 
100  // Update any point motion bcs (e.g. timevarying)
101  pointDisplacement().boundaryFieldRef().updateCoeffs();
102 
103  label nAllowableErrors = 0;
104  labelList checkFaces(identity(mesh().nFaces()));
105  meshMover().move
106  (
107  coeffDict().optionalSubDict(meshMover().type() + "Coeffs"),
108  nAllowableErrors,
109  checkFaces
110  );
111 
112  // This will have updated the mesh and implicitly the pointDisplacement
113  pointDisplacement().correctBoundaryConditions();
114 }
115 
116 
118 {
120 
121  // Update meshMover for new geometry
122  if (meshMoverPtr_.valid())
123  {
124  meshMover().movePoints(p);
125  }
126 }
127 
128 
130 (
131  const mapPolyMesh& map
132 )
133 {
135 
136  // Update meshMover for new topology
137  meshMoverPtr_.clear();
138 }
139 
140 
141 // ************************************************************************* //
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.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
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
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.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
stressControl lookup("compactNormalStress") >> compactNormalStress
dynamicFvMesh & mesh
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.
externalDisplacementMeshMover & meshMover() const
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
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...
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.
displacementMeshMoverMotionSolver(const polyMesh &, const dictionary &)
Construct from polyMesh and dictionary.