The command line arguments provide the following:
Use the following command to retrieve the example script: abaqus fetch job=odbPert # Abaqus Scripting Interface version of FPERT, a Fortran
# program to create a perturbed mesh from original coordinate
# data and eigenvectors. FPERT is described in the Abaqus Example
# Problems Manual.
import sys
from odbAccess import *
from types import IntType
# Get input from the user
odbName = raw_input('Enter odb name (w/o .odb): ')
modes = eval(raw_input('Enter mode shape(s): '))
if type(modes) is IntType:
modes = (modes,)
odb = openOdb(odbName + '.odb')
# Get the undeformed coordinates from the first
# step and frame
step = odb.steps.values()[0]
try:
coords = step.frames[0].fieldOutputs['COORD']
except:
err = "The analysis must include a field output request \
for variable COORD."
print err
sys.exit(1)
# Perturb the nodal coordinates
factors = []
for mode in modes:
try:
frame = step.frames[mode]
except IndexError:
print 'Input error: mode %s does not exist' % mode
sys.exit(1)
factors.append(float(raw_input(
'Enter imperfection factor for mode %s: '% mode)))
coords = coords + factors[-1] * frame.fieldOutputs['U']
# Write new nodal coordinates to a file
outFile = open(odbName + '_perturbed.inp', 'w')
header = \
"""
*******************************************************
** Node data for perturbed mesh.
** Input mesh from: %s
** Mode shapes used: %s
** Imperfection factors used: %s
*******************************************************
"""
outFile.write(header % (odbName, modes, factors))
format = '%6i, %14.7e, %14.7e, %14.7e\n'
for value in coords.values:
outFile.write(
format % ((value.nodeLabel,) + tuple(value.data)))
outFile.write('** End of perturbed mesh node input file.')
outFile.close()
|