Page 4 - Demo
P. 4


                                    Planar Truss Example for Comrel Add-on RCP Consult, 2023-2025 Page 4 {// sin and cos of the inclination double rad=theta[e]*PI/180.; double c=cos(rad); double s=sin(rad);// coordinate transformation matrix for the bar e double T[nbd][nbd]={{c, s, 0., 0.},{-s, c, 0., 0.},{0., 0., c, s},{0., 0., -s, c}}; double TT[nbd][nbd]; double KT[nbd][nbd]; double KG[nbd][nbd];// local stiffness matrix for the bar e  double KL[nbd][nbd]={{k[e], 0., -k[e], 0.},{0., 0., 0., 0.},{-k[e], 0., k[e], 0.},{0., 0., 0., 0.}};// transpose T in TT MATRAN(&T[0][0], &TT[0][0], nbd, nbd);// get product T'*Kloc*T in KG MATMLT(&TT[0][0], &KL[0][0], &KT[0][0], nbd, nbd, nbd); MATMLT(&KT[0][0], &T[0][0], &KG[0][0], nbd, nbd, nbd);// collect coefficients in a global stiffness matrix K for(int i=0; i=0; i--) { ac[i]=fc[i]; for(int j=ndof-1; j>i; j--) ac[i]=ac[i]-K[i][j]*ac[j]; ac[i]=ac[i]/K[i][i]; }//* Axial loads in bars double NN[nfe]; for(int e=0; e
   1   2   3   4   5   6   7   8   9   10