×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Running an abaqus script without launching ABAQUS

Running an abaqus script without launching ABAQUS

Running an abaqus script without launching ABAQUS

(OP)
Hi,

I have an ABAQUS script/Macro,which I am unable to run without launching ABAQUS.

The following approach has been followed to run the ABAQUS Script,without launching GUI.
->Open ABAQUS Command line
->Change the destination there to the path of the script location.
->then I have enetered this line: "abaqus cae ScriptFile.py"

Please find my script attached below:
I am running the Mainfunction() below and rest are all sub functions,which are used in MainFunction.

def GetForceAndDisplacement(odb1,i):
DispList = []
ForceList = []
assembly = odb1.rootAssembly
elemset = assembly.elementSets['DISP_END_SET']
elementsObj = elemset.elements
for Idx in range(len(elementsObj[0])):
connecObj = elemset.elements[0][Idx].connectivity
for nds in connecObj:
xy = session.xyDataListFromField(odb=odb1, outputPosition=NODAL, variable=(('U', NODAL, ((INVARIANT, 'Magnitude'), )), ), nodeLabels=(('PART-1-1', (str(nds), )), ))
Disp = xy[0][0][1]
DispList.append(Disp)

xy2 = session.xyDataListFromField(odb=odb1, outputPosition=NODAL, variable=(('RF', NODAL, ((INVARIANT, 'Magnitude'), )), ), nodeLabels=(('PART-1-1', (str(nds), )), ))
Force = xy2[0][0][1]
ForceList.append(Force)

AvgDisp = sum(DispList)/len(DispList)
ResForce = sum(ForceList)

return AvgDisp,ResForce

def RetrieveSetStressValues(odb1,lastFrame):
SetList = []
SetList = RetrieveAllSetNames()
assembly = odb1.rootAssembly
for SetIdx in range(len(SetList)):
maximumStress = 0
elemset = assembly.elementSets[SetList[SetIdx]]
elementsObj = elemset.elements
for Idx in range(len(elementsObj[0])):
connecObj = elemset.elements[0][Idx].connectivity
for nds in connecObj:
xy = session.xyDataListFromField(odb=odb1, outputPosition=NODAL, variable=(('S', INTEGRATION_POINT, ((INVARIANT, 'Mises'), )), ), nodeLabels=(('PART-1-1', (str(nds), )), ))
Stress = xy[0][0][1]
if Stress > maximumStress:
maximumStress = Stress

if SetIdx == 0:
Set1 = maximumStress
if SetIdx == 1:
Set2 = maximumStress
if SetIdx == 2:
Set3 = maximumStress
if SetIdx == 3:
Set4 = maximumStress

return Set1,Set2,Set3,Set4


def Mainfunction():
TimeStep = []
odbNamesList = []
odbNamesList = ListODBNames()
ODBFilesList = []
StressSet1List = []
StressSet2List = []
StressSet3List = []
StressSet4List = []
DispList = []
ForceList = []
ODBFilesList = ListAllODBFiles()
for odbFileIdx in range(len(ODBFilesList)):
odb = openOdb(ODBFilesList[odbFileIdx])
session.viewports['Viewport: 1'].setValues(displayedObject=odb)
odbName=session.viewports[session.currentViewportName].odbDisplay.name
lastStep = odb.steps['Step-1']
for i in range(len(lastStep.frames)):
lastFrame = lastStep.frames[i]
Time1 = lastFrame.frameValue
session.odbData[odbName].setValues(activeFrames=(('Step-1', (i, )), ))
TimeStep.append(Time1)
AvgDisp,ResForce = GetForceAndDisplacement(odb,i)
DispList.append(AvgDisp)
ForceList.append(ResForce)
Set1,Set2,Set3,Set4 = RetrieveSetStressValues(odb,lastFrame)
StressSet1List.append(Set1)
StressSet2List.append(Set2)
StressSet3List.append(Set3)
StressSet4List.append(Set4)


I would be really glad,if I u can let me know the changes to be done,inorder to run the script through ABAQUS Command line without launching ABAQUS.

Thanks in Advance!


RE: Running an abaqus script without launching ABAQUS

When the script runs fine and without user interaction in the GUI, then you can use this command to run it also without GUI.

abaqus cae noGUI=ScriptFile.py

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources