Uncategorized

Questions about problems with extracting ODB data with ABAQUS Python Script


First of all, I apologize in advance if my English is awkward and you have trouble reading this.

I use an abaqus python script to load the odb file in the background, extract the values, capture a visualization image of those values, and save it to a specific directory.

Below is a snippet of that code, with the rpy file as a reference.

# ------------------------------------------------------------
# EXTRACT ODB DATA AND MAKE OUTPUT XML FILE
# ------------------------------------------------------------
-----------------------
# EXTRACT ODB DATA
-----------------------
odb = openOdb(path=file_name_only+".odb")

lastFrame = odb.steps['Apply Actuating'].frames[-1]
root = ET.Element("odb_data")

# 1. Rubber Maximum Elastic Strain

elastomer_region = odb.rootAssembly.instances['SEAL'].elementSets['ELASTOMER']
strain_field = lastFrame.fieldOutputs['EE']

coordSys = odb.rootAssembly.DatumCsysByThreePoints(name="sph",coordSysType=SPHERICAL,
    origin=(0.0, 0.0, 0.0), point1=(0.0, 0.0, -1.0), point2=(1.0, 0.0, 0.0))
    
sph_strain_field = strain_field.getTransformedField(datumCsys=coordSys)

strain_elastomer_field = sph_strain_field.getSubset(region=elastomer_region, position=INTEGRATION_POINT)
max_strain_elastomer = max([strain.maxPrincipal for strain in strain_elastomer_field.values])
formatted_strain_elastomer = "{:.3E}".format(max_strain_elastomer)
strain_elastomer_element = ET.SubElement(root, "Rubber_Max_Strain_maxPrincipal")
strain_elastomer_element.text = formatted_strain_elastomer

-----------------------
# MAKE IMAGES
-----------------------
odb = session.openOdb(file_name_only+".odb")
dtm = odb.rootAssembly.datumCsyses['sph']
session.viewports['Viewport: 1'].odbDisplay.basicOptions.setValues(
    transformationType=USER_SPECIFIED, datumCsys=dtm)

# 1. Print 'Rubber Max Strain (Max Principal)' Images

leaf = dgo.LeafFromElementSets(elementSets=('SEAL.ELASTOMER', ))
session.viewports['Viewport: 1'].odbDisplay.setPrimaryVariable(
    variableLabel="EE", outputPosition=INTEGRATION_POINT, refinement=(
    INVARIANT, 'Max. Principal'), )
    
session.viewports['Viewport: 1'].odbDisplay.displayGroup.replace(leaf=leaf)

session.viewports['Viewport: 1'].view.setValues(session.views['Front'])
session.viewports['Viewport: 1'].view.setProjection(projection=PARALLEL)
session.viewports['Viewport: 1'].odbDisplay.commonOptions.setValues(visibleEdges=EXTERIOR)
session.printOptions.setValues(reduceColors=False)
session.printToFile(fileName="1_Rubber_Max_Strain_maxPrincipal_FRONT", format=PNG, canvasObjects=(session.viewports['Viewport: 1'], ))

The problem is that the extracted field output data and the captured visualization image values are different. (I mainly check the min/max values, and when I compare them, they are different).
Below is a capture of the XML file where I store the data values and a capture for MAX PRICIPAL STRAIN.

odb visualization capture image file
xml file extracting odb field output data

In the visualization image capture, 8.560E-01 is the maximum value, while the Rubber_Max_Strain_maxPricipal value in the xml file is 9.491E-01, so the values are different.
I would like to ask how I can resolve this issue.
Please, help me!!



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *