Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Abaqus 'addData' for elements with multiple integration points

Status
Not open for further replies.

KrisHe

Mechanical
Jun 11, 2017
4
Hi,

I have the following piece of code:
Python:
from abaqus import *
from odbAccess import *
from abaqusConstants import *
import visualization
import fileinput
import os
import shutil
import numpy as np
from odbAccess import *


def tupled_list(mylist,n):
    '''group  every n elements of the list into a tuple '''    
    return list(zip(*[iter(mylist)]*n))

# Open odb
odb_filename = 'AbaqusResults.odb'
work_directory=os.getcwd()
odb_filepath = os.path.abspath(os.path.join(os.getcwd(),'..','outputs',odb_filename))

my_odb=session.openOdb(name=odb_filepath,readOnly=FALSE)

# Automate the proces of reading the step no matter what its name is
StepNames=(my_odb.steps.keys() )        
lastStep=( StepNames[-1] )              

# Automation of an instance naming (in the same way)
AllInstances = (my_odb.rootAssembly.instances.keys())
MyInstance = ( AllInstances[-1] ) 
SubmodelInstance=my_odb.rootAssembly.instances[MyInstance]

# Get dataset containing element labels and calculated quantities in here from text file
dataset = np.loadtxt(os.path.join(os.getcwd(),'AbaqusDataInput.txt'),delimiter=',')

# List of all element labels
elLabels = dataset[0,:].astype(int).tolist()

# Count the number of integration points for a single element
gausspoints = elLabels.count(1)

# Get damage data from dataset and format into a list of tuples, tuple length depends on number of integration points for eache element
damage = tupled_list(list(dataset[1,:]),gausspoints)
damage = [list(elem) for elem in damage]

# Remove duplicates from elLabel list
elLabels = list(set(elLabels))


for i in range(len(my_odb.steps[lastStep].frames)):
    new_field_damage = my_odb.steps[lastStep].frames[i].FieldOutput(name='Damage',description='Damage sustained after one repitition of the loading history', type=SCALAR)
    new_field_damage.addData(position=INTEGRATION_POINT, instance=SubmodelInstance, labels=elLabels, data=damage)


my_odb.save() 
my_odb.close()

but I get the following error:
Data at 141968 locations expected. Data at 17746 locations provided. Element data request failed. Element type is C3D20R. Data at 8 integration points per element expected
elLabels is a list with 17746 items and damage is a tuple list with 17746 items but each item has 8 values (one for each integration point) e.g. [(x,x,x,x,x,x,x,x) , (x,x,x,x,x,x,x,x), … ]

Thus I provide abaqus with 17746 element labels and 17746 * 8 locations (141968 data points in total as asked) so I don’t see why I get the error.

I have tried a list of lists instead of a list of tuples but the same error occurs. I suspect is merely an issue of using the correct datatypes but the Abaqus documentation seems severely lacking.

The script works fine for odb files with C3D8R elements which have 1 integration point. I then provide the same elLabels list and damage list but then each tuple only has 1 value (e.g. [(x, ) (x, ), … ] ) which works fine.

Do you know how I can import my data into the elements integration points?

Kris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor