# Macro for Elastic Stress Check

 Register Blogs Members List Search Today's Posts Mark Forums Read

 November 21, 2018, 11:15 Macro for Elastic Stress Check #1 New Member   Reece Gibb Join Date: Nov 2018 Posts: 1 Rep Power: 0 Hi everyone I'm a 4th year Mechanical Engineering student completing my individual project on 'Local Plastic Failure Assessment in Pressure Vessel Design by Analysis'. As part of this I'm trying to run a macro using ANSYS Mechanical APDL to perform the elastic analysis check equation 5.5 (sum of principal stresses less than or equal to 4*design stress) from the ASME code Section 8, Div 2 part 5.3. However, I can't get my macro to run and I'm a bit stuck. Any help would be appreciated. Thanks in advance /CLEAR *cfopen,stresses6,out, *GET,NMAX,NODE,,NUM,MAXD !Define array *dim,sig1,array,nmax *dim,sig2,array,nmax *dim,sig3,array,nmax *dim,sigsum,array,nmax *dim,nodnum,array,nmax *dim,dstres,array,nmax *dim,design,array,nmax *do,i,1,nmax *set,nnum,i *set,nodnum(i),nnum *GET, siga, NODE, i, s, 3 *set,sig1(i),siga *GET, sigb, NODE, i, s, 2 *set,sig2(i),sigb *GET, sigc, NODE, i, s, 3 *set,sig3(i),sigc ! calculate sum of prin stress ssum=siga+sigb+sigc *set,sigsum(i),ssum *enddo *set,dstres(i),300000 *do,i,1,nmax *IF,sigsum(i),LE,4*dstres(i),THEN *set,design(i),1 *IF,sigsum(i),GT,4*dstres(i),THEN *set,design(i),0 *enddo *vwrite,nodnum(1),sigsum(1),design(1) (f20.4,f20.4,f20.4) !'SIG1: ',sig1(1),'SIG2: ',sig2(1),'SIG3: ',sig3(1),

 Tags ansys, apdl, elastic analysis, fea, macro