Game Development Reference
In-Depth Information
void buildBe(CMatrix &Be, //Strain
displacement matrix (out)
CMatrix const &Pe) //Barycentric matrix (in)
//First row
Be(0,0) = Pe(0,1); Be(0,3) = Pe (1,1);
Be(0,6) = Pe(2,1); Be(0,9) = Pe (3,1);
//Second row
Be(1,1) = Pe(0,2); Be(1,4) = Pe (1,2);
Be(1,7) = Pe(2,2); Be(1,10) = Pe (3,2);
//Third row
Be(2,2) = Pe(0,3); Be(2,5) = Pe (1,3);
Be(2,8) = Pe(2,3); Be(2,11) = Pe (3,3);
//Fourth row
Be(3,0) = 0.5 Pe(0,2); Be(3,1) = 0.5 Pe (0,1);
Be(3,3) = 0.5 Pe(1,2); Be(3,4) = 0.5 Pe (1,1);
Be(3,6) = 0.5
Pe (2,1);
Be(3,9) = 0.5 Pe(3,2); Be(3,10) = 0.5 Pe (3,1);
Pe(2,2); Be(3,7) = 0.5
//Fifth row
Be(4,1) = 0.5
Pe (0,2);
Be(4,4) = 0.5 Pe(1,3); Be(4,5) = 0.5 Pe (1,2);
Be(4,7) = 0.5
Pe(0,3); Be(4,2) = 0.5
Pe (2,2);
Be(4,10) = 0.5 Pe(3,3); Be(4,11) = 0.5 Pe (3,2);
Pe(2,3); Be(4,8) = 0.5
//Sixth row
Be(5,0) = 0.5 Pe(0,3); Be(5,2) = 0.5 Pe (0,1);
Be(5,3) = 0.5 Pe(1,3); Be(5,5) = 0.5 Pe (1,1);
Be(5,6) = 0.5 Pe(2,3); Be(5,8) = 0.5 Pe (2,1);
Be(5,9) = 0.5
Pe(3,3); Be(5,11) = 0.5
Pe (3,1);
}
Listing 10.2. Building matrix B e .
can be used to compute the stiffness matrix of the tetrahedron K e ,asshownin
the code in Listing 10.3. Finally, we show how to assemble the global matrix K
in Listing 10.4. These algorithms are useful for the general case, but when we
are modeling a linear and isotropic material, we can simplify the algorithm using
Listing 10.5.
We can obtain the displacement of the nodes under external forces by inverting
the stiffness matrix as follows:
u = K 1 F ext .
(10.13)