You are on page 1of 3

Python Scripting in ABAQUS

Kevin Maxwell Texas A&M University October 31, 2006

Introduction ABAQUS CAE provides a graphical user interface that allows the user to create finite element models that can then be analyzed in ABAQUS Standard. For every feature in CAE, there is a corresponding Python script command that the program uses when creating the model. If the language is understood well enough, an entire model can be created simply by running a script file. While one could write an entire script from scratch, ABAQUS provides several easier methods that autogenerate Python commands. When a model is created in CAE, two files are automatically created in the work directory. The replay file records every action that is performed in CAE including camera zoom/panning commands and also any mistakes that were made and then corrected. This file can be run to replay all the work that has been done on the model. The recover file records only the minimum necessary commands to recreate the model. If an error occurs and CAE closes without saving, the recover file can be run to recreate the model. When a model is saved, CAE uses the recover file to write a journal file. The journal file is a comprehensive script that shows all work saved on the model. Note that the recover file is deleted whenever the model is saved and all of its commands are transferred to the journal file. The recover and journal files provide an easy alternative to writing Python scripts from scratch. One can simply define a model in CAE and then save the Python commands from the recover or journal files as a separate script file. There are several valuable sources of information pertaining to scripting in ABAQUS. The ABAQUS Scripting Users Manual and ABAQUS Scripting Reference Manual are invaluable resources that are included in the ABAQUS documentation. The users manual gives an overview to scripting while the reference manual provides in-depth coverage of every scripting command used in ABAQUS. Another source of information can be found at . This website contains numerous resources dealing with the Python language in general. Example Templates for square and hexagonal composite fiber orientations were created using Python scripts and ABAQUS. The respective scripts create a model in ABAQUS CAE and assign a mesh to this model. The fiber volume fraction as well as the global element size can be specified. Sample meshes for both templates are given in Figure 1 and Figure 2. Note that symmetry planes were exploited in order to model of the square or hexagon.

Figure 1: Square Mesh

Figure 2: Hexagonal Mesh

The python scripts used to create these models are included below. Some of the commands were autogenerated using ABAQUS CAE and the associated recover/journal files.

However, most of the commands were written from scratch in Notepad++, a free text editor with multi-language support. The use of scripting made the definition of the model geometry much easier to define as well as allowing the parameterization of the fiber size and mesh. The mesh was developed so that the elements are most uniform along the fiber matrix interface. To accomplish this, a small square partition in the lower left of the model and a circular partition with radius greater than the fiber radius were added to the mesh. These partitions can be seen in Figure 1 and Figure 2. It should be noted that time constraints did not allow the meshes for either template to be completely refined. For the square model, the user can input global element size and the number of seeds along the fiber matrix interface. For the hexagonal model, the user can input global element size, interface seed number, and number of seeds along the top edge (this number has to be specified in order to make this mesh edge symmetric). Options such as biasing the element size along different directions can be added to the script at a later date.