solidBodyMotionSolver.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) 2016 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 
29 #include "solidBodyMotionSolver.H"
31 #include "transformField.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37  defineTypeNameAndDebug(solidBodyMotionSolver, 0);
39  (
40  motionSolver,
41  solidBodyMotionSolver,
42  dictionary
43  );
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
49 Foam::solidBodyMotionSolver::solidBodyMotionSolver
50 (
51  const polyMesh& mesh,
52  const IOdictionary& dict
53 )
54 :
56  SBMFPtr_(solidBodyMotionFunction::New(coeffDict(), mesh.time()))
57 {}
58 
59 
60 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
61 
63 {
64  if (moveAllCells())
65  {
66  return transformPoints(SBMFPtr_().transformation(), points0_);
67  }
68  else
69  {
70  auto ttransformedPts = tmp<pointField>::New(mesh().points());
71  pointField& transformedPts = ttransformedPts.ref();
72 
73  UIndirectList<point>(transformedPts, pointIDs()) = transformPoints
74  (
75  SBMFPtr_().transformation(),
77  );
78 
79  return ttransformedPts;
80  }
81 }
82 
83 
84 // ************************************************************************* //
dictionary dict
void transformPoints(vectorField &, const septernion &, const vectorField &)
Transform given vectorField of coordinates with the given septernion.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Macros for easy insertion into run-time selection tables.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
Spatial transformation functions for primitive fields.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:38
dynamicFvMesh & mesh
const pointField & points
Base class for defining solid-body motions.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition: tmp.H:206
defineTypeNameAndDebug(combustionModel, 0)
bool moveAllCells() const noexcept
Move all cells?
Definition: zoneMotion.H:110
const labelList & pointIDs() const noexcept
The point ids (for cell set/zone subset)
Definition: zoneMotion.H:102
Virtual base class for displacement motion solvers, where the point motion is relative to a set of fi...
pointIOField points0_
Starting points.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:165
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.