Abaqus provides a very powerful Python scripting interface. Every operation in Abaqus/CAE GUI has its corresponding Python command. By utilizing scripting interface, one can do tasks that can never be imagined by simply using GUI interface. I have been using Python scripting interface myself for several research projects. From my personal experience, I found at least the following advantages.
- Automate repetitive tasks. E.g. create a commonly used material library (I have created a small material library for my research in stretchable electronics systems).
- Parametric study. With a simple “for” statement, one can easily run a series of simulations of similar structures and extract the results automatically.
- Better understanding of data structures in Abaqus. At least for me, I know better how geometries/elements are organized in Abaqus from my experience of using Python scripting interface.
This post is NOT meant to be an introductory tutorial for writing Abaqus Python scripts. The Abaqus Scripting User’s Guide in Abaqus documentation is a good introductory guide. Instead, this post is supposed to be a useful template for building Python scripts.
1 2 3 4 5 6 7 8 9 10 11 # Abaqus/CAE Import from abaqus import * from abaqusConstants import * from caeModules import * # Abaqus/Viewer Import from odbAccess import * # Math Libraries import math import numpy as np
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 currentModel = mdb.models.values() # Create Material newMaterial = currentModel.Material(name='NewMaterial') # Density density = 1E3 currentModel.materials['NewMaterial'].Density(table=(( density, ), )) # Elasticity youngs = 1E6 poisson = 0.3 currentModel.materials['NewMaterial'].Elastic(table=(( youngs, poisson), )) # Hyper-Elasticity (Monney Rivilin Model) youngs = 1E6 poisson = 0.3 Hyper_C10=youngs/(5*(1+poisson)) Hyper_C01=youngs/(20*(1+poisson)) Hyper_D1 =6*(1-2*poisson)/youngs currentModel.materials['NewMaterial'].Hyperelastic(materialType=ISOTROPIC, testData=OFF, type=MOONEY_RIVLIN, volumetricResponse=VOLUMETRIC_DATA, table=(( Hyper_C10, Hyper_C01, Hyper_D1), ))
2D Plane Strain/Stress Part
3D Shell Part