This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*cfopen, %_wb_userfiles_dir(1)%%f_name%, txt | |
*vwrite,'Component','CS_ID','mass_X','mass_Y','mass_Z','Ics_xx','Ics_yy','Ics_zz','Ics_xy','Ics_xz','Ics_yx','Ics_yz','Ics_zx','Ics_zy' | |
%12C,%12C,%12C,%12C,%12C,%12C,%12C,%12C,%12C,%12C,%12C,%12C,%12C,%12C | |
*dim,outVars,array,nCMs,12 | |
finish | |
/filname, mass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f_name = 'my_mass' | |
nCMs = 2 | |
*DIM, cms, STRING, 100, nCMs | |
cms(1,1) = 'my_comp_1' | |
cms(1,2) = 'my_comp_2' | |
*DIM, css, STRING, 100, nCMs | |
css(1,1) = 'cs_comp_1' | |
css(1,2) = 'cs_comp_2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*do,j,1,nCMs | |
fini | |
/prep7 | |
! get cs_mass location and angles | |
*GET,cs_x,CDSY,%css(1,j)%,LOC,X | |
*GET,cs_y,CDSY,%css(1,j)%,LOC,Y | |
*GET,cs_z,CDSY,%css(1,j)%,LOC,Z | |
*GET,cs_xy,CDSY,%css(1,j)%,ANG,XY | |
*GET,cs_yz,CDSY,%css(1,j)%,ANG,YZ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! make transformation matrix T | |
PI=ACOS(-1) | |
c1=COS(cs_xy*PI/180.) | |
c2=COS(cs_yz*PI/180.) | |
c3=COS(cs_zx*PI/180.) | |
s1=SIN(cs_xy*PI/180.) | |
s2=SIN(cs_yz*PI/180.) | |
s3=SIN(cs_zx*PI/180.) | |
txx = c1*c3-s1*s2*s3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*vwrite,cms(1,1),css(1,1),outVars(1,1),outVars(1,2),outVars(1,3),outVars(1,4),outVars(1,5),outVars(1,6),outVars(1,7),outVars(1,8),outVars(1,9),outVars(1,10),outVars(1,11),outVars(1,12) | |
%12c,%12.0f,%12.3e,%12.3e,%12.3e,%12.3e,%12.3e,%12.3e,%12.3e,%12.3e,%12.3e,%12.3e,%12.3e,%12.3e | |
*cfclos | |
finish | |
/filname | |
/post1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALLSEL | |
! define coordinate system to calculate mass properties about, my_cs is an 'apdl_name' or specific cs ID (integer) | |
cs_mass = my_cs | |
finish | |
! change filename to write output to mass.out to not overwrite default file.out | |
/filname, mass | |
fini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fini | |
/sol | |
! prepare element matrices / calculate mass properties | |
irlf,-1 | |
psolve,elform | |
psolve,elprep | |
! get translational mass | |
*get, mass_x, ELEM,0,MTOT,X |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! make transformation matrix T | |
PI=ACOS(-1) | |
c1=COS(cs_xy*PI/180.) | |
c2=COS(cs_yz*PI/180.) | |
c3=COS(cs_zx*PI/180.) | |
s1=SIN(cs_xy*PI/180.) | |
s2=SIN(cs_yz*PI/180.) | |
s3=SIN(cs_zx*PI/180.) | |
txx = c1*c3-s1*s2*s3 |
OlderNewer