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  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
31 #include "localPointRegion.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37  defineTypeNameAndDebug(displacementMeshMoverMotionSolver, 0);
38 
40  (
41  motionSolver,
42  displacementMeshMoverMotionSolver,
43  dictionary
44  );
45 }
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_)
74  {
75  const word moverType(coeffDict().get<word>("meshMover"));
76 
78  (
79  moverType,
80  coeffDict().optionalSubDict(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(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().optionalSubDict(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_)
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 // ************************************************************************* //
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:65
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:61
localPointRegion.H
Foam::displacementMeshMoverMotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update topology.
Definition: displacementMeshMoverMotionSolver.C:134
Foam::displacementMeshMoverMotionSolver::solve
virtual void solve()
Solve for motion.
Definition: displacementMeshMoverMotionSolver.C:98
Foam::displacementMeshMoverMotionSolver::~displacementMeshMoverMotionSolver
~displacementMeshMoverMotionSolver()
Destructor.
Definition: displacementMeshMoverMotionSolver.C:63
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::displacementMeshMoverMotionSolver::meshMover
externalDisplacementMeshMover & meshMover() const
Definition: displacementMeshMoverMotionSolver.C:71
Foam::displacementMeshMoverMotionSolver::curPoints
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
Definition: displacementMeshMoverMotionSolver.C:90
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:153
Foam::displacementMeshMoverMotionSolver::movePoints
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Definition: displacementMeshMoverMotionSolver.C:121
Foam::points0MotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
Definition: points0MotionSolver.C:157
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:161
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