Chelsea 发表于 2011-3-13 09:14

ANSYS_结构稳态(静力)分析之经典实例-扳手

本帖最后由 Chelsea 于 2011-3-13 09:15 编辑

/FILNAME,Allen-wrench,1   !   Jobname to use for all subsequent files
/TITLE,Static analysis of an Allen wrench
/UNITS,SI      ! Reminder that the SI system of units is used
/SHOW            ! Specify graphics driver for interactive run; for batch
               ! run plots are written to pm02.grph

               ! Define parameters for future use

EXX=2.07E11      ! Young's modulus (2.07E11 Pa = 30E6 psi)
W_HEX=.01      ! Width of hex across flats (.01m=.39in)
*AFUN,DEG      ! Units for angular parametric functions定义弧度单位
W_FLAT=W_HEX*TAN(30)      ! Width of flat
L_SHANK=.075   ! Length of shank (short end) (.075m=3.0in)
L_HANDLE=.2      ! Length of handle (long end) (.2m=7.9 in)
BENDRAD=.01      ! Bend radius of Allen wrench (.01m=.39 in)
L_ELEM=.0075   ! Element length (.0075 m = .30 in)
NO_D_HEX=2       ! Number of divisions on hex flat
TOL=25E-6      ! Tolerance for selecting nodes (25e-6 m = .001 in)

/PREP7
ET,1,SOLID45   ! 3维实体结构单元;Eight-node brick element
ET,2,PLANE42   ! 2维平面结构;Four-node quadrilateral (for area mesh)
MP,EX,1,EXX      ! Young's modulus for material 1;杨氏模量
MP,PRXY,1,0.3    ! Poisson's ratio for material 1;泊松比

RPOLY,6,W_FLAT   ! Hexagonal area创建规则的多边形

K,7            ! Keypoint at (0,0,0)
K,8,,,-L_SHANK   ! Keypoint at shank-handle intersection
K,9,,L_HANDLE,-L_SHANK    ! Keypoint at end of handle

L,4,1            ! Line through middle of hex shape
L,7,8            ! Line along middle of shank
L,8,9            ! Line along handle
LFILLT,8,9,BENDRAD      ! Line along bend radius between shank and handle! 产生一个倒角圆,并生成三个点

/VIEW,,1,1,1   ! Isometric view in window 1
/ANGLE,,90,XM    ! Rotates model 90 degrees about X! 不用累积的旋转
/TRIAD,ltop
/PNUM,LINE,1   ! Line numbers turned on
LPLOT
               ! Line numbers off
               !
/PNUM,KP,1
KPLOT
L,1,4            ! Hex section is cut into two quadrilaterals
ASBL,1,7,,,KEEP!to satisfy mapped meshing requirements for bricks! 减线从面中
CM,BOTAREA,AREA! Component name BOTAREA for the two areas

                     ! Generate area mesh for later drag

/PNUM,KP,0
LPLOT
LESIZE,1,,,NO_D_HEX    ! Number of divisions along line 1 为线指定网格尺寸
LESIZE,2,,,NO_D_HEX
LESIZE,6,,,NO_D_HEX
TYPE,2               ! PLANE42 elements to be meshed first
MSHAPE,0,2D            ! Mapped quad mesh 指定单元要划分的形状和维数
MSHKEY,1               ! 指定了映射网格划分
SAVE                   ! Save database before meshing
AMESH,ALL


/TITLE,Meshed hex wrench end to be used in vdrag
EPLOT
                     ! Now drag the 2-D mesh to produce 3-D elements
TYPE,1               ! Type pointer set to SOLID45
ESIZE,L_ELEM         ! Element size
VDRAG,2,3,,,,,8,10,9   ! Drag operation to create 3-D mesh面掠生成体

/TYPE,,HIDP            ! Precise hidden line display显示要求是精确
/TITLE,Meshed hex wrench
EPLOT

CMSEL,,BOTAREA         ! Select BOTAREA component and! 选择一个子集
ACLEAR,ALL             !    delete the 2-D elements! 清楚选择单元的几点和单元
ASEL,ALL
                     
FINISH               ! Apply loads and obtain the solution
/SOLU
ANTYPE,STATIC          ! Static analysis (default)

/TITLE,Allen wrench -- Load step 1
                     ! First fix all nodes around bottom of shank
CMSEL,,BOTAREA         ! Bottom areas of shank 选择以前建立的一个单元面积的组合
LSEL,,EXT            ! Exterior lines of those areas 显示线
NSLL,,1                ! Nodes on those lines
D,ALL,ALL            ! Displacement constraints

LSEL,ALL
/PBC,U,,2            ! Displacement symbols turned on 显示位移约束的符号
/TITLE,Boundary conditions on end of wrench
NPLOT

                              !Now apply pressure on handle to represent 100-N (22.5-lb) finger force
ASEL,,LOC,Y,BENDRAD,L_HANDLE    ! Areas on handle
ASEL,R,LOC,X,W_FLAT/2,W_FLAT    ! Two areas on one side of handle...
NSLA,,1                         !...and all corresponding nodes
NSEL,R,LOC,Y,L_HANDLE+TOL,L_HANDLE-(3.0*L_ELEM)-TOL   ! Reselects nodes at位置
                              ! back end of handle (3 element lengths)
*GET,MINYVAL,NODE,,MNLOC,Y      ! Get minimum Y value of selected nodes预处理中的结点项;问题是得到一个什么样的值,结点的什么?
*GET,MAXYVAL,NODE,,MXLOC,Y      ! Get maximum Y value of selected nodes是中心位置的值吗?
PTORQ=100/(W_HEX*(MAXYVAL-MINYVAL))   ! Pressure equivalent to 100 N
SF,ALL,PRES,PTORQ               ! PTORQ pressure on all selected nodes 指定节点上的表面力的载荷

ALLSEL                        ! Restores full set of all entities
/PSF,PRES,,2                  ! Pressure symbols turned on 以箭头显示载荷
/TITLE,Boundary conditions on wrench for load step 1
NPLOT
LSWRITE                         ! Writes first load step



/TITLE, Allen wrench -- load step 2
                              ! Downward pressure on top of handle, representing 20-N (4.5 -lb) force
PDOWN=20/(W_FLAT*(MAXYVAL-MINYVAL))

ASEL,,LOC,Z,-(L_SHANK+(W_HEX/2))   ! Area on top flat of handle...
NSLA,,1                            !...and all corresponding nodes
NSEL,R,LOC,Y,L_HANDLE+TOL,L_HANDLE-(3.0*L_ELEM)-TOL   ! Reselects nodes at
                              ! back end of handle (3 element lengths)
SF,ALL,PRES,PDOWN               ! PDOWN pressure at all selected nodes
ALLSEL
/TITLE,Boundary conditions on wrench for load step 2
NPLOT
LSWRITE                         ! Writes second load step

SAVE                            ! Save database before solution
LSSOLVE,1,2                     ! Initiates solution for load step files 1 and 2

                        !Review the results
FINISH
/POST1
SET,1                   ! Reads load step 1 results
PRRSOL                  ! Reaction solution listing
/PBC,DEFA               ! No BC symbols重新安排规格说明
/PSF,DEFA               ! No surface load symbols 重新安排载荷的显示
/EDGE,,1                ! Edges only, no interior element outlines 只显示边缘单元的显示
/TITLE,Deformed allen wrench caused by torque
PLDISP,2                ! Deformed shape overlaid with undeformed edge plot 显示结构转移

/GSAVE,pldisp,gsav      ! Saves graphics specifications on pldisp.gsav 保存为此图形文件,稍后再用

/PLOPTS,INFO,ON         ! Turns on entire legend column 打开边框形式;开启全部的图形圆柱
/PLOPTS,LEG1,OFF      ! Turns off legend header 关闭图形轮廓线的标题(头部)
/ANGLE,,120,YM,1      ! Additional rotation about model Y (to see high stress areas)
/TITLE,Stress intensity contours caused by torque
PLNSOL,S,INT            ! Stress intensity(应力强度) contours 组元应力

/GSAVE,plnsol,gsav      ! Saves graphics specifications to plnsol.gsav


SET,2                   ! Reads load step 2 results
PRRSOL                  ! Reaction solution listing

/GRESUME,pldisp,gsav    ! 恢复pldisp文件;Resumes graphics specifications from pldisp.gsav
/TITLE,Deformed allen wrench caused by torque and force
PLDISP,2

/GRESUME,plnsol,gsav    ! Resumes graphics specifications from plnsol.gsav

/TITLE,Stress intensity contours caused by torque and force
PLNSOL,S,INT

WPOF,,,-0.067         ! 把工作平面在Z方向偏移,达到后面要的截面的位置Offset the working plane for cross-section view从Z轴方向偏移工作平面
/TYPE,1,5               ! Capped hidden display 显示剖面
/CPLANE,1               ! 以共工作平面来剪切截面 Cutting plane defined to use the WP 把平面切开

/VIEW, 1 ,WP            ! View will be normal to the WP正切于当前的工作平面
/DIST,1,.01             ! Zoom in on the cross section 指定详细的扩大倍数进行查看

/TITLE,Cross section of the allen wrench under torque and force loading
PLNSOL,S,INT








! ***********************************GUI操作后的一些log文件命令流的解释说明 ***********************************

/BATCH
/COM,ANSYS RELEASE 11.0SP1 UP20070830       15:05:16    02/20/2009
/TITLE,Static Analysis of an Allen Wrench   
*AFUN,DEG   
*SET,EXX,       2.07E11
*SET,W_HEX,   .01
*SET,W_FLAT,    W_HEX*TAN(30)   
*SET,L_SHANK,   .075   
*SET,L_HANDLE,.2   
*SET,L_ELEM,    .0075   
*SET,NO_D_HEX,2
*SET,TOL,       25E-6
*SET,BENDRAD,   .01

/PREP7

ET,1,SOLID45
ET,2,PLANE42


MPTEMP,,,,,,,,
MPTEMP,1,0
MPDATA,EX,1,,EXX             ! 与温度相对应的材料属性
MPDATA,PRXY,1,,0.3

RPOLY,6,W_FLAT,            ! 创建规则的多边形

K,7,,,,
K,8,,,-L_SHANK,
K,9,,L_HANDLE,-L_SHANK,

!*
/VIEW, 1 ,1,1,1
/ANG, 1
/REP,FAST   
!*
/ANGLE,1,90,XS,0         ! 不用累积的旋转

LSTR,       4,       1   ! 两点定义一条直线
LSTR,       7,       8
LSTR,       8,       9
LFILLT,8,9,BENDRAD, ,   ! 产生一个倒角圆,并生成三个点
SAVE

APLOT   
FLST,2,1,5,ORDE,1   
FITEM,2,1   
LPLOT   

FLST,3,1,4,ORDE,1   
FITEM,3,7   
ASBL,P51X,P51X, , ,KEEP          ! 减线从面中
CM,BOTAREA,AREA                  ! 创建一个面的组合
FLST,5,3,4,ORDE,3   
FITEM,5,1   
FITEM,5,-2
FITEM,5,6   
CM,_Y,LINE
LSEL, , , ,P51X
CM,_Y1,LINE
CMSEL,,_Y   

LESIZE,_Y1, , ,NO_D_HEX, , , , ,1   

TYPE,   2   
MAT,       1
REAL,   
ESYS,       0   
SECNUM,
TSHAP,LINE
!*
MOPT,AMESH,DEFA
MOPT,QMESH,DEFA
MOPT,VMESH,DEFA
MOPT,TIMP,1
MOPT,PYRA,ON
MOPT,AORD,0
MOPT,SPLIT,1
MSHKEY,1
MSHMID,0
MSHPATTERN,0
KEYW,ACCEPT,0   
!*
MSHAPE,0,2D
MSHAPE,0,3D
!*
SAVE
FLST,5,2,5,ORDE,2   
FITEM,5,2   
FITEM,5,-3
CM,_Y,AREA
ASEL, , , ,P51X
CM,_Y1,AREA
CHKMSH,'AREA'   
CMSEL,S,_Y
!*
AMESH,_Y1   
!*
CMDELE,_Y   
CMDELE,_Y1
CMDELE,_Y2
!*

EPLOT   
TYPE,   1   
MAT,       1
REAL,   
ESYS,       0   
SECNUM,
TSHAP,LINE
!*
ESIZE,L_ELEM,0,   ! 指定线的份数

LPLOT   
FLST,2,2,5,ORDE,2   
FITEM,2,2   
FITEM,2,-3
FLST,8,2,4
FITEM,8,8   
FITEM,8,10
VDRAG,P51X, , , , , ,P51X   
/AUTO,1
/REP,FAST   
EPLOT   
SAVE
CMSEL,S,BOTAREA         ! 选择一个子集
FLST,2,2,5,ORDE,2   
FITEM,2,2   
FITEM,2,-3
ACLEAR,P51X               ! 清楚选择单元的几点和单元
ALLSEL,ALL
EPLOT   
CMSEL,S,BOTAREA
LSEL,S,EXT
NSLL,S,1
FINISH


FLST,2,18,1,ORDE,4
FITEM,2,1   
FITEM,2,-10
FITEM,2,17
FITEM,2,-24
/solu

D,P51X, , , , , ,ALL, , , , ,   
LSEL,ALL



ASEL,S,LOC,Y,BENDRAD,L_HANDLE   
ASEL,R,LOC,X,W_FLAT/2,W_FLAT
NSLA,S,1
NSEL,R,LOC,Y,L_HANDLE+TOL,L_HANDLE-(3.0*L_ELEM)-TOL
!*
*GET,minyval,NODE,,MNLOC,Y, , , ,   

*GET,maxyval,NODE,,MXLOC,X, , ,,   

*SET,PTORQ,100/(W_HEX*(MAXYVAL-MINYVAL))
ALLSEL,ALL
FLST,2,364,1,ORDE,2
FITEM,2,1   
FITEM,2,-364

SF,P51X,PRES,PTORQ
ALLSEL,ALL
NPLOT   
SAVE
LSWRITE,1,

*SET,PDOWN,20/(W_FLAT*(MAXYVAL-MINYVAL))

ASEL,S,LOC,Z,-(L_SHANK+(W_HEX/2))   
NSLA,S,1
NSEL,R,LOC,Y,L_HANDLE+TOL,L_HANDLE-(3.0*L_ELEM)-TOL
ALLSEL,ALL
FLST,2,364,1,ORDE,2
FITEM,2,1   
FITEM,2,-364

SF,P51X,PRES,PDOWN
ALLSEL,ALL
NPLOT   
LSWRITE,2,
SAVE
LSSOLVE,1,2,1,
FINISH
/POST1
SET,FIRST   
PRRSOL,


/PBC,ALL, ,0
/REP

/EDGE,1,1,45
/GLINE,1,0

PLDISP,1
/GSAVE,'pldisp','gsa',' '   
!*
/ANGLE,1,120,YM,1   
/REPLOT

/EFACET,1   
PLNSOL, S,INT, 0,1.0
/GSAVE,'plnsol','gsa',' '   

SET,NEXT
PRRSOL,
/GRESUME,'pldisp','gsa',' '
PLDISP,1
/GRESUME,'plnsol','gsa',' '
!*
/EFACET,1   
PLNSOL, S,INT, 0,1.0
wprot,0,0,-0.067
/GRAPHICS,POWER
!*
/TYPE,1,5   
/CPLANE,1   
/SHADE,1,1
/HBC,1,0
/REPLOT
!*
/VIEW, 1 ,WP
/REP,FAST   
/REPLOT,RESIZE
/VIEW,1,1,2,3   
/ANG,1
/REP,FAST   
FINISH
! /EXIT,NOSAV

July750 发表于 2013-8-31 15:29

很好的例子,就是没有注释,看起来有点费劲
页: [1]
查看完整版本: ANSYS_结构稳态(静力)分析之经典实例-扳手