[原创]ansys转adina(结构单元),可按实际情况扩展
!********************************************************************
!*material properties
!********************************************************************
MATNUM=3 !材料种类数目,应根据实际情况修改
*DO,I,1,MATNUM
*GET,MEX,EX, I, TEMP, 0
*GET,MNUXY,NUXY, I, TEMP, 0
*GET,MDENS,DENS, I, TEMP, 0
/OUTPUT,ANOUT,TXT,,APPEND
*VWRITE,I,MEX,MNUXY,MDENS
material elastic name=%3I e=%20.8G nu=%20.8G density=%20.8G
/OUT
*ENDDO
!********************************************************************
!*real const
!********************************************************************
*GET, CONSTNUM, RCON, N, NUM, MAX
*DO,I,1,CONSTNUM
*GET, CONST1, RCON, I, CONST, 1 !AREA
*GET, CONST2, RCON, I, CONST, 2 !IZZ
*GET, CONST3, RCON, I, CONST, 3 !IYY
RIN=CONST2+CONST3
/OUTPUT,ANOUT,TXT,,APPEND
*VWRITE,I,RIN,CONST3,CONST2,CONST1
cross-section properties NAME=%3I RINERTIA=%20.8G SINERTIA=%20.8G TINERTIA=%20.8G AREA=%20.8G
/OUT
*ENDDO
!********************************************************************
!*node coordinate
!********************************************************************
ALLSEL,ALL
*GET, NNUM, NODE, 0, COUNT
*GET, NMIN, NODE, 0, NUM, MIN
*DIM,NODES,ARRAY,NNUM,4
*DO,I,1,NNUM
NODES(I,1)=NMIN
NODES(I,2)=NX(NMIN)
NODES(I,3)=NY(NMIN)
NODES(I,4)=NZ(NMIN)
NMIN=NDNEXT(NMIN)
*ENDDO
/OUTPUT,ANOUT,TXT,,APPEND
*VWRITE,NNUM
*ELNUM=%8I
/COM,*NODE COORDINATES
/COM,coordinates nodes
/COM,entries node x y z
*VWRITE,NODES(1,1),NODES(1,2),NODES(1,3),NODES(1,4)
%8I %20.8G %20.8G %20.8G
/COM
/COM,*END NODE INPUT
/COM,DATAEND
/COM
/OUT
!********************************************************************
!BEAM4
!********************************************************************
ESEL,ALL
ESEL,S,ENAME,,BEAM4
*GET, ELNUM, ELEM, 0, COUNT
*IF,ELNUM,EQ,0,THEN
/OUTPUT,ANOUT,TXT,,APPEND
/COM,*BEAM4
/COM,*ELNUM=0
/OUT
*ELSE
/OUTPUT,ANOUT,TXT,,APPEND
/COM,*BEAM4
*VWRITE,ELNUM
*ELNUM=%8I
/OUT
*Get,ELMIN,ELEM,0,NUM,MIN
*DIM,BEAM_4,ARRAY,1,3
*DO,J,1,ELNUM
*GET,MATNUM,ELEM,ELMIN,ATTR,MAT
*GET,ELSEC,ELEM,ELMIN,ATTR,REAL
GNAME=10+MATNUM
*GET, N1, ELEM, ELMIN, NODE, 1
*GET, N2, ELEM, ELMIN, NODE, 2
BEAM_4(1,1)=ELMIN
BEAM_4(1,2)=N1
BEAM_4(1,3)=N2
ELMIN=Elnext(ELMIN)
/OUTPUT,ANOUT,TXT,,APPEND
/COM
*VWRITE,GNAME,MATNUM
egroup beam name=%3I material=%3I
*VWRITE,GNAME
enodes group=%3I nnodes=2
/COM,entries el aux n1 n2
*VWRITE,BEAM_4(1,1),BEAM_4(1,2),BEAM_4(1,3)
%8I %8I %8I
*VWRITE,GNAME
edata group=%3I
/COM,entries el material section
*VWRITE,BEAM_4(1,1),MATNUM,ELSEC
%8I %8I %8I
/out
*ENDDO
*ENDIF
/OUTPUT,ANOUT,TXT,,APPEND
/COM
/COM,*END BEAM4 INPUT
/COM
/OUT
!********************************************************************
!BEAM44
!********************************************************************
ESEL,ALL
ESEL,S,ENAME,,BEAM44
*GET, ELNUM, ELEM, 0, COUNT
*IF,ELNUM,EQ,0,THEN
/OUTPUT,ANOUT,TXT,,APPEND
/COM,*BEAM44
/COM,*ELNUM=0
/OUT
*ELSE
/OUTPUT,ANOUT,TXT,,APPEND
/COM,*BEAM44
*VWRITE,ELNUM
*ELNUM=%8I
/OUT
*Get,ELMIN,ELEM,0,NUM,MIN
*DIM,BEAM_44,ARRAY,1,3
*DO,J,1,ELNUM
*GET,MATNUM,ELEM,ELMIN,ATTR,MAT
*GET,ELSEC,ELEM,ELMIN,ATTR,REAL
GNAME=20+MATNUM
*GET, N1, ELEM, ELMIN, NODE, 1
*GET, N2, ELEM, ELMIN, NODE, 2
BEAM_44(1,1)=ELMIN
BEAM_44(1,2)=N1
BEAM_44(1,3)=N2
ELMIN=Elnext(ELMIN)
/OUTPUT,ANOUT,TXT,,APPEND
/COM
*VWRITE,GNAME,MATNUM
egroup beam name=%3I material=%3I
*VWRITE,GNAME
enodes group=%3I nnodes=2
/COM,entries el aux n1 n2
*VWRITE,BEAM_44(1,1),BEAM_44(1,2),BEAM_44(1,3)
%8I %8I %8I
*VWRITE,GNAME
edata group=%3I
/COM,entries el material section
*VWRITE,BEAM_44(1,1),MATNUM,ELSEC
%8I %8I %8I
/out
*ENDDO
*ENDIF
/OUTPUT,ANOUT,TXT,,APPEND
/COM
/COM,*END BEAM44 INPUT
/COM
/OUT
!********************************************************************
!BEAM188
!********************************************************************
ESEL,ALL
ESEL,S,ENAME,,BEAM188
*GET, ELNUM, ELEM, 0, COUNT
*IF,ELNUM,EQ,0,THEN
/OUTPUT,ANOUT,TXT,,APPEND
/COM,*BEAM188
/COM,*ELNUM=0
/OUT
*ELSE
/OUTPUT,ANOUT,TXT,,APPEND
/COM,*BEAM188
*VWRITE,ELNUM
*ELNUM=%8I
/OUT
*Get,ELMIN,ELEM,0,NUM,MIN
*DIM,BEAM_188,ARRAY,1,3
*DO,J,1,ELNUM
*GET,MATNUM,ELEM,ELMIN,ATTR,MAT
*GET,ELSEC,ELEM,ELMIN,ATTR,SECN
GNAME=30+MATNUM
*GET, N1, ELEM, ELMIN, NODE, 1
*GET, N2, ELEM, ELMIN, NODE, 2
BEAM_188(1,1)=ELMIN
BEAM_188(1,2)=N1
BEAM_188(1,3)=N2
ELMIN=Elnext(ELMIN)
/OUTPUT,ANOUT,TXT,,APPEND
/COM
*VWRITE,GNAME,MATNUM
egroup beam name=%3I material=%3I
*VWRITE,GNAME
enodes group=%3I nnodes=2
/COM,entries el aux n1 n2
*VWRITE,BEAM_188(1,1),BEAM_188(1,2),BEAM_188(1,3)
%8I %8I %8I
*VWRITE,GNAME
edata group=%3I
/COM,entries el material section
*VWRITE,BEAM_188(1,1),MATNUM,ELSEC
%8I %8I %8I
/out
*ENDDO
*ENDIF
/OUTPUT,ANOUT,TXT,,APPEND
/COM
/COM,*END BEAM188 INPUT
/COM
/OUT
!********************************************************************
!LINK8
!********************************************************************
ESEL,ALL
ESEL,S,ENAME,,LINK8
*GET, ELNUM, ELEM, 0, COUNT
*IF,ELNUM,EQ,0,THEN
/OUTPUT,ANOUT,TXT,,APPEND
/COM,*LINK8
/COM,*ELNUM=0
/OUT
*ELSE
/OUTPUT,ANOUT,TXT,,APPEND
/COM,*LINK8
*VWRITE,ELNUM
*ELNUM=%8I
/OUT
*Get,ELMIN,ELEM,0,NUM,MIN
*DIM,LINK_8,ARRAY,1,3
*DO,J,1,ELNUM
*GET,MATNUM,ELEM,ELMIN,ATTR,MAT
*GET,ELSEC,ELEM,ELMIN,ATTR,REAL
*GET,ELAREA, RCON, ELSEC, CONST,1
GNAME=40+MATNUM
*GET, N1, ELEM, ELMIN, NODE, 1
*GET, N2, ELEM, ELMIN, NODE, 2
LINK_8(1,1)=ELMIN
LINK_8(1,2)=N1
LINK_8(1,3)=N2
ELMIN=Elnext(ELMIN)
/OUTPUT,ANOUT,TXT,,APPEND
/COM
*VWRITE,GNAME,MATNUM
egroup truss name=%3I material=%3I
*VWRITE,GNAME
enodes group=%3I nnodes=2
/COM,entries el n1 n2
*VWRITE,LINK_8(1,1),LINK_8(1,2),LINK_8(1,3)
%8I %8I %8I
*VWRITE,GNAME
edata group=%3I
/COM,entries el material area
*VWRITE,LINK_8(1,1),MATNUM,ELAREA
%8I %8I %20.8G
/out
*ENDDO
*ENDIF
/OUTPUT,ANOUT,TXT,,APPEND
/COM
/COM,*END LINK8 INPUT
/COM
/OUT
!********************************************************************
!LINK10
!********************************************************************
ESEL,ALL
ESEL,S,ENAME,,LINK10
*GET, ELNUM, ELEM, 0, COUNT
*IF,ELNUM,EQ,0,THEN
/OUTPUT,ANOUT,TXT,,APPEND
/COM,*LINK10
/COM,*ELNUM=0
/OUT
*ELSE
/OUTPUT,ANOUT,TXT,,APPEND
/COM,*LINK10
*VWRITE,ELNUM
*ELNUM=%8I
/OUT
*Get,ELMIN,ELEM,0,NUM,MIN
*DIM,LINK_10,ARRAY,1,3
*DO,J,1,ELNUM
*GET,MATNUM,ELEM,ELMIN,ATTR,MAT
*GET,ELSEC,ELEM,ELMIN,ATTR,REAL
*GET,ELAREA, RCON, ELSEC, CONST,1
*GET,EPSIN, RCON, ELSEC, CONST,2
GNAME=50+MATNUM
*GET, N1, ELEM, ELMIN, NODE, 1
*GET, N2, ELEM, ELMIN, NODE, 2
LINK_10(1,1)=ELMIN
LINK_10(1,2)=N1
LINK_10(1,3)=N2
ELMIN=Elnext(ELMIN)
/OUTPUT,ANOUT,TXT,,APPEND
/COM
*VWRITE,GNAME,MATNUM
egroup truss name=%3I material=%3I displacements=large
*VWRITE,GNAME
enodes group=%3I nnodes=2
/COM,entries el n1 n2
*VWRITE,LINK_10(1,1),LINK_10(1,2),LINK_10(1,3)
%8I %8I %8I
*VWRITE,GNAME
edata group=%3I
/COM,entries el material area epsin
*VWRITE,LINK_10(1,1),MATNUM,ELAREA,EPSIN
%8I %8I %20.8G %20.8G
/out
*ENDDO
*ENDIF
/OUTPUT,ANOUT,TXT,,APPEND
/COM
/COM,*END LINK10 INPUT
/COM
/OUT
!********************************************************************
!SHELL63
!********************************************************************
/OUTPUT,ANOUT,TXT,,APPEND
/COM,*SHELL and PLATE
/OUT
ESEL,ALL
ESEL,S,ENAME,,SHELL63
*GET, ELNUM, ELEM, 0, COUNT
*IF,ELNUM,EQ,0,THEN
/OUTPUT,ANOUT,TXT,,APPEND
/COM,*SHELL63
/COM,*ELNUM=0
/OUT
*ELSE
/OUTPUT,ANOUT,TXT,,APPEND
/COM,*SHELL63
*VWRITE,ELNUM
*ELNUM=%8I
/OUT
*Get,ELMIN,ELEM,0,NUM,MIN
*DIM,SHELL_63,ARRAY,1,5
QCOUNT=0
TCOUNT=0
*DO,J,1,ELNUM
*GET,MATNUM,ELEM,ELMIN,ATTR,MAT
*GET,MATDENS,DENS, MATNUM, TEMP, 0
*GET,ELSEC,ELEM,ELMIN,ATTR,REAL
*GET,ELTHICK, RCON, ELSEC, CONST,1
*GET,ELMASS, RCON, ELSEC, CONST,19
*GET, N1, ELEM, ELMIN, NODE, 1
*GET, N2, ELEM, ELMIN, NODE, 2
*GET, N3, ELEM, ELMIN, NODE, 3
*GET, N4, ELEM, ELMIN, NODE, 4
*IF,ELMASS,EQ,0.0,THEN !根据膜的附加质量和密度计算膜的厚度
ELTHICK=1.0*ELTHICK
*ELSE
ELTHICK=ELMASS/MATDENS
*ENDIF
SHELL_63(1,1)=ELMIN
SHELL_63(1,2)=N1
SHELL_63(1,3)=N2
SHELL_63(1,4)=N3
SHELL_63(1,5)=N4
ELMIN=Elnext(ELMIN)
*IF,N3,NE,N4,THEN
QCOUNT=QCOUNT+1
GNAME=100+MATNUM
/OUTPUT,ANOUT,TXT,,APPEND
/COM
*VWRITE,GNAME,MATNUM
egroup shell name=%3I material=%3I
*VWRITE,GNAME
enodes group=%3I nnodes=4
/COM,entries el n1 n2 n3 n4
*VWRITE,SHELL_63(1,1),SHELL_63(1,2),SHELL_63(1,3),SHELL_63(1,4),SHELL_63(1,5)
%8I %8I %8I %8I %8I
/COM,elthickness
*VWRITE,SHELL_63(1,1),ELTHICK,ELTHICK,ELTHICK,ELTHICK
%8I %20.8G %20.8G %20.8G %20.8G
*VWRITE,GNAME
edata group=%3I
/COM,entries el material
*VWRITE,SHELL_63(1,1),MATNUM
%8I %8I
/out
*ELSE
TCOUNT=TCOUNT+1
GNAME=200+MATNUM
/OUTPUT,ANOUT,TXT,,APPEND
/COM
*VWRITE,GNAME,MATNUM
egroup plate name=%3I material=%3I
*VWRITE,GNAME
enodes group=%3I nnodes=3
/COM,entries el n1 n2 n3
*VWRITE,SHELL_63(1,1),SHELL_63(1,2),SHELL_63(1,3),SHELL_63(1,4)
%8I %8I %8I %8I
*VWRITE,GNAME
edata group=%3I
/COM,entries el material thick
*VWRITE,SHELL_63(1,1),MATNUM,ELTHICK
%8I %8I %20.8G
/out
*ENDIF
*ENDDO
*ENDIF
/OUTPUT,ANOUT,TXT,,APPEND
/COM
/COM,*END SHELL INPUT
/COM,DATAEND
/COM
/OUT |