Creating a new load combination from different load cases

This example illustrates how you can use the frame operators to create a new load combination from existing load cases. The example script does the following:

  • Retrieves the information describing the new load combination from the command line.

  • Retrieves the frames for each load case.

  • Computes the new stresses and displacements.

  • Saves data computed to the output database as a new load combination.

The command line arguments provide the following:

  • odbName: The output database file name.

  • stepName: The name of the step containing the load cases.

  • loadCaseNames: The load case names.

  • scaling: The scale factors to apply to each load case.

Use the following command to retrieve the example script:

abaqus fetch job=createLoadComb

The fetch command also retrieves an input file that you can use to generate an output database that can be read by the example script.


import types
from odbAccess import *

# retrieve request from user
odbName = raw_input('Enter odb name')
stepName = raw_input('Enter step name')

loadCaseNames = eval(raw_input( \
    'Enter new load case as: \
    [\'loadCase1Name\', ..., \'loadCaseNName\']'))
if type(loadCaseNames) == types.TupleType:
    loadCaseNames = list(loadCaseNames)
lcName = raw_input('Enter new load case name')
scaling = eval(raw_input( \
    'Enter new load case as:(scaleFactor1, .., scaleFactorN)'))

odb = openOdb(odbName)
step = odb.steps[stepName]

# compute new load case
newStress = 0
newDisp = 0

for loadCaseName in loadCaseNames:
    frame = step.getFrame(loadCase=step.loadCases[loadCaseName])
    scaleFac = scaling[loadCaseNames.index(frame.loadCase.name)]
    newStress = newStress + scaleFac*frame.fieldOutputs['S'] 
    newDisp = newDisp + scaleFac*frame.fieldOutputs['U']

# save new load case to odb
lcNew = step.LoadCase(name=lcName)
newFrame = step.Frame(loadCase=lcNew)
newFrame.FieldOutput(field=newStress, name='S')
newFrame.FieldOutput(name='U', field=newDisp)

odb.save()
odb.close()