momentOfInertia.H
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) 2011-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 Class
25  Foam::momentOfInertia
26 
27 Description
28  Calculates the inertia tensor and principal axes and moments of a
29  polyhedra/cells/triSurfaces. Inertia can either be of the solid body or
30  of a thin shell.
31 
32 SourceFiles
33  momentOfInertia.H
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef momentOfInertia_H
38 #define momentOfInertia_H
39 
40 #include "triFaceList.H"
41 #include "triSurface.H"
42 #include "polyMesh.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class momentOfInertia Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class momentOfInertia
54 {
55 
56 public:
57 
58  static void massPropertiesSolid
59  (
60  const pointField& pts,
61  const triFaceList& triFaces,
62  scalar density,
63  scalar& mass,
64  vector& cM,
65  tensor& J
66  );
67 
68  static void massPropertiesShell
69  (
70  const pointField& pts,
71  const triFaceList& triFaces,
72  scalar density,
73  scalar& mass,
74  vector& cM,
75  tensor& J,
76  bool doReduce = false
77  );
78 
79  static void massPropertiesSolid
80  (
81  const triSurface& surf,
82  scalar density,
83  scalar& mass,
84  vector& cM,
85  tensor& J
86  );
87 
88  static void massPropertiesShell
89  (
90  const triSurface& surf,
91  scalar density,
92  scalar& mass,
93  vector& cM,
94  tensor& J,
95  bool doReduce = false
96  );
97 
98  static void massPropertiesPatch
99  (
100  const polyPatch& pp,
101  scalar density,
102  scalar& mass,
103  vector& cM,
104  tensor& J,
105  bool doReduce = false
106  );
107 
109  (
110  scalar mass,
111  const vector& cM,
112  const tensor& J,
113  const vector& refPt
114  );
115 
116  // Calculate the inertia tensor for all cells in the mesh
118  (
119  const polyMesh& mesh
120  );
121 
122  // Calculate the inertia tensor the given cell
123  static tensor meshInertia
124  (
125  const polyMesh& mesh,
126  label cellI
127  );
128 };
129 
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 } // End namespace Foam
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 #endif
138 
139 // ************************************************************************* //
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
Foam::momentOfInertia::massPropertiesPatch
static void massPropertiesPatch(const polyPatch &pp, scalar density, scalar &mass, vector &cM, tensor &J, bool doReduce=false)
Definition: momentOfInertia.C:298
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::momentOfInertia::meshInertia
static tmp< tensorField > meshInertia(const polyMesh &mesh)
Definition: momentOfInertia.C:350
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::momentOfInertia::massPropertiesSolid
static void massPropertiesSolid(const pointField &pts, const triFaceList &triFaces, scalar density, scalar &mass, vector &cM, tensor &J)
Definition: momentOfInertia.C:32
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:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::triSurface
Triangulated surface description with patch information.
Definition: triSurface.H:57
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::momentOfInertia::applyParallelAxisTheorem
static tensor applyParallelAxisTheorem(scalar mass, const vector &cM, const tensor &J, const vector &refPt)
Definition: momentOfInertia.C:332
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::momentOfInertia
Calculates the inertia tensor and principal axes and moments of a polyhedra/cells/triSurfaces....
Definition: momentOfInertia.H:52
Foam::Vector< scalar >
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
triFaceList.H
Foam::momentOfInertia::massPropertiesShell
static void massPropertiesShell(const pointField &pts, const triFaceList &triFaces, scalar density, scalar &mass, vector &cM, tensor &J, bool doReduce=false)
Definition: momentOfInertia.C:189