Skip to content

Instantly share code, notes, and snippets.

@shkiefer
Last active June 18, 2020 07:50
Show Gist options
  • Save shkiefer/48ad546817b3e62dc3cc10a3ad9c22d3 to your computer and use it in GitHub Desktop.
Save shkiefer/48ad546817b3e62dc3cc10a3ad9c22d3 to your computer and use it in GitHub Desktop.
! get inertia about CG & mass
*get, mass_x, ELEM,0,MTOT,X
*get, mass_y, ELEM,0,MTOT,Y
*get, mass_z, ELEM,0,MTOT,Z
*get, cg_x, ELEM,0,MC,X
*get, cg_y, ELEM,0,MC,Y
*get, cg_z, ELEM,0,MC,Z
*get, moim_x, ELEM,0,IMC,X
*get, moim_y, ELEM,0,IMC,Y
*get, moim_z, ELEM,0,IMC,Z
*get, moim_xy, ELEM,0,IMC,XY
*get, moim_yz, ELEM,0,IMC,YZ
*get, moim_zx, ELEM,0,IMC,ZX
! translate inertia components to cs_mass loc
xg = cg_x - cs_x
yg = cg_y - cs_y
zg = cg_z - cs_z
Ixx_cst = moim_x+mass_x*(yg**2+zg**2)
Iyy_cst = moim_y+mass_y*(xg**2+zg**2)
Izz_cst = moim_z+mass_z*(xg**2+yg**2)
Ixy_cst = moim_xy+mass_x*xg*yg
Iyz_cst = moim_yz+mass_y*yg*zg
Izx_cst = moim_zx+mass_z*zg*xg
! create APDL 2D array
*dim,I_cst, array,3,3
I_cst(1,1)=Ixx_cst
I_cst(1,2)=Ixy_cst
I_cst(1,3)=Izx_cst
I_cst(2,1)=Ixy_cst
I_cst(2,2)=Iyy_cst
I_cst(2,3)=Iyz_cst
I_cst(3,1)=Izx_cst
I_cst(3,2)=Iyz_cst
I_cst(3,3)=Izz_cst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment