Skip to content

Instantly share code, notes, and snippets.

@shkiefer
Created June 24, 2020 06:41
Show Gist options
  • Save shkiefer/02facc27afb2639cc012a1daa88964e4 to your computer and use it in GitHub Desktop.
Save shkiefer/02facc27afb2639cc012a1daa88964e4 to your computer and use it in GitHub Desktop.
translate mass properties from cg to coordinate system
! 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