2014-11-21 85 views
0

我使用ANSYS分析一个基本结构,并且需要在动态分析和静态分析之间切换。有时我只需要考虑一定的负载。这使解决方案陷入混乱。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脚本语言的框架? (对于css类似scss)。

回答

1

我不认为有这样的工具,但有Ansys批准的文本编辑器和其他有用的程序(数字转换器,CAD转换器e.t.c)的list

我想,如果有任何好的框架,它必须在那里列出。

0

我使用jedit来编辑复杂的ANSYS文件,除了具有脚本软件的各种典型功能外,它还可以识别大多数ANSYS命令并对它们进行颜色编码以便于参考。

您必须重命名输入文件* .ans,以便jedit识别ANSYS格式。

我不确定这是否意味着“模块化”代码,但您可以创建各种脚本并使用命令 /INPUT,'file_name','file_extension'从主例程调用它们, 'relative_path',, 0

0

我建议在单独的文件中使用代码块,然后在主代码中调用这些文件。

切换部分代码的最简单方法是将* 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)

0

我主要使用桥梁,我经常需要做多种类型的分析(静态,动态等)。我的工作流程是基本的APDL文件,例如“truss_bridge.txt”,它分别调用其他文件:“bridge_load.txt”,“bridge_design.txt”,“bridge_out.txt”用于不同类型的分析,网格划分,输出。 我使用/ EOF命令在每个文件中分隔这些不同的选项,并使用/ INPUT命令指定相应的行来调用我想要的分析类型。所以我的基本档案可能是这样的:

/INPUT,viaduct_materials,txt,direct  ! material parameters 
    /INPUT,viaduct_real_constants,txt,direct ! R.C. parameters  
    /INPUT,viaduct_design,txt,direct   ! Design bridge and meshing 

    /INPUT,viaduct_load,txt,direct,1 ! LOAD File static analysis 
    ! Post Processing 
    /INPUT,viaduct_out,txt,direct,1 ! Output file S.A. 

    /INPUT,viaduct_load,txt,direct,14 ! LOAD File dynamic analysis 
    ! Post Processing 
    /INPUT,viaduct_out,txt,direct,21 ! Output file D.A.