TAGGED: ansys-mechanical, apdl, static-structural
-
-
September 1, 2021 at 11:43 am
whbutc
SubscriberI'm using Ansys 2019 R3 for a static structural analysis and trying to write APDL code to find the individual component mass, CG, and MOI. I've already got code that grabs each component name and then grabs the max value of each of von-mises, max and min principal. When I've tried adding on the following code it just gives results for the entire model instead of the selected component elements.
IRLIST
*Get,mass_x,ELEM,0,MTOT,X
*Get,cg_x,ELEM,0,MC,X
*Get,moi_x,ELEM,0,IMC,X
I've found an example online that uses the below code and then uses the above *Get commands tograb individual component results. But it appears that PSOLVE is now a legacy command. Is there a new command that has taken its place that I need to be using? Or a different approach I should be using for this?
irlf,-1 ! Precalculate masses for summary printout only (no inertia relief) psolve,elform ! Getting information about partial solving psolve,elprep ! Solving
September 13, 2021 at 10:59 pmwrbulat
Ansys EmployeeYes, PSOLVE is legacy command (undocumented) but it's still in the code and still works. The documentation of this command looked like this:
Please rename attached "inertial_props.txt" to "inertial_props.mac". Read attached "test01.txt" into an interactive MAPDL session (make sure "inertial_props.mac" is in the MAPDL working directory when you do). It solves in a heartbeat and leaves you looking at the inertial properties of the model:
Best Bill
September 13, 2021 at 11:04 pmwrbulat
Ansys EmployeeOh, so to get the inertial properties of a subset of elements, select those elements and their nodes (ESLN) and then invoke the macro.
September 17, 2021 at 7:25 pmwrbulat
Ansys Employeecontents of "test01.inp":
fini
/cle
/vie,1,1,1,1
/esha,1
*abbr,inrtprop,inertial_props
abbs
abbr
C************************************
C*** PARAMETERS
C************************************
l=0.1
w=0.02
t=0.005
E=2e11
nu=0.3
dnsty=7800
mass_expected=l*w*t*dnsty
C************************************
C*** MODEL
C************************************
/prep7
rect,,l,,w
et,1,181
sect,1,shell
secd,t
r,1,t
mp,ex,1,E
mp,nuxy,1,nu
mp,dens,1,dnsty
ames,all
nsel,s,loc,x
d,all,all
fini
allsel
inertial_props
Contents of "inertial_props.mac":
/sol ! macro by Bill Bulat
/uis,msgpop,3
irlf,-1
ematwrite,yes
psolve,elform
psolve,elprep
irlist
*get,mtot,elem,,mtot,x
*get,mcx,elem,,mc,x
*get,mcy,elem,,mc,y
*get,mcz,elem,,mc,z
*get,imcx,elem,,imc,x
*get,imcy,elem,,imc,y
*get,imcz,elem,,imc,z
*get,ipx,elem,,iprin,x
*get,ipy,elem,,iprin,y
*get,ipz,elem,,iprin,z
*get,ang_xy,elem,,iang,xy
*get,ang_yz,elem,,iang,yz
*get,ang_zx,elem,,iang,zx
/uis,msgpop,2
*msg,ui,mtot,mcx,mcy,mcz,imcx,imcy,imcz
Total Mass: %G %/&
CGX = %G %/&
CGY = %G %/&
CGZ = %G %/&
IXX = %G %/&
IYY = %G %/&
IZZ = %G %/&
September 18, 2021 at 3:01 amAniket
Forum Moderatorcontents of "test01.inp":
fini
/cle
/vie,1,1,1,1
/esha,1
*abbr,inrtprop,inertial_props
abbs
abbr
C************************************
C*** PARAMETERS
C************************************
l=0.1
w=0.02
t=0.005
E=2e11
nu=0.3
dnsty=7800
mass_expected=l*w*t*dnsty
C************************************
C*** MODEL
C************************************
/prep7
rect,,l,,w
et,1,181
sect,1,shell
secd,t
r,1,t
mp,ex,1,E
mp,nuxy,1,nu
mp,dens,1,dnsty
ames,all
nsel,s,loc,x
d,all,all
fini
allsel
inertial_props
Contents of "inertial_props.mac":
/sol ! macro by Bill Bulat
/uis,msgpop,3
irlf,-1
ematwrite,yes
psolve,elform
psolve,elprep
irlist
*get,mtot,elem,,mtot,x
*get,mcx,elem,,mc,x
*get,mcy,elem,,mc,y
*get,mcz,elem,,mc,z
*get,imcx,elem,,imc,x
*get,imcy,elem,,imc,y
*get,imcz,elem,,imc,z
*get,ipx,elem,,iprin,x
*get,ipy,elem,,iprin,y
*get,ipz,elem,,iprin,z
*get,ang_xy,elem,,iang,xy
*get,ang_yz,elem,,iang,yz
*get,ang_zx,elem,,iang,zx
/uis,msgpop,2
*msg,ui,mtot,mcx,mcy,mcz,imcx,imcy,imcz
Total Mass: %G %/&
CGX = %G %/&
CGY = %G %/&
CGZ = %G %/&
IXX = %G %/&
IYY = %G %/&
IZZ = %G %/&
May 19, 2023 at 2:05 pmS.Bender
SubscriberI am using mechanical and I used the following post command to extract the mass of 2 of the 4 bodies in my model. (it's essentially what has been discussed above)
/solu
allsel
cmsel,,comp_1,elem
cmsel,a,comp_2,elem
nsle
!irlf,-1Â Â Â Â Â Commented because irlf command doesnt work with axisymmetric elements
psolve,elform
psolve,elprep
*get,mass_x,elem,,MTOT,X
my_mass_x = mass_x*386.1 !use "my_" prefix to create parameterized output (in lbm)Viewing 5 reply threads- The topic ‘MAPDL Code to Find Component Mass, CG, and MOI’ is closed to new replies.
Ansys Innovation SpaceTrending discussions- The legend values are not changing.
- LPBF Simulation of dissimilar materials in ANSYS mechanical (Thermal Transient)
- Convergence error in modal analysis
- APDL, memory, solid
- How to model a bimodular material in Mechanical
- Meaning of the error
- Simulate a fan on the end of shaft
- Nonlinear load cases combinations
- Real Life Example of a non-symmetric eigenvalue problem
- How can the results of Pressures and Motions for all elements be obtained?
Top Contributors-
3882
-
1414
-
1241
-
1118
-
1015
Top Rated Tags© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-