zoukankan      html  css  js  c++  java
  • Ansys常用命令


    视图设置-输出页面设置

    /angle ,1,90,x,1  $ /replot   ! 视角绕x轴旋转90度,第一个1表示图窗序号,最后一个1表示每次改变基于上次结果
    /page,8889999,132,8889999,240

    设置结果输出位数

    /format,,f,18,10

    输出图片

    !改变背景颜色为白色
    /RGB,INDEX,100,100,100,0 $/RGB,INDEX, 80, 80, 80,13
    /RGB,INDEX, 60, 60, 60,14 $/RGB,INDEX, 0, 0, 0,15 $/replot 
    /image,save,'D:AnsysPic',bmp    ! png或者bmp,bmp格式ps可以编辑,png不可用
    /cmap $/replot                 !恢复到原来设置 P113

    查看结点总数

    allsel
    *get,nodeNumAll,node,0,count      ! 查看选择集中结点数目
    
    *get,nodeMax,node,0,num,max       ! 查看选择集中结点最大编号
    *get,nodeMaxD,node,0,num,maxd       ! 查看已定义的结点最大编号

    输出结点编号与坐标txt

    ! ========== Creat Date: 2021-03-13 ==========
    ! ========== Author: xdd1997        ==========
    ! ========== Email: xdd2026@qq.com  ==========
    ! 输出结点坐标
    /post1
    csys,0
    *get,nodeNumAll,node,0,count     ! 获取总结点数目
    *get,nd,node,0,num,min           ! 获取结点最小编号
    *dim,nodeInfo1,array,nodeNumAll,4 ! 定义数组,nodeNumAll行4列
    *do,i,1,nodeNumAll,1             ! 遍历nodeNumAll次,每次i=i+1
        nodeInfo1(i,1)=nd
        nodeInfo1(i,2)=nx(nd)
        nodeInfo1(i,3)=ny(nd)
        nodeInfo1(i,4)=nz(nd)
        nd=ndnext(nd)                ! 取得当前选择集中大于nd的下一个节点编号
    *enddo
    
    *create,dw62,mac       ! 创建宏文件
    *cfopen,FixedNode958W,txt
    *vwrite,nodeInfo1(1,1),nodeInfo1(1,2),nodeInfo1(1,3),nodeInfo1(1,4)      !写出信息到文件
    %10I %25.10F %25.10F %25.10F
    *cfclose
    *end                   !结束宏文件的创建
    dw62                   !运行宏文件
    

    输出结点位移txt

    ! ========== Creat Date: 2021-03-13 ==========
    ! ========== Author: xdd1997        ==========
    ! ========== Email: xdd2026@qq.com  ==========
    
    
    /post1
    allsel
    *get,nodeNumAll,node,0,count     ! 获取总结点数目
    *get,nd,node,0,num,min           ! 获取结点最小编号
    *dim,nodeInfo2,array,nodeNumAll,5 ! 定义数组,nodeNumAll行5列
    *do,i,1,nodeNumAll,1             ! 遍历nodeNumAll次,每次i=i+1
        nodeInfo2(i,1)=nd
        nodeInfo2(i,2)=ux(nd)
        nodeInfo2(i,3)=uy(nd)
        nodeInfo2(i,4)=uz(nd)
        *get,nodesum,node,nd,u,sum   ! 提取节点的和位移
        nodeInfo2(i,5)=nodesum  
        nd=ndnext(nd)                ! 取得当前选择集中大于nd的下一个节点编号
    *enddo
    
    *create,dw62,mac       ! 创建宏文件
    *cfopen,M_958W_displacement,txt
    *vwrite,nodeInfo2(1,2),nodeInfo2(1,3),nodeInfo2(1,4),nodeInfo2(1,5)      !写出信息到文件
    (4F25.10)
    *cfclose
    *end                   !结束宏文件的创建
    dw62                   !运行宏文件

    输出结点和位移

    !!! ====================== 输出结点和位移到txt文件 =====================
    ! ========== Creat Date: 2021-03-13 ==========
    ! ========== Author: xdd1997        ==========
    ! ========== Email: xdd2026@qq.com  ==========
    finish $ /post1
    *get,nodeNumAll,node,0,count     ! 获取总结点数目
    *get,nd,node,0,num,min           ! 获取结点最小编号
    *dim,nodeInfo2,array,nodeNumAll,1 ! 定义数组,nodeNumAll行5列
    *do,i,1,nodeNumAll,1             ! 遍历nodeNumAll次,每次i=i+1
        *get,nodesum,node,nd,u,sum   ! 提取节点的和位移
        nodeInfo2(i,1)=nodesum  
        nd=ndnext(nd)                ! 取得当前选择集中大于nd的下一个节点编号
    *enddo
    
    *create,dw62,mac       ! 创建宏文件
    *cfopen,node_displacement8,txt
    *vwrite,nodeInfo2(1,1)      !写出信息到文件
    (F25.10)
    *cfclose
    *end                   !结束宏文件的创建
    dw62                   !运行宏文件

    输出单元信息

    ! 输出单元信息 solid45:8个结点
    /post1
    allsel
    *get,elemNumAll,elem,0,count     ! 获取总结点数目
    *get,ed,elem,0,num,min           ! 获取结点最小编号
    *dim,elemInfo,array,elemNumAll,9 ! 定义数组,nodeNumAll行5列
    *do,i,1,elemNumAll,1             ! 遍历nodeNumAll次,每次i=i+1
        elemInfo(i,1)=ed
        *get,node1,elem,ed,node,1          !获取单元的8个结点
        *get,node2,elem,ed,node,2
        *get,node3,elem,ed,node,3
        *get,node4,elem,ed,node,4
        *get,node5,elem,ed,node,5         
        *get,node6,elem,ed,node,6
        *get,node7,elem,ed,node,7
        *get,node8,elem,ed,node,8
        elemInfo(i,2)=node1
        elemInfo(i,3)=node2
        elemInfo(i,4)=node3
        elemInfo(i,5)=node4 
        elemInfo(i,6)=node5
        elemInfo(i,7)=node6
        elemInfo(i,8)=node7
        elemInfo(i,9)=node8
        ed=elnext(ed)                ! 取得当前选择集中大于ed的下一个单元编号
    *enddo
    
    *create,dw63,mac       ! 创建宏文件
    *cfopen,Struc_Element,txt  ! 打开文件
    *vwrite,elemInfo(1,2),elemInfo(1,3),elemInfo(1,4),elemInfo(1,5),elemInfo(1,6),elemInfo(1,7),elemInfo(1,8),elemInfo(1,9)       !写出信息到文件
    %10I %10I %10I %10I %10I %10I %10I %10I
    !上面一行可以没有空格,但是不能写5%10I,也不能写注释
    *cfclose               ! 关闭文件
    *end                   ! 结束宏文件的创建
    dw63                   ! 运行宏文件

    绘制和位移云图-应力云图

    /post1
    plnsol,u,sum,0,1.0    ! 绘制和位移云图
    plnsol,s,eqv,0,1.0    ! 绘制等效应力云图

    输出结构的刚度矩阵

    ! 施加荷载
    finish $ /solu $ allsel
    omega,  , ,1324
    ! 输出结构刚度矩阵(无约束时为原始刚度矩阵)
    finish $ /solu $wrfull,1 $ solve
    finish $ /aux2
    file,hbfile,full
    hbmat,Section01,txt,,ascii,stiff,yes,yes
    finish

    查看结点位置

    eplot
    nsel,s,,,622
    /pnum,node,1

    分割字符串-子字符串-合并字符串

    cdbName = 'model_0521_tetra.cdb'
    !----------------------------------
    fileName = cdbName
    NLoc = strpos(fileName,'.')
    FileNameOnly =  strsub(fileName,1,NLoc-1)
    suffix = strsub(fileName,NLoc+1,NLoc+3)
    /INPUT,FileNameOnly,suffix
    !----------------------------------
     strpos strsub strcat

    云图中显示单元边界线

    /post1
    /edge,,1

    写一个数值到文件

    *create,dw518,mac
    *cfopen,StressMax,py
    *vwrite,maxValue
    (G25.10)
    *cfclos
    *end
    dw518

    写一个向量到文件

    *DIM,valueArr,ARRAY,3,1
    valueArr(1) = 1
    valueArr(2) = 2.0
    valueArr(3) = 3.444
    
    *create,dw518,mac
    *cfopen,fileOut,txt
    *vwrite,valueArr(1)
    (3F25.10)
    *cfclos
    *end
    dw518

    求一个向量最大值

    !!! 判断数组元素最大值 【gt:大于】【eq:等于】【LT:等于】【ge:大于或等于】
    maxValue = Map_NodeNo(1,1)
    *do,i,2,243
      *if,maxValue,LT,Map_NodeNo(1,i),then  
         maxValue=Map_NodeNo(1,i)
      *endif
    *enddo

    更改文件名 /filname

    /filname,xdd001,1   !!! 1:LOG, .ERR,等文件也改名

    逻辑语句

    !!! Oper1: EQ  NE  LT(<)  GT  LE(<=)  GE  ABLT
    *if, VAL1, Oper1, VAL2, then
    	...
    *endif
    
    *do, Par, IVAL, FVAL, INC  !!! 起始 终止 增量
    *enddo

    提取模态到数组并写出txt

    !!! 提取模态存到数组
    nFrep = 6
    *dim,valueArr,ARRAY,nFrep,1
    *do, ii, 1, nFrep, 1  !!! start end iter
    	set,1,ii
    	*GET,ff, active, 0, set, freq
    	valueArr(ii,1) = ff
    *enddo
    
    !!! 写出一列数组到txt文件
    *create,dw518,mac
    *cfopen,fileOut,txt
    *vwrite,valueArr(1)
    (F25.10)
    *cfclos
    *end
    dw518

    在经典界面导出cdb

    !!! 导入Hypermesh的cdb到经典界面再导出cdb到workbench
    finish
    /filname,GuTong_360
    /clear
    /input,'D:Work_ShangFaMesh_JianHua_GuTong_360',cdb
    cdwrite,all,GuTong_360,cdb   ! 输出荷载相关文件,旋转角速度,参考温度等

    APDL绘制坎贝尔图Campbell

    !!! 考虑预应力
    
    ! *** prestress modal analysis in rotation
    nbstep = 5
    dspin = spin/(nbstep-1)
    *dim,spins,,nbstep
    *vfill,spins,ramp,0.,dspin
    spins(1) = 0.1     ! non zero to ease the Campbell diagram sorting
     
    *do,iloop,1,nbstep
    
       /solu
       antype,static               ! Perform Static analysis.
       rescontrol,linear           ! Enable file writing for a subsequent linear perturbation
       coriolis,off                ! Coriolis effect is OFF 
       omega,,,spins(iloop)
       campbell,rstp               ! Campbell for LP modal
       solve
       fini
    
       /solu
       antype,static, restart,,,perturb ! Perform a static restart with 
                                        ! perturbation from the last load step and 
                                        ! substep of the previous static solve
       perturb, modal,,, INERKEEP       ! Set the analysis options for perturbed 
                                        ! modal analysis
       coriolis,on,,,on                 ! Coriolis effect is ON in stationary 
                                        ! reference frame
       solve, elform                    ! Reform element matrices
       
       modopt,qrdamp,10,,,on
       mxpand,10
       omega,,,spins(iloop)
       solve
       fini
    *enddo
    
    ! *** Campbell diagram
    /post1
    file,,rstp
    plcamp,on,3
    !prcamp
    finish
    
    /post1
    file,,rstp
    set,list

    关于Coriolis与Damp的资料

    1. 《5.8. Example Rotating Cyclic Symmetry Modal Analysis with Coriolis Effects》

    本案例介绍了在循环对称模型中,不同转速对固有频率的影响。

    1. 《5.7. Example Damped Modal Cyclic Symmetry Analysis》

    本案例有阻尼,没有Coriolis Effects

    1. 科里奥利力 - 维基百科,自由的百科全书

    https://zh.wikipedia.org/wiki/%E7%A7%91%E9%87%8C%E5%A5%A5%E5%88%A9%E5%8A%9B

    1. 《7.3. Example: Campbell Diagram Analysis of a Prestressed Structure Using the Linear Perturbation Procedure》

    本案例介绍了旋转结构预应力模态分析,考虑了旋转软化

    1. Coriolis命令的帮助手册页面有关于陀螺效应的描述

    转载仅为学习,不会商用。
    欢迎转载原创,附文链接。
  • 相关阅读:
    邻接表怎么写
    hiho一下 第二十五周(SPFA)
    hdu 1426 Sudoku Killer(DFS)
    hdu5147 (sequence 2) 树状数组
    hdu1233 prim
    输入输出外挂
    RMQ-ST求区间最值
    最近公共祖先(简单版)
    【Java】【20】后台发送GET/POST方法
    【实战问题】【11】导入Maven项目后报错,Project configuration is not up-to-date with pom.xml. Run project configuration update
  • 原文地址:https://www.cnblogs.com/xdd1997/p/15230627.html
Copyright © 2011-2022 走看看