我用ANSYS分析了一个基本的结构,我需要在动力分析、静态分析之间进行转换。有时候我只需要考虑一定的负担。这使解决方案的部分陷入混乱。
!!! Add wind loads
*DIM,windforce,,4
windforce(1) = 2520
windforce(2) = -1575
windforce(3) = -1890
windforce(4) = -1575
*DO,i,1,3
SFBEAM,i ,1 ,PRES ,windforce(1)
*enddo
*DO,i,4,6
SFBEAM,i ,1 ,PRES ,windforce(2)
*enddo
*DO,i,7,9
SFBEAM,i ,1 ,PRES ,windforce(3)
*enddo
*DO,i,10,12
SFBEAM,i ,1 ,PRES ,windforce(4)
*enddo
FINISH
/SOLU ! enter solution phase
! !!Dynamic Analysis
! antype,modal
! modopt,lanb,40,0,0,,off
! mxpand,0,,,0
! lumpm,1
! solve
! finish
! ! ! Generate Mass and K Matrix
! antype,substr
! seopt,yg_bde,2
! lumpm,1
! m,all,all
! /output,matrix
! solve
! /output
! selist,yg_bde,3
! finish
SOLVE ! solve the resulting system of equations
FINISH 每次我在这个分析之间切换时,我都需要注释掉大量的代码。这看起来真的很糟糕。
那么我如何组织我的代码呢?或者如何使这个代码模块化?ANSYS脚本语言有什么框架吗?(就像scss for css)。
发布于 2015-03-16 11:25:56
我不认为有这样的工具,但有一个列表的Ansys批准的文本编辑器和其他有用的程序(数字化,计算机辅助设计转换器等)。
我想,如果要有任何好的框架,就必须在那里列出。
发布于 2015-07-13 14:14:06
我建议在单独的文件中使用代码块,然后在主代码中调用这些文件。
切换代码部分的最简单方法是结合参数使用*IF条件。然后,您可以调用您的脚本作为myscript.txt,ARG1,ARG2,ARG3。其中myscript.txt是您的脚本名(也是.ans,.mac .)ARGx是你的开关。
示例:
! here is the same stuff for any run
*IF,ARG1,EQ,1,then
! here is one variation of the code (e.g. static analysis)
*ENDIF
*IF,ARG1,EQ,2,then
! here is another variation of the code (e.g. dynamic analysis)
*ENDIF
! here is again code used for any variation of the code 如果上面的示例位于名为solverswitch.txt的文本文件中,那么您将通过solverswitch.txt,1 (或solverswitch.txt,2)执行各种求解器选项。
发布于 2015-06-24 14:04:11
我使用jedit来编辑复杂的ANSYS文件,除了具有各种典型的脚本软件功能之外,它还识别了大多数ANSYS命令和颜色代码,以便于参考。
您必须重命名您的输入文件*.ans,以便jedit识别ANSYS格式。
我不确定这是否是您所说的“模块化”代码,但是您可以创建各种脚本,并通过命令/INPUT、'file_name‘、’file_扩展名‘、’相对_路径‘、0调用它们。
https://stackoverflow.com/questions/27065048
复制相似问题