Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bilinear macro

Status
Not open for further replies.

Fortes393

Mechanical
Joined
May 18, 2016
Messages
2
Location
BR
Hi, everyone. I am working with a small boat model made of a sandwich structure. The boat is made of 3 composite materials and wood. I know that there is a macro in ansys to make the composites behave in a different way when they are under tensile or compressive loads. But my doubt is: how to make the macro work only for a single composite material? I am using the static structural

The macro is:

! Commands inserted into this file will be executed just prior to the ANSYS SOLVE command.
! These commands may supersede command settings set by Workbench.

/prep7
MP,DENS,1,2000, ! tonne mm^-3
MP,EX,1,3.3e09, ! tonne s^-2 mm^-1
MP,PRXY,1,0.39,

MP,DENS,2,2000, ! tonne mm^-3
MP,EX,2,1.7e09, ! tonne s^-2 mm^-1
MP,PRXY,2,0.39,

/solu
time,1.0
!finish
/solve
solve
finish
!bilinear
FINISH
! ***** BILINEAR MATERIAL EVALUATION MACRO *****
! MATERIAL 1 is the tension properties
! MATERIAL 2 is the compression properties
! ARG1 is the number of iterations (2 default)
! Macro is run after a static solution

/NOP
_niter = arg1 ! set number of iterations
*if,_niter,lt,2,then
_niter = 2
*endif
*do,_iter,1,_niter ! loop on number of iterations
/post1
set,1,1
!!ar11=elmiqr(0,14) ! get number of elements
esel,s,ename,,187
*get,ar11,elem,0,count
esel,all
*dim,_s1,,ar11 ! array for element s1
*dim,_s3,,ar11 ! array for element s3
etable,sigmax,s,1 ! s1 is in etable sigmax
etable,sigmin,s,3 ! s3 is in etable sigmin
*vget,_s1(1),elem,1,etab,sigmax ! get element maximum stress in s1
*vget,_s3(1),elem,1,etab,sigmin ! get element minimum stress in s3
*dim,_mask,,ar11 ! array for mask vector
*voper,_mask(1),_s1(1),lt,0 ! true if max stress < 0
*vcum,1 ! accumulate compression elements
*vabs,0,1 ! absolute value of s3
*voper,_mask(1),_s3(1),gt,_s1(1) ! true if abs(minstr) > maxstr
finish

/prep7 ! go to prep7 for element material mods
esel,s,ename,,187
mat,1 ! set all materials to tension properties
emod,all


*vput,_mask(1),elem,1,esel ! select compression elements
mat,2
esel,r,ename,,187 ! change selected elements to compression
emod,all

esel,all
!eall ! select all elements
finish

_s1(1)= ! cleanup vectors
_s3(1)=
_mask(1)=

allsel
/solve ! rerun the analysis
solve
finish

*enddo ! end of iterations

_niter= ! cleanup iteration counters
_iter=
/gop
!
!/post1
!plnst,s,x
!eplot
!/PNUM,MAT,1
!eplot
!mat,2
!emod,all
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top