Page 5 - Demo
P. 5
Planar TrussExamplefor ComrelAdd-onRCPConsult, 2021-2025Page 5endelsifnf ==3# set a main subtitle of plotplt.text(12.0,8.0,'Internal member von Mises stress $\\sigma_{v}$ [MPa]',fontsize:16,ha:'center')# prepare color mappingjet=pltget_cmap('jet')minA=[*[*@NN.abs/areab*1e-6].to_a].minmaxA=[*[*@NN.abs/areab*1e6].to_a].maxcNorm=plt.Normalize.call(minA,maxA)scalarMap=cmx.ScalarMappable.call(norm:cNorm,cmap:jet)plt.colorbar(scalarMap,use_gridspec:true,ax:plt.gca())# plot for internal member von Mises stressdA=maxAminAfore in0..nfe1@Su=@NN[e].abs/areab[e]*1e-6l=leng[e]/2n=@Su/dA*0.2@X=DFloat[*[l,l,l,l]]@Y=DFloat[*[n,n,n,n]]c=Math.cos(theta[e])# cosine inclination angles=Math.sin(theta[e])# sinus inclination anglex=(@XY[ien[e,0]1,0]+@XY[ien[e,1]1,0])/2y=(@XY[ien[e,0]-1,1]+@XY[ien[e,1]-1,1])/2@Xrot=@X*c@Y*s+x@Yrot=@X*s+@Y*c+yco=scalarMap.to_rgba(@Su)plt.fill(@Xrot.to_a,@Yrot.to_a,color:co,l0.5,alpha:0.7)plt.text(x,y,'%0.0f'%@Su,fontsize:7,ha:'center',va:'center')endend## do rest for all plotsplt.title(tit,fontsize:18)# plot values of input dataplt.text(22,5.5,'A1=%g $m^2