Go to the documentation of this file.
77 const scalar r6 = 1.0/6.0;
78 const scalar r24 = 1.0/24.0;
79 const scalar r60 = 1.0/60.0;
80 const scalar r120 = 1.0/120.0;
87 const triFace& tri(triFaces[i]);
100 scalar tmp0, tmp1, tmp2;
102 scalar f1x, f2x, f3x, g0x, g1x, g2x;
104 tmp0 = v0.
x() + v1.
x();
106 tmp1 = v0.x()*v0.x();
107 tmp2 = tmp1 + v1.
x()*tmp0;
108 f2x = tmp2 + v2.
x()*f1x;
109 f3x = v0.x()*tmp1 + v1.
x()*tmp2 + v2.
x()*f2x;
110 g0x = f2x + v0.x()*(f1x + v0.x());
111 g1x = f2x + v1.
x()*(f1x + v1.
x());
112 g2x = f2x + v2.
x()*(f1x + v2.
x());
114 scalar f1y, f2y, f3y, g0y, g1y, g2y;
116 tmp0 = v0.y() + v1.
y();
118 tmp1 = v0.y()*v0.y();
119 tmp2 = tmp1 + v1.
y()*tmp0;
120 f2y = tmp2 + v2.
y()*f1y;
121 f3y = v0.y()*tmp1 + v1.
y()*tmp2 + v2.
y()*f2y;
122 g0y = f2y + v0.y()*(f1y + v0.y());
123 g1y = f2y + v1.
y()*(f1y + v1.
y());
124 g2y = f2y + v2.
y()*(f1y + v2.
y());
126 scalar f1z, f2z, f3z, g0z, g1z, g2z;
128 tmp0 = v0.z() + v1.
z();
130 tmp1 = v0.z()*v0.z();
131 tmp2 = tmp1 + v1.
z()*tmp0;
132 f2z = tmp2 + v2.
z()*f1z;
133 f3z = v0.z()*tmp1 + v1.
z()*tmp2 + v2.
z()*f2z;
134 g0z = f2z + v0.z()*(f1z + v0.z());
135 g1z = f2z + v1.
z()*(f1z + v1.
z());
136 g2z = f2z + v2.
z()*(f1z + v2.
z());
139 integrals[0] +=
n.x()*f1x;
140 integrals[1] +=
n.x()*f2x;
141 integrals[2] +=
n.y()*f2y;
142 integrals[3] +=
n.z()*f2z;
143 integrals[4] +=
n.x()*f3x;
144 integrals[5] +=
n.y()*f3y;
145 integrals[6] +=
n.z()*f3z;
146 integrals[7] +=
n.x()*(v0.y()*g0x + v1.
y()*g1x + v2.
y()*g2x);
147 integrals[8] +=
n.y()*(v0.z()*g0y + v1.
z()*g1y + v2.
z()*g2y);
148 integrals[9] +=
n.z()*(v0.x()*g0z + v1.
x()*g1z + v2.
x()*g2z);
158 integrals[7] *= r120;
159 integrals[8] *= r120;
160 integrals[9] *= r120;
166 cM =
vector(integrals[1], integrals[2], integrals[3])/mass;
169 J.
xx() = integrals[5] + integrals[6];
170 J.
xy() = -integrals[7];
171 J.
xz() = -integrals[9];
173 J.
yy() = integrals[4] + integrals[6];
174 J.
yz() = -integrals[8];
177 J.
zz() = integrals[4] + integrals[5];
180 J -= mass*((cM & cM)*
I - cM*cM);
209 const triFace& tri(triFaces[i]);
218 scalar triMag = t.
mag();
239 const triFace& tri(triFaces[i]);
246 ).inertia(cM, density);
272 massPropertiesSolid(surf.
points(), faces, density, mass, cM, J);
293 massPropertiesShell(surf.
points(), faces, density, mass, cM, J, doReduce);
312 const face&
f = pp[faceI];
318 for (
label i = 1; i <
f.size() - 1; i++)
327 massPropertiesShell(pp.
points(), triFaces, density, mass, cM, J, doReduce);
345 return J + mass*((d & d)*
I - d*d);
360 tf[cI] = meshInertia(
mesh, cI);
383 faces[cTI] = cellTets[cTI].faceTriIs(
mesh);
390 massPropertiesSolid(
mesh.points(), faces, 1.0, m, cM, J);
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
static void massPropertiesPatch(const polyPatch &pp, scalar density, scalar &mass, vector &cM, tensor &J, bool doReduce=false)
const Field< PointType > & points() const
Return reference to global points.
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
static tmp< tensorField > meshInertia(const polyMesh &mesh)
Mesh consisting of general polyhedral cells.
Point centre() const
Return centre (centroid)
static void massPropertiesSolid(const pointField &pts, const triFaceList &triFaces, scalar density, scalar &mass, vector &cM, tensor &J)
A triangle primitive used to calculate face normals and swept volumes.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
Triangulated surface description with patch information.
A patch is a list of labels that address the faces in the global face list.
static const sphericalTensor I(1)
static tensor applyParallelAxisTheorem(scalar mass, const vector &cM, const tensor &J, const vector &refPt)
Vector< scalar > vector
A scalar version of the templated Vector.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
scalar mag() const
Return scalar magnitude.
A triangular face using a FixedList of labels corresponding to mesh vertices.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A face is a list of labels corresponding to mesh vertices.
void size(const label)
Override size to be inconsistent with allocated storage.
triangle< point, const point & > triPointRef
static void massPropertiesShell(const pointField &pts, const triFaceList &triFaces, scalar density, scalar &mass, vector &cM, tensor &J, bool doReduce=false)