You are on page 1of 8

!

Stripe 2"X10", Width=2", length=10", Material elasetic Aluminum (Young's Modulus


2.8 Gpa, ), a 1/4 inch hole in middle
! 3D model, with mapped mesh--------------------------------------------------

/CLE ! Clear all the data in the work environment


/units,si ! Set the unit systm to SI
/PREP7
/UIS, MSGPOP, 3 ! prevent the warning messages

! set the background color---------------------------------------------


/RGB,INDEX,100,100,100, 0
/RGB,INDEX, 80, 80, 80,13
/RGB,INDEX, 60, 60, 60,14
/RGB,INDEX, 0, 0, 0,15
/REPLOT

! Define the element type and


thickness----------------------------------------------------
T=0.25*25.4E-3 ! DEFINE THE THICKNESS OF THE PLATE
ET,1,SOLID185 ! Solid 185 8 node brick element
ET,2,MESH200,6 ! dummy element type for area mesh
AATT,,,2 ! set area attributes for element type

! Define the material


properties-----------------------------------------------------------
Finish
/PREP7
rho=2700 ! Density of material, Aluminum 6061-T6
E=7.5e10 ! Young's Modulus, Aluminum 69-71Gpa
nu=0.33 ! Poisson's ratio for Aluminum, the nu changes once
plastic
fy=3.0 e8 ! Yield stress, 250-280Mpa, need to be updated
Et=5e8 ! Tangent modulus, 0.5Gpa, plastic part

! Nonlinear part------------------------------------------------------
MP,DENS,1,rho ! Density
MP,EX,1,E ! Young's modulus
MP,NUXY,1,nu ! Poisson ratio
TB,BISO,1 ! Bilinear isotropic hardening plasticity
TBDAT,1,fy ! Define the yielding stress
TBDAT,2,Et ! Define the plastic modulus

!
Modeling---------------------------------------------------------------------------
---
L=10*2.54e-2 ! Total length of the Stripe, 10 inch excluding the gripping
area
W=2*2.54e-2 ! Width of the Stripe, 2 inch width
L1=40e-3 ! Smart skin coverd area, in X axis
W1=40e-3 ! width along Y axis
DIA_HOLE=1/4*2.54e-2 ! Diamater of the hole, 1/4 inch
R0=DIA_HOLE/2
R1=10e-3

! Define the element


size-------------------------------------------------------------------------------
-------------------
N_circmesh=8 ! number for the circle meshing, 8
for 1/4 circle, 3.14*3/8*25.4mm /4 N=0.9346mm
CYL4,0, 0, DIA_HOLE/2 ! Create circle Area IN MIDDLE,
Area 1, the numbers of Kpoints and Lines are shown in Figure
BLC4,0,0,L/2,W/2 ! Create A block with width=W/2,
length=L/2, Area 2
ASBA,2,1,,DELETE,DELETE ! subtract area the hole (area1)
from area 2, Delete area2 and delete area1, becoming area 3

/PNUM,KP,1 ! show the keypoint number


/PNUM,LINE,1 ! show line number
/PNUM,AREA,1 ! show area number
/REPLOT
/image,save,'Number',bmp

ASEL,ALL ! Select all areas

! Define the mesh/element


size---------------------------------------------------------
h1=0.4E-3 ! element size, 0.4mm, for the hole
h2=0.8E-3 ! element size within the measuring area,
h3=1.6E-3 ! global element size

! Mesh control, control the nubmers of mesh on each


line-------------------------------------------------------------------------
CSYS,1 ! Activates a previously defined coordinate system, 0
(Cartesian), 1 (cylindrical), 2 (spherical)
K,50,R1 ! create a circle that has a radius of
K,51,R1,90 ! 90 degree, COUNTERCLOCK WISE
L,50, 51 ! create a curve line, LINE 2
ASBL,ALL,2 ! (ASBL, NA, NL, , KEEPA, KEEPL) Subtracts lines from
areas, If ALL, use all selected areas, subtract line 1, the newly created curved
line; create two areas; the smaller is Area1, the rest big part is area 2

CSYS,0
K,52,L1/2,0
K,53,0,W1/2
K,54,L1/2,W1/2
L,52,54 ! create vertical line L9
L,53,54 ! create horizontal line L10
ASEL,All ! select all the area Area, otherwise some areas will be
missing
LSEL,S,line,,9,10
ASBL,All,all ! subtract the rectange from big area, the circular Area1,
inner square Area3, the left bigger Area 4

K,55,W/2,0 ! CREATE A BLOCK


!K,56,0,W/2
K,56,W/2,W/2
L,55,56 ! Line L5
ASEL,all
ASBL,ALL,5

!
Meshing----------------------------------------------------------------------------
-
MSHAPE,0,2D ! mesh with hexahedral-shaped elements
MSHKEY,1 ! MAPPED MESH
LSEL,ALL ! SELECT ALL THE LINES

LESIZE,1,,,30 ! Find the inner small curved line L1, and mesh with 20
segments, h=0.25mm
LESIZE,2,,,30 ! Find the outer larger curved line, and mesh with 20
segments, h=0.75mm
LESIZE,3,,,15,2 ! LESIZE, NL1, SIZE, ANGSIZ, NDIV, SPACE. Spacing ratio. If
positive, nominal ratio of last division size to first division size
LESIZE,4,,,15,2 ! increasing size, from smaller node number to bigger node
number, avg h=0.5 mm
AMESH,1

LESIZE,11,,,10,1.5 ! FROM 0.75mm to 2mm


LESIZE,12,,,10,1.5
LESIZE,9,,,15,1.5 ! From 1mm to 2mm
LESIZE,10,,,15,1.5
AMAP,3,50,52,51,53

LESIZE,5,,,15,1.5
LESIZE,16,,,15,1.5
LESIZE,14,,,3,1/1.5
LESIZE,17,,,3,1.5
MSHKEY,0 ! Free mesh
AMESH,5

LESIZE,15,,,40,0.5
LESIZE,8,,,40,0.5
LESIZE,6,,,8
MSHKEY,0
AMESH,2

ARSYM,X,ALL ! Generates areas from an area pattern by symmetry reflection, this


is only suitable for generating a quarter of the model
ARSYM,Y,ALL
NUMMRG,ALL ! Merges coincident or equivalently defined items

EXTOPT,ON
TYPE,1 ! change element type to 3-D
EXTOPT,ESIZE,4 ! set element size along thickness direction
VEXT, All, , , , , T ! assuming the volume thickness is 'dz' in Z-direction
! BOUNDARY CONDITION------------------------------------------------------------
ASEL,S,loc,x,-L/2 ! Select the LINE ON THE BOUNDARY
NSLA,S,1 ! Select the nodes on the lines
D,ALL,ALL ! constrain selected nodes in x and y
direction (pin), fix end

! Coupling nodes-------------------------------------------------------------
ASEL,S,loc,x,L/2 ! Select the LINE ON THE BOUNDARY, line number 10
NSLA,S,1 ! Select the nodes on the lines
CM,LOAD_NODE,NODE ! Group nodes into a component
CP,1,ALL,ALL ! Reference No=1, couple the x y direction
ASEL,S,loc,x,L/2 ! Select the LINE ON THE BOUNDARY
NSLA,S,1 ! Select the nodes on the area
*get,N_Load,NODE,,count ! Get total number of selected nodes,node is a
set of selected nodes

!SAVE,MGEOM,DB ! Save the geometry file MGEOM.db including all the


parameters
! plot the FEM model------------------------------------------------------------
ALLSEL,ALL ! select everything

ESEL,S,CENT,X, -L1/2,L1/2 ! Select the elements on the smart skin


ESEL,R,CENT,Y, -W1/2,W1/2
/repolot
/image,save,model_detail,bmp ! save image

! Define the material type------------------------------------------------------


ALLSEL,ALL
TYPE,1
MAT,1

! Add load-----------------------------------------------------------------
Finish
/SOLUTION
ANTYPE,0 ! Static Analysis
NLGEOM,ON ! Includes large deformation effects in a static or full
transient analysis.
outres,all,all ! Save all the results from the substeps
EQSLV,PCG ! Preconditioned Conjugate Gradient (PCG) solver has been
added as an alternate to the default frontal solver. The PCG solver requires less
file space but more memory than other solvers and is faster for larger
! models(wavefronts > 1000). PCG is well-suited for problems with very large,
sparse, symmetric matrices, such as those encountered in magnetic field analysis.
SOLCONTROL,On ! Specifies whether to use optimized nonlinear solution
defaults and some enhanced internal solution algorithms, on is default
NSUBST,100,4000,50 ! Define the 100 substeps
NEQIT,1000 ! Equilibrim iterations, maximum number of iterations

Force1=16000*4.44822 ! 16,000lbf
Force2=18000*4.44822 ! 18,000lbf

*DIM,LOAD,TABLE,8
LOAD(1)=Force1/N_load,Force1/N_load,0,0,Force2/N_load,Force2/N_load,0,0
LOAD(1,0)=1,2,3,4,5,6,7,8 ! Time step, the index of the
load
!Then use a do-loop to apply the load and solve it:

*DIM,Timev,TABLE,8
Timev(1)=0.2037,0.2344,0.4353,0.4947,0.7263,0.7570,0.9821,1
Timev(1,0)=1,2,3,4,5,6,7,8 ! Time step, the index of the
load

*DO,I,1,8,1
Time,TIMEV(I) ! For static load, time is ignored, step number integer
!NSEL,NONE
ASEL,S,loc,x,L/2 ! Select the area ON THE BOUNDARY
NSlA,S,1 ! Select the nodes on the area
F,ALL,FX,LOAD(I) ! The load can replace previous load
ALLSEL,All ! Select all the elements and all the nodes
SOLVE
*ENDDO

! Read the result


file------------------------------------------------------------------------------
Finish
/post1
set,last ! set the last step

esel,all
NSEL,NONE
NSEL, S, LOC, X, -L1/2, L1/2
NSEL, R, LOC, Y, -W1/2, W1/2
NSEL, R, LOC, Z, T ! correct, select the nodes on smart skin
NSLE,R,CORNER ! avoid midside node elements

Cm, temponode, node !save the selected nodes to a component


Cm, tempoelem, elem !save the selected elements to a component

Cmsel, s, temponode ! select the nodes


Esel, all
Nsle, r, CORNER !re-selects from selected nodes only those
which are "corner nodes"
*get, nummax, NODE,,num, max !Max Node id in selected nodes
*get, numnode, NODE,,count !Number of selected nodes
*dim, mask, array, nummax
*vget, mask(1), NODE,,NSEL !mask for selected nodes
*dim, strn_full, array, nummax, 19 !array for strains of all 1-to-nummax nodes
*dim, strn_comp, array, numnode, 19 !array for strains of ONLY selected nodes
*dim, nodeid_full, array, nummax !array for containing NODE ID
*dim, nodeid_comp, array, numnode !array for containing NODE ID for ONLY selected
nodes
*vfill, nodeid_full, ramp, 1, 1 !array from 1-to-nummnode
(1,2,3,....),node id

!Retrieving DATA
*vmask, mask(1)
*vget, strn_full(1,1),NODE,1,LOC,X
*vmask, mask(1)
*vget, strn_full(1,2),NODE,1,LOC,Y
*vmask, mask(1)
*vget, strn_full(1,3),NODE,1,LOC,Z
*vmask, mask(1)
*vget, strn_full(1,4),NODE,1,EPEL,X ! Fill 4th column with X-strain,
elastic x-strain
*vmask, mask(1)
*vget, strn_full(1,5),NODE,1,EPEL,Y ! Fill 5th column with Y-strain, elastic
y-strain
*vmask, mask(1)
*vget, strn_full(1,6),NODE,1,EPEL,EQV ! Fill 6th column with von Mises
elastic strain
*vmask, mask(1)
*vget, strn_full(1,7),NODE,1,EPPL,X ! Fill 7th column with X-strain,
plastic x-strain
*vmask, mask(1)
*vget, strn_full(1,8),NODE,1,EPPL,Y ! Fill 8th column with Y-strain, plastic
y-strain
*vmask, mask(1)
*vget, strn_full(1,9),NODE,1,EPPL,EQV ! Fill 9th column with von Mises
plastic strain
*vmask, mask(1)
*vget, strn_full(1,10),NODE,1,EPTO,X ! Fill 10th column with X-strain,
total x-strain
*vmask, mask(1)
*vget, strn_full(1,11),NODE,1,EPTO,Y ! Fill 11th column with Y-strain,
total y-strain
*vmask, mask(1)
*vget, strn_full(1,12),NODE,1,EPTO,EQV ! Fill 12th column with von
Mises total strain
*vmask, mask(1)
*vget, strn_full(1,13),NODE,1,EPEL,INT ! 13 Elastic strain
intensity
*vmask, mask(1)
*vget, strn_full(1,14),NODE,1,EPPL,INT ! 14 plastic strain
intensity
*vmask, mask(1)
*vget, strn_full(1,15),NODE,1,EPTO,INT !15 total strain
intensity
*vmask, mask(1)
*vget, strn_full(1,16),NODE,1,S,INT ! 16 Stress intensity
*vmask, mask(1)
*vget, strn_full(1,17),NODE,1,S,EQV ! 17 von Mises stress
*vmask, mask(1)
*vget, strn_full(1,18),NODE,1,NL,SEPL ! 18 plastic
equivalent stress
*vmask, mask(1)
*vget, strn_full(1,19),NODE,1,NL,SRAT ! 19 stress
state ratio

!COMPRESSING ARRAYS TO ONLY SELECTED NODES:


*vmask, mask(1)
*vfun, strn_comp(1,1), COMP, strn_full(1,1)
*vmask, mask(1)
*vfun, strn_comp(1,2), COMP, strn_full(1,2)
*vmask, mask(1)
*vfun, strn_comp(1,3), COMP, strn_full(1,3)
*vmask, mask(1)
*vfun, strn_comp(1,4), COMP, strn_full(1,4)
*vmask, mask(1)
*vfun, strn_comp(1,5), COMP, strn_full(1,5)
*vmask, mask(1)
*vfun, strn_comp(1,6), COMP, strn_full(1,6)
*vmask, mask(1)
*vfun, strn_comp(1,7), COMP, strn_full(1,7)
*vmask, mask(1)
*vfun, strn_comp(1,8), COMP, strn_full(1,8)
*vmask, mask(1)
*vfun, strn_comp(1,9), COMP, strn_full(1,9)
*vmask, mask(1)
*vfun, strn_comp(1,10), COMP, strn_full(1,10)
*vmask, mask(1)
*vfun, strn_comp(1,11), COMP, strn_full(1,11)
*vmask, mask(1)
*vfun, strn_comp(1,12), COMP, strn_full(1,12)
*vmask, mask(1)
*vfun, strn_comp(1,13), COMP, strn_full(1,13)
*vmask, mask(1)
*vfun, strn_comp(1,14), COMP, strn_full(1,14)
*vmask, mask(1)
*vfun, strn_comp(1,15), COMP, strn_full(1,15)
*vmask, mask(1)
*vfun, strn_comp(1,16), COMP, strn_full(1,16)
*vmask, mask(1)
*vfun, strn_comp(1,17), COMP, strn_full(1,17)
*vmask, mask(1)
*vfun, strn_comp(1,18), COMP, strn_full(1,18)
*vmask, mask(1)
*vfun, strn_comp(1,19), COMP, strn_full(1,19)

!GETTING THE SELECTED NODE ID LIST


*vmask, mask(1)
*vfun, nodeid_comp(1), COMP, nodeid_full(1)

!WRITING TO A FILE:
*cfopen,'Final_strain',txt
*vwrite ! Writes a column header
('Node',4x,'X-LOC',4x,'Y-LOC',4x,'Z-LOC',4x,'X-EStrain',4x,'Y-EStrain',4x,'von-
EStrain',4x,'X-PStrain',4x,'Y-PStrain',4x,'von-PStrain',4x,'X-TStrain',4x,'Y-
TStrain',4x,'von-TStrain')
*vwrite, nodeid_comp(1), strn_comp(1,1), strn_comp(1,2), strn_comp(1,3)
,strn_comp(1,4), strn_comp(1,5), strn_comp(1,6) ,strn_comp(1,7), strn_comp(1,8),
strn_comp(1,9) ,strn_comp(1,10), strn_comp(1,11), strn_comp(1,12)
(F7.0,2X,E12.4,2X,E12.4,2X,E12.4,2X,E12.4,2X,E12.4,2X,E12.4,2X,E12.4,2X,E12.4,2X,E1
2.4,2X,E12.4,2X,E12.4,2X,E12.4)
*cfclos
!*uilist, Final_strain, txt !displays the file on screen

*cfopen,'Final_intensity',txt
*vwrite ! Writes a column header
('Node',4x,'X-LOC',4x,'Y-LOC',4x,'Z-LOC',4x,'E-StrainInt',4x,'P-StrainInt',4x,'T-
StrainInt',4x,'StressInt',4x,'von-Stress',4x,'P-EqStress',4x,'StressStateRatio')
*vwrite, nodeid_comp(1), strn_comp(1,1), strn_comp(1,2), strn_comp(1,3)
,strn_comp(1,13), strn_comp(1,14), strn_comp(1,15) ,strn_comp(1,16),
strn_comp(1,17), strn_comp(1,18) ,strn_comp(1,19)
(F7.0,2X,E12.4,2X,E12.4,2X,E12.4,2X,E12.4,2X,E12.4,2X,E12.4,2X,E12.4,2X,E12.4,2X,E1
2.4,2X,E12.4)
*cfclos
!*uilist, Final_intensity, txt !displays the file on screen

Cmsel, s, tempoelem
Cmsel, a, temponode

!DELETING USED VARIABLES


Cmdele, tempoelem
Cmdele, temponode
*del, pres_full, nopr
*del, nodeid_full, nopr
*del, mask, nopr
*del, nummax, nopr
*del, numnode, nopr

! save the time history of the gages


! time history analysis--------------------------------------
/post26
! select the node near the strain gages-----------
NSEL,ALL
gage1_nod=node(0,10e-3,T) ! First position of the 1st gage (0,10), gage 1
and gage 2 are symmetric
NSEL,NONE
NSEL,S,NODE,,gage1_nod
ESLN ! Select all elements attached to selected nodes
*get,n_1,elem,0,NUM,MIN ! get min elem number
gage1_ele=n_1 !
NSEL,ALL
gage3_nod=node(10e-3,0,T) ! First position of the 3rd and 4th gage (10,0)
NSEL,NONE
NSEL,S,NODE,,gage3_nod
ESLN ! Select all elements attached to selected nodes
*get,n_3,elem,0,NUM,MIN ! get min elem number
gage3_ele=n_3 !

! EPTO Total Strain, EPPL Plastic Strain, EPEL Elastic Strain---------------------


Allsel,all ! Select everything
ESOL,2,gage1_ele,gage1_nod,EPPL,X ! x plastic strain at strain gage 1
ESOL,3,gage1_ele,gage1_nod,EPEL,X ! x elastic strain
ESOL,4,gage3_ele,gage3_nod,EPPL,X ! x plastic strain at strain gage 2
ESOL,5,gage3_ele,gage3_nod,EPEL,X ! x elastic strain
ESOL,6,gage3_ele,gage3_nod,EPPL,y ! x plastic strain at strain gage 4
ESOL,7,gage3_ele,gage3_nod,EPEL,y ! x elastic strain

*dim,strnoutput,array,1000,7 ! set a array

vget,strnoutput(1,1),1 ! put time in array, shoud use vget rather than *vget
in /post26
vget,strnoutput(1,2),2 ! put x plastic strain in array at strain gage 1
vget,strnoutput(1,3),3 ! put x elastic strain in array
vget,strnoutput(1,4),4 ! put x plastic strain in array at strain gage 3
vget,strnoutput(1,5),5 ! put x elastic strain in array
vget,strnoutput(1,6),6 ! put x plastic strain in array at strain gage 4
vget,strnoutput(1,7),7 ! put x elastic strain in array

*cfopen,'StrHistory',txt
*vwrite ! Writes a column header
('Time',4x,'G1-xPL',4x,'G1-xEL',4x,'G3-xPL',4x,'G3-xEL'4x,'G4-yPL',4x,'G4-yEL')
*vwrite,strnoutput(1,1),strnoutput(1,2),strnoutput(1,3),strnoutput(1,4),strnoutput(
1,5),strnoutput(1,6),strnoutput(1,7)
(E12.4,2X,E12.4,2X,E12.4,2X,E12.4,2X,E12.4,2X,E12.4,2X,E12.4)
! Format with decimal and scientific
*cfclos
FINISH

You might also like