Applied Continuum Mechanics with Abaqus

Introduction

The Abaqus Scripting Interface is an application programming interface (API) to the models and data used by Abaqus. The Abaqus Scripting Interface is an extension of the Python object-oriented programming language. Abaqus Scripting Interface scripts are Python scripts.

The Abaqus Scripting Interface can be used to do the following:
• Create and modify the components of an Abaqus model, such as parts, materials, loads, and steps.
• Create, modify, and submit Abaqus analysis jobs.
• Read from and write to an Abaqus output database.
• View the results of an analysis.
• automate tasks, customize simulations, and efficiently handle large or repetitive workflows

Abaqus Scripting Interface commands and Abaqus/CAE.

How to run commands

Abaqus Scripting Interface commands can be issued to the Abaqus/CAE kernel from one of the following:

• The graphical user interface (GUI)
• The command line interface (CLI
• The file called a script.

The following methods can be used to run a script:

• Running a script using command, run a script at the beginning of the Abaqus/CAE session by typing the following command:

abaqus cae script=myscript.py

or without the Abaqus/CAE GUI by typing the following command:

abaqus cae noGUI=myscript.py

Running a script without the Abaqus/CAE GUI is useful for automating pre- or postanalysis processing tasks without the added expense of running a display.

• Running a script from the startup screen. When you start an Abaqus/CAE session, Abaqus displays the startup screen. You can run a script from the startup screen by clicking Run Script.

• Running a script from the File menu by selecting File->Run Script from the main menu bar.

• Running a script instructions from the command line interface

Scripts can be run from the command line interface.

The python script can be run from the command line interface (CLI) by typing the following command:

execfile('myscript.py')

Python programming language

Python programming language is known for its simplicity, readability, and versatility.

• Data types: Integers, Floats, Strings, Lists, Tuples, Dictionaries, Sets
• Control structures: Loops, if statements, functions
• Object-oriented programming: classes, methods, attributes

Python's extensive standard library simplifies common programming tasks, offering modules for file I/O, regular expressions, math functions, matrix and array operations.

The Abaqus object model

These Abaqus Scripting Interface objects extend Python with new types of objects. The hierarchy and the relationship between these objects is called the Abaqus object model.

An object in the object model can be one of the following:

• Container - is an object that contains objects of a similar type. A container in the Abaqus object model can be either a repository or a sequence.

As with dictionaries, you can refer to an object in a repository using its key. The key is typically the name you provided in the constructor command when the object was created.

• Singular object - contains no other objects of a similar type

The structure of the objects under the Model object.

Importing modules to extend the object model

To access the objects referred to by the Model object, such as Part and Section objects, Abaqus/CAE extends or augments the object model by importing additional modules. For example, to create or access a Part object, Abaqus/CAE needs to import the part module. Abaqus/CAE imports all the modules when you start a session. As a result the entire object model is available to your scripts.

Module Abaqus/CAE functionality
assembly The Assembly module
datum The Datum toolset
interaction The Interaction module
job The Job module
load The Load module
material Materials in the Property module
mesh The Mesh module
part The Part module
partition The Partition toolset
section Sections in the Property module
sketch The Sketch module
step The Step module
visualization The Visualization module
xyPlot The X–Y toolset
The relationship between some of the modules in the Abaqus Scripting Interface and the functionality of the modules and toolsets found in Abaqus/CAE

First script

Programming with the Abaqus Scripting Interface is straightforward and logical. In the first step we need to import modulus.
Including these lines will import some of the Abaqus modulus.

from part import *
from material import *
from section import *
from assembly import *
from step import *
from interaction import *
from load import *
from mesh import *
from job import *
from sketch import *
from visualization import *
from connectorBehavior import *

Model object

model = mdb.models["Model-1"]

Create sketch

sketch = model.ConstrainedSketch(name="profile", sheetSize=20.0)
sketch.rectangle(point1=(-5.0, -1.0),point2=(5.0, 1.0))

Create part

part = model.Part(dimensionality=THREE_D, name='Part-1', type=DEFORMABLE_BODY)
part.BaseSolidExtrude(depth=0.2, sketch=sketch)

Create material

material = model.Material(name='Material-1')
material.Elastic(table=((200e9, 0.3), ))

Create section

model.HomogeneousSolidSection(material='Material-1', name='Section-1')

Section assigment

#create set
cells = part.Set(cells=part.cells, name='Set-1')
part.SectionAssignment(region=cells, sectionName='Section-1')

Create assembly coordinate system

assembly = model.rootAssembly
assembly.DatumCsysByDefault(CARTESIAN)

Create instance of the part

instance = assembly.Instance(dependent=OFF, name='Part-1-1', part=part)

Create step

model.StaticStep(name='Step-1', previous='Initial')

Create displacement boundary condtions

#create set
df = assembly.Set(faces=instance.faces.getSequenceFromMask(('[#1 ]',),), name='Set-1')
model.DisplacementBC(createStepName='Initial', name='BC-1', region=df, 
    u1=SET, u2=SET, u3=SET, ur1=UNSET, ur2=UNSET, ur3=UNSET)

Create load (pressure)

#surface
surface = assembly.Surface(name='Surf-1', side1Faces=instance.faces.getSequenceFromMask(('[#20 ]', ),))
model.Pressure(createStepName='Step-1', magnitude=1e6, name='Load-1',region=surface)

Create mesh

assembly.seedPartInstance(regions=(instance, ), size=1)
assembly.generateMesh(regions=(instance,))

Create job and run it

job = mdb.Job(model='Model-1', name='Job-1')
jub.submit()

Useful methods for creating the Sets and Surfaced based on edges, faces and cells.

• This method returns the object or objects in the CellArray located at the given coordinates.

findAt(coordinates)

• This method returns an array of objects that lie within the specified bounding cylinder.

getByBoundingCylinder(center1, center2, radius)

• This method returns an array of objects that lie within the specified bounding sphere.

getByBoundingSphere(center, radius)

• This method returns an array of objects that lie within the specified bounding box.

getByBoundingBox(xMin yMin, zMin, xMax, yMax, zMax)

Example

Composite material with spherical inclusions

(a) Composite material - unix box, (b) Matrix, (c) Spherical inclusions.

The developed example script can be downloaded at: