velocityDisplacementMotionSolver.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) 2015 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 
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(velocityDisplacementMotionSolver, 0);
36 
38  (
39  motionSolver,
40  velocityDisplacementMotionSolver,
41  dictionary
42  );
43 }
44 
45 
46 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
47 
50 {
52  (
54  );
55 
56  wordList cmUbf = pmUbf.types();
57 
58  forAll(pmUbf, patchI)
59  {
60  if (isA<fixedValuePointPatchField<vector> >(pmUbf[patchI]))
61  {
63  }
64  }
65 
66  return cmUbf;
67 }
68 
69 
70 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
71 
73 (
74  const polyMesh& mesh,
75  const IOdictionary& dict
76 )
77 :
78  velocityMotionSolver(mesh, dict, typeName),
79  displacementMotionSolverPtr_()
80 {
82 
83  pointVectorField pointDisplacement
84  (
85  IOobject
86  (
87  "pointVelocityDisplacement",
88  mesh.time().timeName(),
89  mesh
90  ),
91  pointMotionU().mesh(),
92  dimLength,
93  pointDisplacementBoundaryTypes()
94  );
95 
96  pointDisplacement.internalField() = mesh.points() - points0;
97 
98  displacementMotionSolverPtr_.set
99  (
100  dynamic_cast<displacementMotionSolver*>
101  (
103  (
104  coeffDict().lookup("solver"),
105  mesh,
107  (
108  IOobject
109  (
110  dict.name() + "Coeffs",
111  mesh.time().constant(),
112  mesh
113  ),
114  coeffDict()
115  ),
116  pointDisplacement,
117  points0
118  ).ptr()
119  )
120  );
121 }
122 
123 
124 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
125 
127 {}
128 
129 
130 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
131 
134 {
135  return displacementMotionSolverPtr_->curPoints();
136 }
137 
138 
140 {
141  movePoints(mesh().points());
142 
143  const scalar deltaT(mesh().time().deltaTValue());
144 
145  // Current and old point displacements
146  pointVectorField& displacement
147  (
148  displacementMotionSolverPtr_->pointDisplacement()
149  );
150  const vectorField displacementOld
151  (
152  mesh().points() - displacementMotionSolverPtr_->points0()
153  );
154 
155  // Update the velocity boundary conditions
156  pointMotionU().correctBoundaryConditions();
157 
158  // Update the displacement boundary conditions
159  forAll(pointMotionU().boundaryField(), patchI)
160  {
161  const pointPatchVectorField& patchField
162  (
163  pointMotionU().boundaryField()[patchI]
164  );
165 
166  displacement.boundaryField()[patchI] ==
167  patchField.patchInternalField()*deltaT
168  + patchField.patchInternalField(displacementOld);
169  }
170 
171  // Run the sub-solver
172  displacementMotionSolverPtr_->solve();
173 
174  // Update the velocity
175  pointMotionU().internalField() =
176  (displacement.internalField() - displacementOld)/deltaT;
177 }
178 
179 
181 {
183 
184  displacementMotionSolverPtr_->movePoints(p);
185 }
186 
187 
189 (
190  const mapPolyMesh& mpm
191 )
192 {
194 
195  displacementMotionSolverPtr_->updateMesh(mpm);
196 }
197 
198 
199 // ************************************************************************* //
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
Foam::polyMesh::points
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:979
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::velocityDisplacementMotionSolver::movePoints
virtual void movePoints(const pointField &)
Update geometry.
Definition: velocityDisplacementMotionSolver.C:180
Foam::displacementMotionSolver::New
static autoPtr< displacementMotionSolver > New(const word &solverTypeName, const polyMesh &, const IOdictionary &, const pointVectorField &pointDisplacement, const pointIOField &points0)
Select constructed from polyMesh, dictionary and components.
Definition: displacementMotionSolver.C:182
p
p
Definition: pEqn.H:62
Foam::IOField< vector >
Foam::velocityDisplacementMotionSolver::pointDisplacementBoundaryTypes
wordList pointDisplacementBoundaryTypes() const
Get the boundary condition types for the point displacement.
Definition: velocityDisplacementMotionSolver.C:49
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::dictionaryName::name
const fileName & name() const
Return the dictionary name.
Definition: dictionary.H:103
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Foam::velocityDisplacementMotionSolver::velocityDisplacementMotionSolver
velocityDisplacementMotionSolver(const velocityDisplacementMotionSolver &)
Disallow default bitwise copy construct.
Foam::velocityMotionSolver::movePoints
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Definition: velocityMotionSolver.C:70
Foam::GeometricField::boundaryField
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
Definition: GeometricField.C:735
Foam::pointPatchField::patchInternalField
tmp< Field< Type > > patchInternalField() const
Return field created from appropriate internal field values.
Foam::velocityMotionSolver
Virtual base class for velocity motion solver.
Definition: velocityMotionSolver.H:54
Foam::velocityDisplacementMotionSolver::~velocityDisplacementMotionSolver
~velocityDisplacementMotionSolver()
Destructor.
Definition: velocityDisplacementMotionSolver.C:126
Foam::pointPatchField
Abstract base class for point-mesh patch fields.
Definition: pointMVCWeight.H:58
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::velocityDisplacementMotionSolver::curPoints
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
Definition: velocityDisplacementMotionSolver.C:133
velocityDisplacementMotionSolver.H
Foam::fixedValuePointPatchField< vector >
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::velocityMotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
Definition: velocityMotionSolver.C:76
Foam::GeometricField::internalField
InternalField & internalField()
Return internal field.
Definition: GeometricField.C:724
fixedValuePointPatchField.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::displacementMotionSolver
Virtual base class for displacement motion solver.
Definition: displacementMotionSolver.H:55
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
boundaryField
cellIbMask *cellIbMaskExt *faceIbMask *cellIbMask boundaryField().evaluateCoupled()
Foam::velocityDisplacementMotionSolver::solve
virtual void solve()
Solve for motion.
Definition: velocityDisplacementMotionSolver.C:139
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
displacementMotionSolver.H
Foam::velocityDisplacementMotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update topology.
Definition: velocityDisplacementMotionSolver.C:189
Foam::GeometricField::GeometricBoundaryField::types
wordList types() const
Return a list of the patch types.
Definition: GeometricBoundaryField.C:534
Foam::Time::timeName
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
Foam::isA
bool isA(const Type &t)
Check if a dynamic_cast to typeid is possible.
Definition: typeInfo.H:134
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::TimePaths::constant
const word & constant() const
Return constant name.
Definition: TimePaths.H:130
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::velocityMotionSolver::pointMotionU
pointVectorField & pointMotionU()
Return reference to the point motion velocity field.
Definition: velocityMotionSolver.H:102
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
Foam::displacementMotionSolver::points0IO
static IOobject points0IO(const polyMesh &mesh)
Return IO object for points0.
Definition: displacementMotionSolver.C:40
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::GeometricField::GeometricBoundaryField
Definition: GeometricField.H:105
lookup
stressControl lookup("compactNormalStress") >> compactNormalStress