Programming finite elements in java

Page 170

152

13 Implementation of Three-dimensional Quadratic Element

44. The derivatives of shape functions at integration point ip are calculated in lines 45–46. Two loops with parameters i in line 49 and j in line 54 are employed for treating all node combinations for element nodes. Parameter j starts from value i, thus computing just the upper symmetric part of the stiffness matrix. The derivatives of shape functions ∂ Ni /∂ x, ∂ Ni /∂ y and ∂ Ni /∂ z are denoted as dix, diy diz (lines 51–53). Identifiers djx, djy djz are used for derivatives ∂ N j /∂ x, ∂ N j /∂ y and ∂ N j /∂ z in lines 55–57. Block 3 by 3 of the stiffness matrix is calculated in lines 60–81. For numerical integration, each computed coefficient is multiplied by dv that is composed of the determinant of the Jacobian matrix and the integration weight.

13.2.2 Thermal Vector Method thermalVector computes an element thermal vector according to Equation 12.20. The algorithm is similar to that for stiffness matrix estimation. 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113

// Compute thermal vector public void thermalVector() { for (int i = 0; i < 60; i++) evec[i] = 0.; mat = (Material)fem.materials.get(matName); double alpha = mat.getAlpha(); double lambda = mat.getLambda(); double mu = mat.getMu(); double g = 3*lambda + 2*mu; for (int ip = 0; ip < gh.nIntPoints; ip++) { ShapeQuad3D.shape(gh.xii[ip], gh.eti[ip], gh.zei[ip], ind, an); // Temperature at integration point double t = 0; for (int i = 0; i < 20; i++) t += an[i]*dtn[i]; double det = ShapeQuad3D.deriv(gh.xii[ip], gh.eti[ip], gh.zei[ip], ind, xy, dnxy); double dv = g*alpha*t*det*gh.wi[ip]; for (int i=0; i<20; i++) { for (int j=0; j<3; j++) { evec[i*3+j] += dnxy[i][j]*dv; } } } }

Elastic material properties are set in lines 92–96. Integration is performed with the use of the Gauss rule gh inside a loop, which starts in line 98. Shape functions an estimated in lines 99–100 are used for temperature interpolation in lines 102– 103. Partial derivatives of shape functions are calculated in lines 104–105 and then used for accumulation of contributions to the thermal vector evec (line 109).


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.