 ## Materials

Topics relate to Granta Design and more

• Maralll
Subscriber

Hello All,

My model is a 2d hollow semisphere. By writing an apdl code in ansys workbench, I defined the elastic modulus changes radially along the thickness of the hemisphere. Now I need to write a code to show me the contour of varaiation of elastic modulus along the thickness in my model. I would aprreciate any help!

Thank You,

Maral

• Ashish Kumar
Forum Moderator

Hi,

Please see if the following link helps: variation of young modulus with the change in density of material? (ansys.com)

Regards,

Ashish Kumar

• Maralll
Subscriber

I'm afraid this link doesn't help because I already applied the variable elastic modulus along the thickness through an APDL command in Ansys WB and I was able to get the results. However, I don't know how to PLOT the contour of variable elastic modulus on the body. When I use Material Plot, it showed me the default material properties (constant elastic modulus) instead of the variable elastic modulus. The code which is written under material, deletes the default material and assigns the variable elastic modulus to the elements (the valuse of elastic modulus varies radially). I need to see the contour plot of the values of the variable elastic modulus on the model.

I would appreciate any help.

Regards,

Maral

• Dave Looman
Ansys Employee

There's no direct way.  Two generic examples of an indirect way are below.

Method 1:

/post1

*get,ecount,elem,,count

emin=0

*do,iii,1,ecount,1

emin=elnext(emin)

!!! retrieve numerical value of EX for element emin as exval

detab,emin,EX_,exval

*enddo

pletab,EX_

2nd method based on temp-dep EX:

!
set,last
!
*get,ecnt,elem,,count
*get,emax,elem,,num,max
*del,emmm,,nopr
*dim,emmm,'ARRAY',emax
etab,etemp,'BFE','TEMP'
ei=0
*do,i,1,ecnt
ei=elnext(ei)
*get,emno,'ELEM',ei,'ATTR','MAT'
*get,itemp,'ELEM',ei,'ETAB',etemp
*get,emmm(ei),'EX',emno,'TEMP',itemp
*enddo
*vput,emmm(1),'ELEM',1,'ETAB',etemp
eplot
/VIEW,1,1,1,1
/ANG,1
/auto,1
!
/SHOW,PNG,,0
/GFILE,1200,
Plet,etemp
/SHOW,CLOSE

• Maralll
Subscriber

Dear Dave,

Thank you for sending me this code.

I tried to apply the second method under solution but the result that I got is a contour plot of   variable elastic modulus which the maximum in the outer layer with the value which is obtained from the default value of the elastic modulus (that I had to defined in engineering data). However, I had added the command macro under the geometry to overwrite the default material data and the solution were done based on those new values of material data ( the elastic modulus as a function of radius(. So, I need to show those values of overrided elastic modulus on a contour plot-The values are changing from 0.02 to 0.25 MPa. How can I modify your code to make ansys to get the new material data not the default one? I would appreciate if you could help.

And, here is the code that solve the problem with the elastic modulus as a linear function of radius.

MPDELE, elastic,all

TBDELE,elastic,all

csys,1

esel, all

cm,remainingelem,elem

matid=1

*Do,ee,1,100000

*get,nextElem,ELEM,0,nxth

*get,elemxposition,ELEM,nextElem,cent,x

esel,r,cent,x,elemxposition

cm,elementXgroup,elem

*SET,x_pos,elemxposition

E_X=0.46*x_pos-2.74

Tb,elastic,matid,,2,Isot

Tbdata,1,E_X,0.49

MPCHG,matID,all

*get,count_control,elem,,count

cmsel,s,remainingelem

cmsel,u,elementXgroup

cm,remainingelem,elem

*get,Element_count,elem,,count

*if,element_count,eq,count_control,exit

matid=matid+1

*enddo

matid=matid+1

*get,nextElem,ELEM,0,nxth

*get,elemxposition,ELEM,nextElem,cent,x

esel,r,cent,x,elemxposition

cm,elementXgroup,elem

*SET,x_pos,elemxposition

E_X=0.46*x_pos-2.74

Tb,elastic,matid,,2,Isot

Tbdata,1,E_X,0.49

MPCHG,matID,all

esel,all 