KEMBAR78
Ansys command file creation and execution | PDF
ANSYS Command File Creation and Execution                                                    http://www.mece.ualberta.ca/tutorials/ansys/CL/Create.html



                                      ANSYS           BASIC        INTERMEDIATE     ADVANCED        POSTPROC.        COMMAND         PRINTABLE
            UofA ANSYS Tutorial
                                     UTILITIES      TUTORIALS        TUTORIALS      TUTORIALS       TUTORIALS        LINE FILES       VERSION


               Creating Files

                 Features
                                    ANSYS Command File Creation and Execution
               Basic Tutorials
                                    Generating the Command File
           Intermediate Tutorials

            Advanced Tutorials
                                    There are two choices to generate the command file:

             PostProc Tutorials        1. Directly type in the commands into a text file from scratch. This assumes a good knowledge of the
                                          ANSYS command language and the associated options.
                 Radiation

                                          If you know what some of the commands and are unsure of others, execute the desired operation
                                          from the GUI and then go to File -> List -> Log File. This will then open up a new window
                   Index                  showing the command line equivialent of all commands entered to this point. You may directly
                                          cut and paste from here to a text editor, or if you'd like to save the whole file, see the next item in
                                          this list.
               Contributions
                                       2. Setup and solve the problem as you normally would using the ANSYS graphic user interface
                 Comments
                                          (GUI). Then before you are finished, enter the command File -> Save DB Log File This saves
                 MecE 563                 the equivalent ANSYS commands that you entered in the GUI mode, to a text file. You can now
                                          edit this file with a text editor to clean it up, delete errors from your GUI use and make changes as
          Mechanical Engineering          desired.
            University of Alberta

                                    Running the Command File
                ANSYS Inc.          To run the ANSYS command file,

                                          save the ASCII text commands in a text file; e.g. frame.cmd
                                          start up either the GUI or text mode of ANSYS
           Copyright © 2001
          University of Alberta     GUI Command File Loading
                                    To run this command file from the GUI, you would do the following:

                                          From the File menu, select Read Input from.... Change to the appropriate directory where
                                          the file (frame.cmd) is stored and select it.
                                          Now ANSYS will execute the commands from that file. The output window shows the progress of
                                          this procedure. Any errors and warnings will be listed in this window.
                                          When it is complete, you may not have a full view of your structure in the graphic window. You
                                          may need to select Plot -> Elements or Plot -> Lines or what have you.
                                          Assuming that the analysis worked properly, you can now use the post-processor to view element
                                          deflections, stress, etc.
                                          If you want to fix some errors or make some changes to the command file, make those changes in
                                          a separate window in a text editor. Save those changes to disk.
                                          To rerun the command file, you should first of all clear the current model from ANSYS. Select
                                          File -> Clear & Start New.
                                          Then read in the file as before File -> Read Input from...

                                    Command Line File Loading

                                    Alternatively, you can also read in the command file right from the ANSYS command line. Assuming
                                    that you started ANSYS using the commands...
                                       /ansys52/bin/ansysu52

                                    and then entered
                                       /show,x11c




1 of 4                                                                                                                                10/11/2011 3:36 PM
ANSYS Command File Creation and Execution                                                   http://www.mece.ualberta.ca/tutorials/ansys/CL/Create.html



                                 This has now started ANSYS in the text mode and has told it what graphic device to use (in this case an
                                 X Windows, X11c, mode). At this point you could type in /menu,on, but you might not want to turn on
                                 the full graphic mode if working on a slow machine or if you are executing the program remotely. Let's
                                 assume that we don't turn the menu mode on...

                                 If the command file is in the current directory for ANSYS, then from the ANSYS input window, type
                                    /input,frame,cmd

                                 and yes that is a comma (,) between frame and cmd. If ANSYS can not find the file in the current
                                 directory, you may need to point it to the proper directory. If the file was in the directory, /myfiles
                                 /ansys/frame for example, you would use the following syntax

                                    /input,frame,cmd,/myfiles/ansys/frame

                                 If you want to rerun a new or modified file, it is necessary to clear the current model in memory with
                                 the command
                                    /clear,start

                                 This full procedure of loading in command files and clearing jobs and starting over again can be
                                 completed as many times as desired.

                                 ANSYS Command Groupings
                                 ANSYS contains hundreds of commands for generating geometry, applying loads and constraints, setting
                                 up different analysis types and post-processing. The following is only a brief summary of some of the
                                 more common commands used for structural analysis.

                                    Category      Command             Description                                   Syntax
                                  Basic
                                                  k            keypoint definition            k,kp#,xcoord,ycoord,zcoord
                                  Geometry
                                                  l            straight line creation         l,kp1,kp2
                                                               circular arc line              larc,kp1,kp2,kp3,rad
                                                  larc
                                                               (from keypoints)               (kp3 defines plane)
                                                               circular line creation
                                                  circle                                      see online help
                                                               (creates keypoints)
                                                               spline line through
                                                  spline                                      spline,kp1,kp2, ... kp6
                                                               keypoints
                                                               area definition from
                                                  a                                           a,kp1,kp2, ... kp18
                                                               keypoints
                                                  al           area definition from lines     a,l1,l2, ... l10
                                                               volume definition from
                                                  v                                           v,kp1,kp2, ... kp8
                                                               keypoints
                                                               volume definition from
                                                  va                                          va,a1,a2, ... a10
                                                               areas
                                                               create volume from area
                                                  vext                                        see online help
                                                               extrusion
                                                               create volume by dragging
                                                  vdrag                                  see online help
                                                               area along path
                                  Solid
                                  Modeling        rectng       rectangle creation             rectng,x1,x2,y1,y2
                                  (Primitives)
                                                  block        block volume creation          block,x1,x2,y1,y2,z1,z2




2 of 4                                                                                                                           10/11/2011 3:36 PM
ANSYS Command File Creation and Execution                                            http://www.mece.ualberta.ca/tutorials/ansys/CL/Create.html



                                                        cylindrical volume
                                               cylind                                  cylind,rad1,rad2,z1,z2,theta1,theta2
                                                        creation
                                               sphere   spherical volume creation      sphere,rad1,rad2,theta1,theta2
                                               prism
                                                        various volume creation
                                               cone                                    see online help
                                                        commands
                                               torus
                                  Boolean               adds separate areas to
                                               aadd                                    aadd,a1,a2, ... a9
                                  Operations            create single area
                                                        creates new areas by
                                                        glueing
                                               aglue                                   aglue,a1,a2, ... a9
                                                        (properties remain
                                                        separate)
                                                        creat new area by area
                                               asba                                    asba,a1,a2
                                                        substraction
                                                        create new area by area
                                               aina                                    aina,a1,a2, ... a9
                                                        intersection
                                               vadd
                                               vlgue
                                                        volume boolean operations see online help
                                               vsbv
                                               vinv
                                                                                       et,number,type
                                  Elements &
                                               et       defines element type           may define as many as required; current type
                                  Meshing
                                                                                       is set by type
                                                        set current element type
                                               type                                    type,number
                                                        pointer
                                                                                       r,number,r1,r2, ... r6
                                                        define real constants for
                                               r                                       may define as many as required; current type
                                                        elements
                                                                                       is set by real
                                                        sets current real constant
                                               real                                    real,number
                                                        pointer
                                                                                     mp,label,number,c0,c1, ... c4
                                                        sets material properties for
                                               mp                                    may define as many as required; current type
                                                        elements
                                                                                     is set by mat
                                                        sets current material
                                               mat                                     mat,number
                                                        property pointer
                                                        sets size or number of         esize,size,ndivs
                                               esize
                                                        divisions on lines             use either size or ndivs
                                               eshape   controls element shape         see online help
                                                                                       lmesh,line1,line2,inc
                                               lmesh    mesh line(s)
                                                                                       or lmesh,all
                                                                                       amesh,area1,area2,inc
                                               amesh    mesh area(s)
                                                                                       or amesh,all
                                                                                       vmesh,vol1,vol2,inc
                                               vmesh    mesh volume(s)
                                                                                       or vmesh,all
                                  Sets &                select a subset of
                                               ksel                                    see online help
                                  Selection             keypoints
                                               nsel     select a subset of nodes       see online help
                                               lsel     select a subjset of lines      see online help
                                               asel     select a subset of areas       see online help



3 of 4                                                                                                                        10/11/2011 3:36 PM
ANSYS Command File Creation and Execution                                            http://www.mece.ualberta.ca/tutorials/ansys/CL/Create.html



                                                         select nodes within
                                                nsla                                   see online help
                                                         selected area(s)
                                                         select everything
                                                allsel                                 allsel
                                                         i.e. reset selection
                                                         defines a DOF constraint      dk,kp#,label,value
                                  Constraints   dk
                                                         on a keypoint                 labels: UX,UY,UZ,ROTX,ROTY,ROTZ,ALL
                                                         defines a DOF constraint      d,node#,label,value
                                                d
                                                         on a node                     labels: UX,UY,UZ,ROTX,ROTY,ROTZ,ALL
                                                                                       dl,line#,area#,label
                                                         defines (anti)symmetry
                                                dl                                     labels: SYMM (symmetry); ASYM
                                                         DOF constraints on a line
                                                                                       (antisymmetry)
                                                                                       fk,kp#,label,value
                                  Loads         fk       defines a
                                                                                       labels: FX,FY,FZ,MX,MY,MZ
                                                                                       f,node#,label,value
                                                f        defines a force at a node
                                                                                       labels: FX,FY,FZ,MX,MY,MZ




4 of 4                                                                                                                    10/11/2011 3:36 PM

Ansys command file creation and execution

  • 1.
    ANSYS Command FileCreation and Execution http://www.mece.ualberta.ca/tutorials/ansys/CL/Create.html ANSYS BASIC INTERMEDIATE ADVANCED POSTPROC. COMMAND PRINTABLE UofA ANSYS Tutorial UTILITIES TUTORIALS TUTORIALS TUTORIALS TUTORIALS LINE FILES VERSION Creating Files Features ANSYS Command File Creation and Execution Basic Tutorials Generating the Command File Intermediate Tutorials Advanced Tutorials There are two choices to generate the command file: PostProc Tutorials 1. Directly type in the commands into a text file from scratch. This assumes a good knowledge of the ANSYS command language and the associated options. Radiation If you know what some of the commands and are unsure of others, execute the desired operation from the GUI and then go to File -> List -> Log File. This will then open up a new window Index showing the command line equivialent of all commands entered to this point. You may directly cut and paste from here to a text editor, or if you'd like to save the whole file, see the next item in this list. Contributions 2. Setup and solve the problem as you normally would using the ANSYS graphic user interface Comments (GUI). Then before you are finished, enter the command File -> Save DB Log File This saves MecE 563 the equivalent ANSYS commands that you entered in the GUI mode, to a text file. You can now edit this file with a text editor to clean it up, delete errors from your GUI use and make changes as Mechanical Engineering desired. University of Alberta Running the Command File ANSYS Inc. To run the ANSYS command file, save the ASCII text commands in a text file; e.g. frame.cmd start up either the GUI or text mode of ANSYS Copyright © 2001 University of Alberta GUI Command File Loading To run this command file from the GUI, you would do the following: From the File menu, select Read Input from.... Change to the appropriate directory where the file (frame.cmd) is stored and select it. Now ANSYS will execute the commands from that file. The output window shows the progress of this procedure. Any errors and warnings will be listed in this window. When it is complete, you may not have a full view of your structure in the graphic window. You may need to select Plot -> Elements or Plot -> Lines or what have you. Assuming that the analysis worked properly, you can now use the post-processor to view element deflections, stress, etc. If you want to fix some errors or make some changes to the command file, make those changes in a separate window in a text editor. Save those changes to disk. To rerun the command file, you should first of all clear the current model from ANSYS. Select File -> Clear & Start New. Then read in the file as before File -> Read Input from... Command Line File Loading Alternatively, you can also read in the command file right from the ANSYS command line. Assuming that you started ANSYS using the commands... /ansys52/bin/ansysu52 and then entered /show,x11c 1 of 4 10/11/2011 3:36 PM
  • 2.
    ANSYS Command FileCreation and Execution http://www.mece.ualberta.ca/tutorials/ansys/CL/Create.html This has now started ANSYS in the text mode and has told it what graphic device to use (in this case an X Windows, X11c, mode). At this point you could type in /menu,on, but you might not want to turn on the full graphic mode if working on a slow machine or if you are executing the program remotely. Let's assume that we don't turn the menu mode on... If the command file is in the current directory for ANSYS, then from the ANSYS input window, type /input,frame,cmd and yes that is a comma (,) between frame and cmd. If ANSYS can not find the file in the current directory, you may need to point it to the proper directory. If the file was in the directory, /myfiles /ansys/frame for example, you would use the following syntax /input,frame,cmd,/myfiles/ansys/frame If you want to rerun a new or modified file, it is necessary to clear the current model in memory with the command /clear,start This full procedure of loading in command files and clearing jobs and starting over again can be completed as many times as desired. ANSYS Command Groupings ANSYS contains hundreds of commands for generating geometry, applying loads and constraints, setting up different analysis types and post-processing. The following is only a brief summary of some of the more common commands used for structural analysis. Category Command Description Syntax Basic k keypoint definition k,kp#,xcoord,ycoord,zcoord Geometry l straight line creation l,kp1,kp2 circular arc line larc,kp1,kp2,kp3,rad larc (from keypoints) (kp3 defines plane) circular line creation circle see online help (creates keypoints) spline line through spline spline,kp1,kp2, ... kp6 keypoints area definition from a a,kp1,kp2, ... kp18 keypoints al area definition from lines a,l1,l2, ... l10 volume definition from v v,kp1,kp2, ... kp8 keypoints volume definition from va va,a1,a2, ... a10 areas create volume from area vext see online help extrusion create volume by dragging vdrag see online help area along path Solid Modeling rectng rectangle creation rectng,x1,x2,y1,y2 (Primitives) block block volume creation block,x1,x2,y1,y2,z1,z2 2 of 4 10/11/2011 3:36 PM
  • 3.
    ANSYS Command FileCreation and Execution http://www.mece.ualberta.ca/tutorials/ansys/CL/Create.html cylindrical volume cylind cylind,rad1,rad2,z1,z2,theta1,theta2 creation sphere spherical volume creation sphere,rad1,rad2,theta1,theta2 prism various volume creation cone see online help commands torus Boolean adds separate areas to aadd aadd,a1,a2, ... a9 Operations create single area creates new areas by glueing aglue aglue,a1,a2, ... a9 (properties remain separate) creat new area by area asba asba,a1,a2 substraction create new area by area aina aina,a1,a2, ... a9 intersection vadd vlgue volume boolean operations see online help vsbv vinv et,number,type Elements & et defines element type may define as many as required; current type Meshing is set by type set current element type type type,number pointer r,number,r1,r2, ... r6 define real constants for r may define as many as required; current type elements is set by real sets current real constant real real,number pointer mp,label,number,c0,c1, ... c4 sets material properties for mp may define as many as required; current type elements is set by mat sets current material mat mat,number property pointer sets size or number of esize,size,ndivs esize divisions on lines use either size or ndivs eshape controls element shape see online help lmesh,line1,line2,inc lmesh mesh line(s) or lmesh,all amesh,area1,area2,inc amesh mesh area(s) or amesh,all vmesh,vol1,vol2,inc vmesh mesh volume(s) or vmesh,all Sets & select a subset of ksel see online help Selection keypoints nsel select a subset of nodes see online help lsel select a subjset of lines see online help asel select a subset of areas see online help 3 of 4 10/11/2011 3:36 PM
  • 4.
    ANSYS Command FileCreation and Execution http://www.mece.ualberta.ca/tutorials/ansys/CL/Create.html select nodes within nsla see online help selected area(s) select everything allsel allsel i.e. reset selection defines a DOF constraint dk,kp#,label,value Constraints dk on a keypoint labels: UX,UY,UZ,ROTX,ROTY,ROTZ,ALL defines a DOF constraint d,node#,label,value d on a node labels: UX,UY,UZ,ROTX,ROTY,ROTZ,ALL dl,line#,area#,label defines (anti)symmetry dl labels: SYMM (symmetry); ASYM DOF constraints on a line (antisymmetry) fk,kp#,label,value Loads fk defines a labels: FX,FY,FZ,MX,MY,MZ f,node#,label,value f defines a force at a node labels: FX,FY,FZ,MX,MY,MZ 4 of 4 10/11/2011 3:36 PM