By Anarkia333 |
2011
747

Python scripts let you accomplish tasks in Abaqus that would be time consuming or practically impossible in the GUI (Abaqus/CAE). Using a script you can automate a repetitive task, vary parameters of a simulation as part of an optimization study, extract information from large output databases, and can even create user interfaces that customize the look and feel of Abaqus, hiding parts of the interface from FEA illiterate team members.

However the learning curve for Python scripting is steep, and although the Abaqus documentation is comprehensive, it tends to overwhelm beginners. This is where this book fits in.

  • If you've never written a working script for Abaqus (and haven't used the Python programming language either), this book will take you from a beginner to an intermediate level.
  • If you have some previous scripting experience, but are not very confident in your abilities, this book will give you the stable foundation you need.

 

Why write Python scripts? (from the book preface)

If you plan to learn scripting in Abaqus chances are you already know why it is useful and intend to use it to accomplish some task for your analyses. But for the sake of completeness (and for those of you who are reading because your professor/boss forced you to), a few uses shall be mentioned.

Let’s assume you regularly use a few materials in all your simulations. Every time you start a new simulation in the GUI mode (Abaqus/CAE) you need to open up the materials editor and enter in material properties such as the Density, Young’s Modulus, and Poisson’s Ratio and so on for each of these materials. You could instead put all of these materials in a script. Then all you would need to do is go to File > Run Script… and your material database would be populated with these materials in a couple of seconds. Basically you would be using the script to perform a repetitive task to save time. That is the one use of a script, to perform the same task the same way multiple times with minimal effort. We will in fact look at this example of creating materials with a script in the first chapter.

A more complex use of a script is if you have a certain part on which you plan to apply loads and boundary conditions, and you wish to change the loads, constraints, or the geometry of the part itself and rerun the simulation numerous times to optimize the design. Let’s assume for example you apply a load on a horizontal cantilevered beam and you want to know how much the beam bends as you increase its length. One way to do this would be to recreate the beam part 7 or 8 times. If your simulation has complex parameters you might have to apply sections, loads and constraints to it every time. A more sophisticated and efficient way to accomplish the same task is to write a script with the length of the beam assigned to a variable. You could then change the value of this variable and rerun the script in a loop as many times as you need to. The script would redraw the beam to the new length and apply the loads and BCs in the correct regions (accounting for the change in location of loads and BCs with the geometry). While this may sound like too much work for a simple beam simulation, if you have a more complex part with multiple dimensions that are all related to each other then remodeling it several times will prove to be very time consuming and a script will be the wise choice.

An added advantage of a script is that you have your entire simulation setup saved in the form of a small readable text file only a few kilobytes in size. You can then email this text file to your coworker and all he would need to do is run this script in Abaqus. It would redraw the part, apply the materials, loads, boundary conditions, create the steps, and even create and run the job if programmed to do so. This also has the advantage of readability. If a coworker takes over your project, he does not need to navigate through the model tree to figure out how you created the complex geometry of your part file, or what points and edges you applied each load or boundary condition on. He only needs to open up the script file and it’s all clearly spelled out. And you can put comments all over the script to explain why you did what you did. It keeps things compact and easy to follow.