1 ANSYS简要安装说明

  1. 把安装文件拷贝到本机。

  2. disk1 。以管理员身份运行setup安装。

  3. 填写服务器: 192.168.100.34
    (如果服务器连不上,cmd ping 192.168.100.34测试一下)

  4. 选择安装模块:Mechanical

  5. disk2. 填写路径:本地安装文件\disk2

  6. disk3. 填写路径:本地安装文件\disk3
    (要两次路径)!!!!!!!

  7. 安装完成,启动使用。

    可用模块授权:

有疑问请致电:黄主任6905、刘工6623

2 ANSYS的批处理batch技术

ANSYS的批处理batch技术

ANSYS的批处理是区别于GUI界面执行有限元分析过程的方式,通过批处理执行分析过程不用显式模型的相关情况,只会在后台运行,因而避免了用于可视化显式的相关资源的应用,速度相对来说比在GUI界面完成要快。而且批处理更大的好处是可以通过第三方软件或者编写的程序自动执行批处理过程,在二次开发中用的比较多。

ANSYS采取批处理模式的方式如图1所示。

通过Product Launcher启动ANSYS后,设置如下的界面。
图1
图1
需要指定Simulation Enviroment为ANSYS Batch模式,此时,需要指定input file,也就是需要执行的命令流文件,因为批处理模式无法打开ANSYS界面,不能控制整个分析过程。

设置完成后即可执行批处理过程,最终在工作目录下会看到生成一系列的文件。

以上是通过ANSYS自身运行批处理的方式,另外可以采用其他语言,比如VB.net、Python和Fortran等来完成,不同语言完成的方式略有区别,但大致思路一致,都是通过启动批处理程序并且输入相应的input文件。

为完成这个过程,可以先通过图1的主菜单Tool-Display Command Line,如图2所示。可以得到批处理的执行代码。
图2
图2
具体内容为:

“D:\Program Files (x86)\ANSYS Inc\v160\ANSYS\bin\winx64\ansys160.exe” -p ane3flds -dir “E:\CAE_Tech\process_files\79Files” -j “file14” -s read -l en-us -b -i “E:\CAE_Tech\process_files\79Files\APDL.txt”-o”E:\CAE_Tech\process_files\79Files\file.out”

其中:-p 表示指定license,ane3fl表示采用的license为ANSYS Multiphysics.

当把license变动后,可以查看到命令行也跟着改变。

-b 表示采用ANSYS Batch模式

-j 表示job名称

-s 表示模式为read

-l 表示语言环境

-i 表示input文件

-o 表示输出文件

这些内容不一定要全部指定,但是必须指定的是license 以及输入输出文件

如果将上面的命令存储在一个txt文件中,并且之后将此txt文件的后缀改为bat,成为一个批处理文件,之后双击即可运行该文件,执行ANSYS计算,在工作目录生成相关文件,如图3所示。

另外可以直接启动CMD,在CMD窗口复制粘贴上面的代码,同样可以完成ANSYS的调用计算。如图4所示。
图3
图3
图4
图4

3 服务器上安装ansys记录

本地拷贝到服务器(华为云server2019)上很慢,不然用网盘,买个加速,从网盘里下载快,1M多的速度,还勉强可以,虽然网盘购买的速度是10M。
安装过程中提示所需磁盘空间和磁盘还剩下多少空间,不够,奇怪,明明是200M的磁盘啊,不用理,点下一步。应该是显示错误,不影响使用。
68%时候提示装入第二个磁盘……先将第一个加载的磁盘弹出,再加载第二个iso,这样保证磁盘盘符一致。
需要断网安装,服务器右下角点击网络,打开internet……看到以太网,鼠标右键,禁止。但是这里禁止后,远程桌面就不行了,要去到华为云的控制台,通过浏览器连接进入远程桌面,再操作安装。

4 短文件名

engineercms的config文件(app.conf)里的设置路径,要用短路径名。
应用程序要求用缩短的路径名。例如要用C:\PROGRA~1\代替C:\Program Files。该程序无法处理空格,也不接受带引号的路径(例如”C:\Program Files”)。

单击开始,然后cmd在运行框中键入。启动cmd,并用于cd进入您感兴趣的文件夹:

cd \

然后

dir /x
C:\>dir /x

13/10/2011  09:14 AM    <DIR>          DOCUME~1     Documents and Settings
13/10/2011  09:05 AM    <DIR>          PROGRA~1     Program Files
2023/02/04  21:32    <DIR>          VIRTUA~1     .virtualenvs
2023/02/17  16:41    <DIR>          WORKSP~1     .workspace
2021/05/19  08:15    <DIR>          3DOBJE~1     3D Objects
2023/07/06  11:29    <DIR>          CLIPBO~1     clipboard
2021/05/19  08:15    <DIR>                       Contacts
2023/11/20  08:40    <DIR>                       Desktop
2023/10/10  11:19    <DIR>          DOCUME~1     Documents
2023/11/16  18:17    <DIR>          DOWNLO~1     Downloads
2023/03/06  08:24    <DIR>          FAVORI~1     Favorites
2021/05/19  08:15    <DIR>                       Links
2021/05/19  08:15    <DIR>                       Music
2021/08/09  07:12    <DIR>                       OneDrive
2022/04/06  09:09    <DIR>                       Pictures
2021/05/19  08:15    <DIR>          SAVEDG~1     Saved Games
2021/05/19  08:15    <DIR>                       Searches
2021/05/19  08:15    <DIR>                       Videos

5 ansys显示结果解读

DMX固定指:最大位移(Displacement Max);SMX:指定的、要查看的、那个Item解的最大值(Solution Max)。

  1. SMN、SMX中S的含义应是Solution(解),而不是Stress(应力);至于显示的是应力解还是位移解,
    要看图中第五行是UX还是SX,前者为X方向的位移,后者为X方向的应力。
    DMX=MAXIMUM DISPLACEMENT
    SMX=MAXIMUM Solution
    PS:ANSYS这个名代表的意思是analysis system
  2. 如图是查看SY,即Y方向上的节点应力,结果如图显示。
    DMX(固定)指最大位移(Displacement Max)
    SMX是指查看节点应力结果中最大的解
    SMN是指查看节点应力结果中最小的解。
    NODAL SOLUTION
    STEP=1
    SUB=1
    TIME=1
    SY  (AVG)
    RSYS=0
    DMX=2448
    SMN=-.741E+11
    SMX=.477E+11

    6 ansys的计算结果在web上显示

    一种是输出图片,一种是将rst文件解析出web可显示的文件格式。
    https://github.com/DevinCharles/ansys-apdl-to-vtk/blob/master/ansys_to_vtk.inp
! EXPORT NODAL/ELEMENT RESULTS FROM ANSYS APDL TO UNSTRUCTURED VTK FILE 
! FOR USE IN PARAVIEW

! CODE IS BASED ON https://pastebin.com/gyJHKTeJ 
! FROM
! https://stackoverflow.com/questions/41722822/how-to-read-ansys-data-files-in-paraview

! IMPORTANT!!!!
! YOU HABE TO RUN:
! "sed -i -e 's/ \{2,\}/ /g' -e 's/^ //g' -e 's/\r$//g' -e 's/ $//g' ansys_res_out.vtk"
! ON UNIX SYSTEMS TO MAKE THE VTK FILE READABLE BY PARAVIEW 
! SOLUTION FOR WINDOWS SYSTEMS NOT GIVEN HERE

! THE PARTS WHICH SHOULD BE MODIFIED ARE MARKED INSIDE THE SCRIPT

! TESTED WITH ANSYS MECHANICAL APDL19.2 AND PARAVIEW 5.6.*
! MODIFED @2019 Christian Schubert
! USE AT YOUR OWN RISK

/POST1
SET,LAST ! NEEDED TO LOAD NODE-AND-ELEMENT MODEL IN ANSYS WORKBENCH.

! SELECT REPORTED ELEMENTS AND NODES
ESEL,ALL
NSLE,S,CORNER

*GET,E_COU,ELEM,,COUNT
*GET,N_COU,NODE,,COUNT
*GET,E_MIN,ELEM,,NUM,MIN
*GET,E_MAX,ELEM,,NUM,MAX
*GET,N_MIN,NODE,,NUM,MIN
*GET,N_MAX,NODE,,NUM,MAX

*DIM,E_NODES,,E_COU,20
*DIM,E_NODES_MAT,CHAR,E_COU,21
*DIM,E_NODES_COUNT,,E_COU
*DIM,E_TYPES,,E_COU
*DIM,E_TYPES_NAME,,E_COU
*DIM,E_TYPES_VTK,,E_COU
*DIM,NODE_ID,,N_MAX
*DIM,N_X,,N_COU
*DIM,N_Y,,N_COU
*DIM,N_Z,,N_COU
*DIM,E_TYPES_ANSYS_TO_VTK,,300

! ----------------  MODIFY -----------------------
! MODIF IF YOU WANT MORE RESULTS ....

*DIM,MY_NODE_RESULT,,N_COU
*DIM,MY_ELEM_RESULT,,E_COU
! ----------------  END MODIFY -------------------

E_TYPES_ANSYS_TO_VTK(5)=12     ! SOLID5 (3-D COUPLED-FIELD SOLID)
E_TYPES_ANSYS_TO_VTK(11)=3     ! LINK11 (LINEAR ACTUATOR)
E_TYPES_ANSYS_TO_VTK(13)=9     ! PLANE13 (2-D COUPLED-FIELD SOLID)
E_TYPES_ANSYS_TO_VTK(14)=3     ! COMBIN14 (SPRING-DAMPER)
E_TYPES_ANSYS_TO_VTK(21)=1     ! MASS21 (STRUCTURAL MASS)
E_TYPES_ANSYS_TO_VTK(25)=9     ! PLANE25 (AXISYMMETRIC-HARMONIC 4-NODE STRUCTURAL SOLID)
E_TYPES_ANSYS_TO_VTK(27)=3     ! MATRIX27 (STIFFNESS, DAMPING, OR MASS MATRIX)
E_TYPES_ANSYS_TO_VTK(29)=9     ! FLUID29 (2-D AXISYMMETRIC HARMONIC ACOUSTIC FLUID)
E_TYPES_ANSYS_TO_VTK(30)=12    ! FLUID30 (3-D ACOUSTIC FLUID)
E_TYPES_ANSYS_TO_VTK(31)=3     ! LINK31 (RADIATION LINK)
E_TYPES_ANSYS_TO_VTK(33)=3     ! LINK33 (3-D CONDUCTION BAR)
E_TYPES_ANSYS_TO_VTK(34)=3     ! LINK34 (CONVECTION LINK)
E_TYPES_ANSYS_TO_VTK(35)=5     ! PLANE35 (2-D 6-NODE TRIANGULAR THERMAL SOLID)
E_TYPES_ANSYS_TO_VTK(36)=5     ! SOURC36 (CURRENT SOURCE)
E_TYPES_ANSYS_TO_VTK(37)=4     ! COMBIN37 (CONTROL)
E_TYPES_ANSYS_TO_VTK(38)=3     ! FLUID38 (DYNAMIC FLUID COUPLING)
E_TYPES_ANSYS_TO_VTK(39)=3     ! COMBIN39 (NONLINEAR SPRING)
E_TYPES_ANSYS_TO_VTK(40)=3     ! COMBIN40 (COMBINATION)
E_TYPES_ANSYS_TO_VTK(47)=9     ! INFIN47 (3-D INFINITE BOUNDARY)
E_TYPES_ANSYS_TO_VTK(50)=-1000 ! MATRIX50 (SUPERELEMENT (OR SUBSTRUCTURE))
E_TYPES_ANSYS_TO_VTK(55)=9     ! PLANE55 (2-D THERMAL SOLID)
E_TYPES_ANSYS_TO_VTK(61)=3     ! SHELL61 (AXISYMMETRIC-HARMONIC STRUCTURAL SHELL)
E_TYPES_ANSYS_TO_VTK(65)=12    ! SOLID65 (3-D REINFORCED CONCRETE SOLID)
E_TYPES_ANSYS_TO_VTK(68)=3     ! LINK68 (COUPLED THERMAL-ELECTRIC LINE)
E_TYPES_ANSYS_TO_VTK(70)=12    ! SOLID70 (3-D THERMAL SOLID)
E_TYPES_ANSYS_TO_VTK(71)=1     ! MASS71 (THERMAL MASS)
E_TYPES_ANSYS_TO_VTK(75)=9     ! PLANE75 (AXISYMMETRIC-HARMONIC 4-NODE THERMAL SOLID)
E_TYPES_ANSYS_TO_VTK(77)=9     ! PLANE77 (2-D 8-NODE THERMAL SOLID)
E_TYPES_ANSYS_TO_VTK(78)=9     ! PLANE78 (AXISYMMETRIC-HARMONIC 8-NODE THERMAL SOLID)
E_TYPES_ANSYS_TO_VTK(83)=9     ! PLANE83 (AXISYMMETRIC-HARMONIC 8-NODE STRUCTURAL SOLID)
E_TYPES_ANSYS_TO_VTK(87)=10    ! SOLID87 (3-D 10-NODE TETRAHEDRAL THERMAL SOLID)
E_TYPES_ANSYS_TO_VTK(90)=12    ! SOLID90 (3-D 20-NODE THERMAL SOLID)
E_TYPES_ANSYS_TO_VTK(94)=4     ! CIRCU94 (PIEZOELECTRIC CIRCUIT)
E_TYPES_ANSYS_TO_VTK(96)=12    ! SOLID96 (3-D MAGNETIC SCALAR SOLID)
E_TYPES_ANSYS_TO_VTK(98)=10    ! SOLID98 (TETRAHEDRAL COUPLED-FIELD SOLID)
E_TYPES_ANSYS_TO_VTK(110)=9    ! INFIN110 (2-D INFINITE SOLID)
E_TYPES_ANSYS_TO_VTK(111)=12   ! INFIN111 (3-D INFINITE SOLID)
E_TYPES_ANSYS_TO_VTK(116)=3    ! FLUID116 (COUPLED THERMAL-FLUID PIPE)
E_TYPES_ANSYS_TO_VTK(121)=9    ! PLANE121 (2-D 8-NODE ELECTROSTATIC SOLID)
E_TYPES_ANSYS_TO_VTK(122)=12   ! SOLID122 (3-D 20-NODE ELECTROSTATIC SOLID)
E_TYPES_ANSYS_TO_VTK(123)=10   ! SOLID123 (3-D 10-NODE TETRAHEDRAL ELECTROSTATIC SOLID)
E_TYPES_ANSYS_TO_VTK(124)=4    ! CIRCU124 (ELECTRIC CIRCUIT)
E_TYPES_ANSYS_TO_VTK(125)=4    ! CIRCU125 (DIODE)
E_TYPES_ANSYS_TO_VTK(126)=3    ! TRANS126 (ELECTROMECHANICAL TRANSDUCER)
E_TYPES_ANSYS_TO_VTK(129)=3    ! FLUID129 (2-D INFINITE ACOUSTIC)
E_TYPES_ANSYS_TO_VTK(130)=9    ! FLUID130 (3-D INFINITE ACOUSTIC)
E_TYPES_ANSYS_TO_VTK(131)=9    ! SHELL131 (4-NODE THERMAL SHELL)
E_TYPES_ANSYS_TO_VTK(132)=9    ! SHELL132 (8-NODE THERMAL SHELL)
E_TYPES_ANSYS_TO_VTK(136)=9    ! FLUID136 (3-D SQUEEZE FILM FLUID ELEMENT)
E_TYPES_ANSYS_TO_VTK(138)=3    ! FLUID138 (3-D VISCOUS FLUID LINK ELEMENT)
E_TYPES_ANSYS_TO_VTK(139)=4    ! FLUID139 (3-D SLIDE FILM FLUID ELEMENT)
E_TYPES_ANSYS_TO_VTK(144)=4    ! ROM144 (REDUCED ORDER ELECTROSTATIC-STRUCTURAL)
E_TYPES_ANSYS_TO_VTK(151)=3    ! SURF151 (2-D THERMAL SURFACE EFFECT)
E_TYPES_ANSYS_TO_VTK(152)=9    ! SURF152 (3-D THERMAL SURFACE EFFECT)
E_TYPES_ANSYS_TO_VTK(153)=3    ! SURF153 (2-D STRUCTURAL SURFACE EFFECT)
E_TYPES_ANSYS_TO_VTK(154)=9    ! SURF154 (3-D STRUCTURAL SURFACE EFFECT)
E_TYPES_ANSYS_TO_VTK(155)=3    ! SURF155 (3-D THERMAL SURFACE EFFECT)
E_TYPES_ANSYS_TO_VTK(156)=3    ! SURF156 (3-D STRUCTURAL SURFACE LINE LOAD EFFECT)
E_TYPES_ANSYS_TO_VTK(157)=9    ! SHELL157 (THERMAL-ELECTRIC SHELL)
E_TYPES_ANSYS_TO_VTK(159)=-1000! SURF159 (GENERAL AXISYMMETRIC SURFACE)
E_TYPES_ANSYS_TO_VTK(160)=5    ! LINK160 (EXPLICIT 3-D SPAR (OR TRUSS))
E_TYPES_ANSYS_TO_VTK(161)=5    ! BEAM161 (EXPLICIT 3-D BEAM)
E_TYPES_ANSYS_TO_VTK(162)=9    ! PLANE162 (EXPLICIT 2-D STRUCTURAL SOLID)
E_TYPES_ANSYS_TO_VTK(163)=9    ! SHELL163 (EXPLICIT THIN STRUCTURAL SHELL)
E_TYPES_ANSYS_TO_VTK(164)=12   ! SOLID164 (EXPLICIT 3-D STRUCTURAL SOLID)
E_TYPES_ANSYS_TO_VTK(165)=3    ! COMBI165 (EXPLICIT SPRING-DAMPER)
E_TYPES_ANSYS_TO_VTK(166)=1    ! MASS166 (EXPLICIT 3-D STRUCTURAL MASS)
E_TYPES_ANSYS_TO_VTK(167)=5    ! LINK167 (EXPLICIT TENSION-ONLY SPAR)
E_TYPES_ANSYS_TO_VTK(168)=10   ! SOLID168 (EXPLICIT 3-D 10-NODE TETRAHEDRAL STRUCTURAL SOLID)
E_TYPES_ANSYS_TO_VTK(169)=3    ! TARGE169 (2-D TARGET SEGMENT)
E_TYPES_ANSYS_TO_VTK(170)=9    ! TARGE170 (3-D TARGET SEGMENT)
E_TYPES_ANSYS_TO_VTK(171)=3    ! CONTA171 (2-D 2-NODE SURFACE-TO-SURFACE CONTACT)
E_TYPES_ANSYS_TO_VTK(172)=3    ! CONTA172 (2-D 3-NODE SURFACE-TO-SURFACE CONTACT )
E_TYPES_ANSYS_TO_VTK(173)=9    ! CONTA173 (3-D 4-NODE SURFACE-TO-SURFACE CONTACT)
E_TYPES_ANSYS_TO_VTK(174)=9    ! CONTA174 (3-D 8-NODE SURFACE-TO-SURFACE CONTACT)
E_TYPES_ANSYS_TO_VTK(175)=1    ! CONTA175 (2-D/3-D NODE-TO-SURFACE CONTACT)
E_TYPES_ANSYS_TO_VTK(176)=3    ! CONTA176 (3-D LINE-TO-LINE CONTACT)
E_TYPES_ANSYS_TO_VTK(177)=3    ! CONTA177 (3-D LINE-TO-SURFACE CONTACT)
E_TYPES_ANSYS_TO_VTK(178)=3    ! CONTA178 (3-D NODE-TO-NODE CONTACT)
E_TYPES_ANSYS_TO_VTK(179)=5    ! PRETS179 (PRETENSION)
E_TYPES_ANSYS_TO_VTK(180)=3    ! LINK180 (3-D SPAR (OR TRUSS))
E_TYPES_ANSYS_TO_VTK(181)=9    ! SHELL181 (4-NODE STRUCTURAL SHELL)
E_TYPES_ANSYS_TO_VTK(182)=9    ! PLANE182 (2-D 4-NODE STRUCTURAL SOLID)
E_TYPES_ANSYS_TO_VTK(183)=9    ! PLANE183 (2-D 8-NODE OR 6-NODE STRUCTURAL SOLID)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184 (MULTIPOINT CONSTRAINT ELEMENT)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-LINK/BEAM (MULTIPOINT CONSTRAINT ELEMENT: RIGID LINK OR RIGID BEAM)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-SLIDER (MULTIPOINT CONSTRAINT ELEMENT: SLIDER)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-REVOLUTE (MULTIPOINT CONSTRAINT ELEMENT: REVOLUTE JOINT)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-UNIVERSAL (MULTIPOINT CONSTRAINT ELEMENT: UNIVERSAL JOINT)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-SLOT (MULTIPOINT CONSTRAINT ELEMENT: SLOT JOINT)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-POINT (MULTIPOINT CONSTRAINT ELEMENT: POINT-IN-PLANE JOINT)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-TRANSLATIONAL (MULTIPOINT CONSTRAINT ELEMENT: TRANSLATIONAL JOINT)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-CYLINDRICAL (MULTIPOINT CONSTRAINT ELEMENT: CYLINDRICAL JOINT)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-PLANAR (MULTIPOINT CONSTRAINT ELEMENT: PLANAR JOINT)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-WELD (MULTIPOINT CONSTRAINT ELEMENT: WELD JOINT)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-ORIENT (MULTIPOINT CONSTRAINT ELEMENT: ORIENT JOINT)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-SPHERICAL (MULTIPOINT CONSTRAINT ELEMENT: SPHERICAL JOINT)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-GENERAL (MULTIPOINT CONSTRAINT ELEMENT: GENERAL JOINT)
E_TYPES_ANSYS_TO_VTK(184)=4    ! MPC184-SCREW (MULTIPOINT CONSTRAINT ELEMENT: SCREW JOINT)
E_TYPES_ANSYS_TO_VTK(185)=12   ! SOLID185 (3-D 8-NODE STRUCTURAL SOLID)
E_TYPES_ANSYS_TO_VTK(186)=12   ! SOLID186 (3-D 20-NODE STRUCTURAL SOLID)
E_TYPES_ANSYS_TO_VTK(187)=10   ! SOLID187 (3-D 10-NODE TETRAHEDRAL STRUCTURAL SOLID)
E_TYPES_ANSYS_TO_VTK(188)=5    ! BEAM188 (3-D 2-NODE BEAM)
E_TYPES_ANSYS_TO_VTK(189)=9    ! BEAM189 (3-D 3-NODE BEAM)
E_TYPES_ANSYS_TO_VTK(190)=12   ! SOLSH190 (3-D 8-NODE STRUCTURAL SOLID SHELL)
E_TYPES_ANSYS_TO_VTK(192)=9    ! INTER192 (2-D 4-NODE GASKET)
E_TYPES_ANSYS_TO_VTK(193)=9    ! INTER193 (2-D 6-NODE GASKET)
E_TYPES_ANSYS_TO_VTK(194)=12   ! INTER194 (3-D 16-NODE GASKET)
E_TYPES_ANSYS_TO_VTK(195)=12   ! INTER195 (3-D 8-NODE GASKET)
E_TYPES_ANSYS_TO_VTK(200)=-1000! MESH200 (MESHING FACET)
E_TYPES_ANSYS_TO_VTK(201)=1    ! FOLLW201 (FOLLOWER LOAD)
E_TYPES_ANSYS_TO_VTK(202)=9    ! INTER202 (2-D 4-NODE COHESIVE)
E_TYPES_ANSYS_TO_VTK(203)=7    ! INTER203 (2-D 6-NODE COHESIVE)
E_TYPES_ANSYS_TO_VTK(204)=-1000! INTER204 (3-D 16-NODE COHESIVE)
E_TYPES_ANSYS_TO_VTK(205)=12   ! INTER205 (3-D 8-NODE COHESIVE)
E_TYPES_ANSYS_TO_VTK(208)=3    ! SHELL208 (2-NODE AXISYMMETRIC SHELL)
E_TYPES_ANSYS_TO_VTK(209)=3    ! SHELL209 (3-NODE AXISYMMETRIC SHELL)
E_TYPES_ANSYS_TO_VTK(212)=9    ! CPT212 (2-D 4-NODE COUPLED PORE-PRESSURE MECHANICAL SOLID)
E_TYPES_ANSYS_TO_VTK(213)=9    ! CPT213 (2-D 8-NODE COUPLED PORE-PRESSURE MECHANICAL SOLID)
E_TYPES_ANSYS_TO_VTK(214)=3    ! COMBI214 (2-D SPRING-DAMPER BEARING)
E_TYPES_ANSYS_TO_VTK(215)=12   ! CPT215 (3-D 8-NODE COUPLED PORE-PRESSURE MECHANICAL SOLID)
E_TYPES_ANSYS_TO_VTK(216)=12   ! CPT216 (3-D 20-NODE COUPLED PORE-PRESSURE MECHANICAL SOLID )
E_TYPES_ANSYS_TO_VTK(217)=10   ! CPT217 (3-D 10-NODE COUPLED PORE-PRESSURE MECHANICAL SOLID)
E_TYPES_ANSYS_TO_VTK(218)=9    ! FLUID218 (3-D HYDRODYNAMIC BEARING ELEMENT)
E_TYPES_ANSYS_TO_VTK(220)=12   ! FLUID220 (3-D ACOUSTIC FLUID 20-NODE SOLID ELEMENT)
E_TYPES_ANSYS_TO_VTK(221)=10   ! FLUID221 (3-D ACOUSTIC FLUID 10-NODE SOLID ELEMENT)
E_TYPES_ANSYS_TO_VTK(223)=9    ! PLANE223 (2-D 8-NODE COUPLED-FIELD SOLID)
E_TYPES_ANSYS_TO_VTK(226)=12   ! SOLID226 (3-D 20-NODE COUPLED-FIELD SOLID)
E_TYPES_ANSYS_TO_VTK(227)=10   ! SOLID227 (3-D 10-NODE COUPLED-FIELD SOLID)
E_TYPES_ANSYS_TO_VTK(230)=9    ! PLANE230 (2-D 8-NODE ELECTRIC SOLID)
E_TYPES_ANSYS_TO_VTK(231)=12   ! SOLID231 (3-D 20-NODE ELECTRIC SOLID)
E_TYPES_ANSYS_TO_VTK(232)=10   ! SOLID232 (3-D 10-NODE TETRAHEDRAL ELECTRIC SOLID)
E_TYPES_ANSYS_TO_VTK(233)=9    ! PLANE233 (2-D 8-NODE ELECTROMAGNETIC SOLID )
E_TYPES_ANSYS_TO_VTK(236)=12   ! SOLID236 (3-D 20-NODE ELECTROMAGNETIC SOLID)
E_TYPES_ANSYS_TO_VTK(237)=10   ! SOLID237 (3-D 10-NODE ELECTROMAGNETIC SOLID)
E_TYPES_ANSYS_TO_VTK(238)=9    ! PLANE238 (2-D 8-NODE DIFFUSION SOLID)
E_TYPES_ANSYS_TO_VTK(239)=12   ! SOLID239 (3-D 20-NODE DIFFUSION SOLID)
E_TYPES_ANSYS_TO_VTK(240)=10   ! SOLID240 (3-D 10-NODE TETRAHEDRAL DIFFUSION SOLID)
E_TYPES_ANSYS_TO_VTK(241)=9    ! HSFLD241 (2-D HYDROSTATIC FLUID)
E_TYPES_ANSYS_TO_VTK(242)=-1000! HSFLD242 (3-D HYDROSTATIC FLUID)
E_TYPES_ANSYS_TO_VTK(251)=3    ! SURF251 (2-D RADIOSITY SURFACE)
E_TYPES_ANSYS_TO_VTK(252)=9    ! SURF252 (3-D RADIOSITY SURFACE)
E_TYPES_ANSYS_TO_VTK(257)=12   ! INFIN257 (STRUCTURAL INFINITE SOLID)
E_TYPES_ANSYS_TO_VTK(263)=9    ! REINF263 (2-D SMEARED REINFORCING)
E_TYPES_ANSYS_TO_VTK(264)=12   ! REINF264 (3-D DISCRETE REINFORCING)
E_TYPES_ANSYS_TO_VTK(265)=-1000! REINF265 (3-D SMEARED REINFORCING)
E_TYPES_ANSYS_TO_VTK(272)=-1000! SOLID272 (GENERAL AXISYMMETRIC SOLID WITH 4 BASE NODES)
E_TYPES_ANSYS_TO_VTK(273)=-1000! SOLID273 (GENERAL AXISYMMETRIC SOLID WITH 8 BASE NODES)
E_TYPES_ANSYS_TO_VTK(278)=12   ! SOLID278 (3-D 8-NODE THERMAL SOLID)
E_TYPES_ANSYS_TO_VTK(279)=12   ! SOLID279 (3-D 20-NODE THERMAL SOLID)
E_TYPES_ANSYS_TO_VTK(281)=9    ! SHELL281 (8-NODE STRUCTURAL SHELL)
E_TYPES_ANSYS_TO_VTK(285)=10   ! SOLID285 (3-D 4-NODE TETRAHEDRAL STRUCTURAL SOLID WITH NODAL PRESSURES)
E_TYPES_ANSYS_TO_VTK(288)=3    ! PIPE288 (3-D 2-NODE PIPE)
E_TYPES_ANSYS_TO_VTK(289)=3    ! PIPE289 (3-D 3-NODE PIPE )
E_TYPES_ANSYS_TO_VTK(290)=3    ! ELBOW290 (3-D 3-NODE ELBOW)
E_TYPES_ANSYS_TO_VTK(300)=-1000! USER300 (USER-DEFINED ELEMENT)


! GET NODE RESULTS
N_J=N_MIN
*DO,J,1,N_COU
    ! ----------------  MODIFY -----------------------
    ! GET NODE RESULTS

    *GET,MY_NODE_RESULT(J),NODE,N_J,CURR                ! MODIFY!!!

    ! ----------------  END MODIFY -------------------
    N_J=NDNEXT(N_J)
*ENDDO


! GET ELEMENT RESULTS
E_I=E_MIN
*DO,I,1,E_COU
    ! ----------------  MODIFY -----------------------
    ! GET ELEMENT RESULTS

        *GET,MY_ELEM_RESULT(I),ELEM,E_I,ETAB,JOULE,,  ! MODIFY!!!

    ! ----------------  END MODIFY -------------------
    E_I=ELNEXT(E_I)
*ENDDO

! GET NODE COORDINATES
N_J=N_MIN
*DO,J,1,N_COU
    NODE_ID(N_J)=J-1
    *GET,N_X(J),NODE,N_J,LOC,X !NX(N_J) - SHORT undocumented?
    *GET,N_Y(J),NODE,N_J,LOC,Y !NY(N_J) - SHORT undocumented?
    *GET,N_Z(J),NODE,N_J,LOC,Z !NZ(N_J) - SHORT undocumented?
    N_J=NDNEXT(N_J)
*ENDDO

! GET ELEMENT TYPE FOR VTK
CELLS_SIZE=0
E_I=E_MIN
*DO,I,1,E_COU
    CELLS_SIZE=CELLS_SIZE+1
    E_NODES_COUNT(I)=0

    *DO,J,1,20
        N_J=NELEM(E_I,J) !undocumented -*GET,NJ,ELEM,E_I,NODE,J
        *IF,NSEL(N_J),NE,-1,THEN
            E_NODES_COUNT(I)=E_NODES_COUNT(I)+1
            E_NODES(I,J)=NODE_ID(N_J)
            E_NODES_MAT(I,J+1)=CHRVAL(NODE_ID(N_J))
            CELLS_SIZE=CELLS_SIZE+1
        *ELSE
            *EXIT
        *ENDIF
    *ENDDO

    E_NODES_MAT(I,1)=CHRVAL(E_NODES_COUNT(I))
    *GET,E_TYPES(I),ELEM,E_I,ATTR,TYPE
    *GET,E_TYPES_NAME(I),ETYP,E_TYPES(I),ATTR,ENAM
    E_TYPES_VTK(I)=E_TYPES_ANSYS_TO_VTK(E_TYPES_NAME(I))
    E_I=ELNEXT(E_I)
*ENDDO

*CFOPEN,'ansys_res_out','vtk'

*VWRITE,
('# vtk DataFile Version 3.0')
*VWRITE,
('ANSYS Results')
*VWRITE,
('ASCII')
*VWRITE,
('DATASET UNSTRUCTURED_GRID')
*VWRITE,N_COU
('POINTS ',F0.0,TL1,' float')

*VWRITE,N_X(1),N_Y(1),N_Z(1)
(1PE12.5,' ',1PE12.5,' '1PE12.5)

*VWRITE,E_COU,CELLS_SIZE
('CELLS ',F0.0,TL1,' ',F0.0,TL1,' ')

*CFCLOSE

/NOPR !SUPPRESS PRINTOUT TO CONSOLE
/OUTPUT,'ansys_res_out','vtk',,APPEND
*MWRITE,E_NODES_MAT(1,1)
(21(A8,','))
/OUTPUT
*CFCLOSE
/GOPR  !REACTIVATE PRINTOUT TO CONSOLE

*CFOPEN,'ansys_res_out','vtk',,APPEND

*VWRITE,E_COU
('CELL_TYPES ',F0.0,TL1,' ')

*VWRITE,E_TYPES_VTK(1)
(F0.0,TL1,' ')

*CFCLOSE

WRITE NODE DATA
*CFOPEN,'ansys_res_out','vtk',,APPEND

*VWRITE,N_COU
('POINT_DATA ',F0.0,TL1,' ')

! ----------------  MODIFY -----------------------
! WRITE NODE DATA. COPY NODE RES BLOCK AND MODIFY FOR MORE THAN 1 VARIABLE

! NODE RES BLOCK --------
*VWRITE,'NODE_RES'              ! NAME OF NODE RES DATA
('SCALARS ',A8,' FLOAT 1')

*VWRITE
('LOOKUP_TABLE default')

*VWRITE,MY_NODE_RESULT(1)       ! NODE RESULT TO WRITE
(1PE12.5)
! END NODE RES BLOCK -----
! ----------------  END MODIFY -------------------

*CFCLOSE

! WRITE ELEMENT DATA
*CFOPEN,'ansys_res_out','vtk',,APPEND

*VWRITE,E_COU
('CELL_DATA ',F0.0,TL1,' ')

 ! ----------------  MODIFY -----------------------
! WRITE ELEMT DATA. COPY ELEM RES BLOCK AND MODIFY FOR MORE THAN 1 VARIABLE

! NODE RES BLOCK --------
*VWRITE,'ELEM_RES'              ! NAME OF ELEM RES DATA
('SCALARS ',A8,' float 1')

*VWRITE
('LOOKUP_TABLE default')

*VWRITE,MY_ELEM_RESULT(1)       ! ELEMENT RESULT TO WRITE
(1PE12.5)
! END NODE RES BLOCK -----
! ----------------  END MODIFY -------------------

*CFCLOSE

相关知识点:
https://blog.csdn.net/hotqin888/article/details/122504174
https://blog.csdn.net/hhy321/article/details/122898478
https://discuss.ansys.com/discussion/1998/export-results-to-vtk-format
https://github.com/ansys/pymapdl-reader
https://zhuanlan.zhihu.com/p/559786103

作者:秦晓川  创建时间:2022-02-28 16:50
最后编辑:秦晓川  更新时间:2024-12-21 14:14
上一篇:
下一篇: