Quick Introduction to Abaqus Scripting Interface

Every CAE program, whether paid or free, have some sort of scripting platform for the users and this may put-off a lot people who are familiar with the Graphical User Interface (GUI). However, coding has the potential to save tonnes of time, once you know what you are doing. So, I have decided to give Abaqus users a taste of Abaqus Scripting Interface, if they have never used it.

In this example, I am using a butterfly specimen (Arcan specimen), which is normally used for mixed-mode loading tests. This specimen is mounted at a 90° angle.

Disclaimer: The material properties used are for tutorial purposes only, they do not represent the correct properties. If you choose to use the results from this example in a research study, a report or otherwise, you are fully responsible for it.

Step 1: copy and paste the code in a word editor i.e. notepad

Step 2: save the file with .py extension i.e. arcan.py

Step 3: open Abaqus/cae

Step 4: click on File Menu

Step 5: click on Run Script

Step 6: find and select the file you just saved i.e. arcan.py

Step 7: it will automatically start solving

######################## START OF CODE ######################

from abaqus import*
from abaqusConstants import*
from caeModules import*

myModel = mdb.Model(name=’Arcan’)

import part
mySketch=myModel.ConstrainedSketch(name=’Profile’,sheetSize=62.5)
mySketch.Line(point1=(0,0), point2=(0,46))
mySketch.Line(point1=(0,46), point2=(62.5,46))
mySketch.Line(point1=(62.5,46), point2=(27.42893219,7.071067812))
mySketch.ArcByCenterEnds(center=(34.5,0),point1=(24.5,0),point2=(27.42893219,7.071067812),direction=CLOCKWISE)
mySketch.Line(point1=(24.5,0), point2=(0,0))
myArcan=myModel.Part(name=’arcan_sample’,dimensionality=THREE_D,type=DEFORMABLE_BODY)
myArcan.BaseSolidExtrude(sketch=mySketch,depth=5.0)

import material
myAluminium = myModel.Material(name=’AA2219′,description=’AA2219 from matweb.com’)
elasticProperties = (68.9E3,0.33)
myAluminium.Elastic(table=(elasticProperties,))
mdb.models[‘Arcan’].materials[‘AA2219’].Plastic(table=(
(138.07, 0.00),
(152.28, 0.01),
(175.66, 0.04),
(190.40, 0.07),
(202.35, 0.10),
(210.90, 0.12),
(217.50, 0.15),
(219.48, 0.16))                 )

import section
mySection = myModel.HomogeneousSolidSection(name=’arcansection’,material=’AA2219′)
region = (myArcan.cells,)
myArcan.SectionAssignment(region=region,sectionName=’arcansection’)

import assembly
myAssembly = myModel.rootAssembly
myInstance = myAssembly.Instance(name=’arcanInstance’,part=myArcan,dependent=OFF)

import step
myModel.StaticStep(name=’Step1′,previous=’Initial’,timePeriod=1,initialInc=0.1)

import load
endFaceCenter = (10,0,2.5)
endFace = myInstance.faces.findAt((endFaceCenter,))
endRegion = (endFace,)
myModel.DisplacementBC(name=’Fixed’,createStepName=’Step1′,region=endRegion,u1=0.0,u2=0.0,u3=0.0)
topFaceCenter=(30,46,2.5)
topFace = myInstance.faces.findAt((topFaceCenter,))
topSurface = ((topFace,SIDE1),)
myModel.Pressure(name=’Pressure’,createStepName=’Step1′,region=topSurface,magnitude=-20)

import mesh
region=(myInstance.cells,)
elemType=mesh.ElemType(elemCode=C3D20R,elemLibrary=STANDARD)
myAssembly.setElementType(regions=region,elemTypes=(elemType,))
myAssembly.seedPartInstance(regions=(myInstance,),size=4.0)
myAssembly.generateMesh(regions=(myInstance,))

import job
jobName=’quarter_90_deg’
myJob=mdb.Job(name=jobName,model=’Arcan’)
myJob.submit()
myJob.waitForCompletion()

######################## END OF CODE ######################

How’s this useful?

Let’s assume that you have undertaken a study project relating to the effects of mixed-mode loadings (Mode I/II) on a 5mm thick AA2219 plate. Your objectives are to simulate the Arcan specimen and calculate the stress/strain curves at 10 different angles.

The time it will take to do each setup with GUI and the hard disk space it will use per simulation is tremendous. You are looking at 20 different analyses for this study, 10 for each mode type.

With the code provided in this post, you can copy and paste this code 20 times and save it as 20 different files. That will still take less than a megabyte of hard disk space. Than you can change the ‘import load’ section values to the calculated values with respect to angle and mode. Then figure out which face, edge or vertex you will place your load on and enter the magnitude values in each cartesian direction.

Doing is learning, so play around with the code and see what impacts you have on the results. Also, try changing the model to a cantilevered beam, that way you can check your answers with the hand calculations.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s