Reading model data

The following list describes the objects in model data and the commands you use to read model data. Many of the objects are repositories, and you will find the keys() method useful for determining the names of the objects in the repository. For more information, see Using dictionaries and Repositories.

The root assembly

An output database contains only one root assembly. You access the root assembly through the OdbAssembly object.

myAssembly = odb.rootAssembly
Part instances

Part instances are stored in the instances repository under the OdbAssembly object. The following statements display the repository keys of the part instances in the tutorial output database:

for instanceName in odb.rootAssembly.instances.keys():
  print instanceName

The output database contains only one part instance, and the resulting output is

PART-1-1
Regions

Regions in the output database are OdbSet objects. Regions refer to the part and assembly sets stored in the output database. A part set refers to elements or nodes in an individual part and appears in each instance of the part in the assembly. An assembly set refers to the elements or nodes in part instances in the assembly. A region can be one of the following:

  • A node set

  • An element set

  • A surface

For example, the following statement displays the node sets in the OdbAssembly object:

print 'Node sets = ',odb.rootAssembly.nodeSets.keys()

The resulting output is

Node sets = ['ALL NODES']

The following statements display the node sets and the element sets in the PART-1-1 part instance:

print 'Node sets = ',odb.rootAssembly.instances[
    'PART-1-1'].nodeSets.keys()
print 'Element sets = ',odb.rootAssembly.instances[
    'PART-1-1'].elementSets.keys()

The resulting output is

Node sets =  ['ALLN', 'BOT', 'CENTER', 'N1', 'N19', 'N481',
              'N499', 'PUNCH', 'TOP']
Element sets = ['CENT', 'ETOP', 'FOAM', 'PMASS', 'UPPER']

The following statement assigns a variable (topNodeSet) to the 'TOP' node set in the PART-1-1 part instance:

topNodeSet = odb.rootAssembly.instances[
    'PART-1-1'].nodeSets['TOP']

The type of the object to which topNodeSet refers is OdbSet. After you create a variable that refers to a region, you can use the variable to refer to a subset of field output data, as described in Using regions to read a subset of field output data.

Materials

You can read material data from an output database.

Materials are stored in the materials repository under the Odb object.

Access the materials repository using the command:

    allMaterials = odb.materials
    for materialName in allMaterials.keys():
        print 'Material Name : ',materialName

To print isotropic elastic material properties in a material object:

    for material in allMaterials.values():      
        if hasattr(material,'elastic'):
            elastic = material.elastic
            if elastic.type == ISOTROPIC:
                print 'isotropic elastic behavior, type = %s' \
                % elastic.moduli
            title1 = 'Young modulus  Poisson\'s ratio  '
            title2 = ''
            if elastic.temperatureDependency == ON:
                title2 = 'Temperature  '    
            dep = elastic.dependencies
            title3 = ''
            for x in range(dep):
                title3 += ' field # %d' % x                
            print '%s %s %s' % (title1,title2,title3)
            for dataline in elastic.table:
                print dataline

Some Material definitions have suboptions. For example, to access the smoothing type used for biaxial test data specified for a hyperelastic material:

    if hasattr(material,'hyperelastic'):
        hyperelastic = material.hyperelastic
        testData = hyperelastic.testData
        if testData == ON:
            if hasattr(hyperelastic,'biaxialTestData'):
                biaxialTestData = hyperelastic.biaxialTestData  
                print 'smoothing type : ',biaxialTestData.smoothing 

Material commands describes the Material object commands in more detail.

Sections

You can read section data from an output database.

Sections are stored in the sections repository under the Odb object.

The following statements display the repository keys of the sections in an output database:

    allSections = odb.sections
    for sectionName in allSections.keys():
        print 'Section Name : ',sectionName

The Section object can be one of the various section types. The type command provides information on the section type. For example, to determine whether a section is of type homogeneous solid section and to print it's thickness and associated material name:

    for mySection in allSections.values(): 
        if type(mySection) == HomogeneousSolidSectionType:
            print 'material name = ', mySection.material
            print 'thickness = ', mySection.thickness

Similarily, to access the beam profile repository:

    allProfiles = odb.profiles.values()
    numProfiles = len(allProfiles)
    print 'Total Number of profiles in the ODB : %d' \
        % numProfiles 

The Profile object can be one of the various profile types. The type command provides information on the profile type. For example, to output the radius of all circular profiles in the odb:

    for myProfile in allProfiles:  
        if type(myProfile) == CircularProfileType:
            print 'profile name = %s, radius = %8.3f' \
                % (myProfile.name,myProfile.r) 
Section assignments

Section assignments are stored in the odbSectionAssignmentArray repository under the OdbAssembly object.

All elements in an Abaqus analysis need to be associated with section and material properties. Section assignments provide the relationship between elements in a part instance and their section properties. The section properties include the associated material name. To access the sectionAssignments repository from the PartInstance object:

    instances = odb.rootAssembly.instances
    for instance in instances.values():
        assignments = instance.sectionAssignments
        print 'Instance : ',instance.name
        for sa in assignments:
            region = sa.region
            elements = region.elements
            print '  Section : ',sa.sectionName
            print '  Elements associated with this section : '
            for e in elements:
                print '  label : ',e.label 
Analytical rigid surfaces

Analytical rigid surfaces are defined under a OdbPart object or a OdbInstance object. Each OdbPart or OdbInstance can have only one analytical rigid surface.

Rigid bodies

Rigid bodies are stored in the odbRigidBodyArray. The OdbPart object, OdbInstance object, and OdbAssembly object each have an odbRigidBodyArray.

Pretension sections

Pretension sections are stored in odbPretensionSectionArray under the OdbAssembly object.