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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
30 #include "localPointRegion.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36  defineTypeNameAndDebug(displacementMeshMoverMotionSolver, 0);
37 
39  (
40  motionSolver,
41  displacementMeshMoverMotionSolver,
42  dictionary
43  );
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
49 Foam::displacementMeshMoverMotionSolver::displacementMeshMoverMotionSolver
50 (
51  const polyMesh& mesh,
52  const IOdictionary& dict
53 )
54 :
55  displacementMotionSolver(mesh, dict, typeName) // read pointDisplacement
56 {}
57 
58 
59 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
60 
63 {}
64 
65 
66 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
67 
68 
71 {
72  if (!meshMoverPtr_.valid())
73  {
74  const word moverType(coeffDict().get<word>("meshMover"));
75 
77  (
78  moverType,
79  coeffDict().optionalSubDict(moverType + "Coeffs"),
81  pointDisplacement_
82  );
83  }
84  return *meshMoverPtr_;
85 }
86 
87 
90 {
91  // Return actual points. Cannot do a reference since complains about
92  // assignment to self in polyMesh::movePoints
93  return tmp<pointField>::New(mesh().points());
94 }
95 
96 
98 {
99  // The points have moved so before calculation update
100  // the mesh and motionSolver accordingly
101  movePoints(mesh().points());
102 
103  // Update any point motion bcs (e.g. timevarying)
104  pointDisplacement().boundaryFieldRef().updateCoeffs();
105 
106  label nAllowableErrors = 0;
107  labelList checkFaces(identity(mesh().nFaces()));
108  meshMover().move
109  (
110  coeffDict().optionalSubDict(meshMover().type() + "Coeffs"),
111  nAllowableErrors,
112  checkFaces
113  );
114 
115  // This will have updated the mesh and implicitly the pointDisplacement
116  pointDisplacement().correctBoundaryConditions();
117 }
118 
119 
121 {
123 
124  // Update meshMover for new geometry
125  if (meshMoverPtr_.valid())
126  {
127  meshMover().movePoints(p);
128  }
129 }
130 
131 
133 (
134  const mapPolyMesh& map
135 )
136 {
138 
139  // Update meshMover for new topology
140  meshMoverPtr_.clear();
141 }
142 
143 
144 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::externalDisplacementMeshMover::New
static autoPtr< externalDisplacementMeshMover > New(const word &type, const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement, const bool dryRun=false)
Return a reference to the selected meshMover model.
Definition: externalDisplacementMeshMover.C:137
displacementMeshMoverMotionSolver.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
localPointRegion.H
Foam::displacementMeshMoverMotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update topology.
Definition: displacementMeshMoverMotionSolver.C:133
Foam::displacementMeshMoverMotionSolver::solve
virtual void solve()
Solve for motion.
Definition: displacementMeshMoverMotionSolver.C:97
Foam::displacementMeshMoverMotionSolver::~displacementMeshMoverMotionSolver
~displacementMeshMoverMotionSolver()
Destructor.
Definition: displacementMeshMoverMotionSolver.C:62
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::displacementMeshMoverMotionSolver::meshMover
externalDisplacementMeshMover & meshMover() const
Definition: displacementMeshMoverMotionSolver.C:70
Foam::displacementMeshMoverMotionSolver::curPoints
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
Definition: displacementMeshMoverMotionSolver.C:89
Foam::label
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:62
Foam::Field< vector >
Foam::externalDisplacementMeshMover
Virtual base class for mesh movers with externally provided displacement field giving the boundary co...
Definition: externalDisplacementMeshMover.H:58
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::displacementMotionSolver
Virtual base class for displacement motion solver.
Definition: displacementMotionSolver.H:53
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::points0MotionSolver::movePoints
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Definition: points0MotionSolver.C:154
Foam::displacementMeshMoverMotionSolver::movePoints
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Definition: displacementMeshMoverMotionSolver.C:120
Foam::points0MotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
Definition: points0MotionSolver.C:158
Foam::List< label >
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::identity
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
Definition: labelList.C:38
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:160
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::localPointRegion::findDuplicateFacePairs
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
Definition: localPointRegion.C:625