liq001
Aerospace
- Feb 25, 2022
- 54
Hello everyone,
I am working on a script to use getSubset method to access the stress and coordinates from a certain element set. I just noticed a problem with COORD and I I'm doing exactly the same for both, but it only works for the stress. For COORD I always get an empty array. I've posted part o my script below. Need some help here to understanding Why is this happening? Is there a workaround? Thanks for any comments and help.
# Open the ODB file
odb = openOdb(odb_name)
# Access the last step and last frame
last_step = odb.steps.values()[-1]
last_frame = last_step.frames[-1]
# Access the specified element set and output variable
element_set = odb.rootAssembly.instances['PART-1-1'].elementSets['ALLELE']
field_output = last_frame.fieldOutputs['S']
sub_field_output = field_output.getSubset(region=element_set, position=CENTROID)
# Retrieve the coordinates
coord_field = last_frame.fieldOutputs['COORD']
sub_coord_field = coord_field.getSubset(region=element_set, position=CENTROID)
# Create numpy arrays and a mapping dictionary
coord_array = np.array([elem.data for elem in sub_coord_field.values])
field_values_array = np.array([elem.mises for elem in sub_field_output.values])
Best
lee
I am working on a script to use getSubset method to access the stress and coordinates from a certain element set. I just noticed a problem with COORD and I I'm doing exactly the same for both, but it only works for the stress. For COORD I always get an empty array. I've posted part o my script below. Need some help here to understanding Why is this happening? Is there a workaround? Thanks for any comments and help.
# Open the ODB file
odb = openOdb(odb_name)
# Access the last step and last frame
last_step = odb.steps.values()[-1]
last_frame = last_step.frames[-1]
# Access the specified element set and output variable
element_set = odb.rootAssembly.instances['PART-1-1'].elementSets['ALLELE']
field_output = last_frame.fieldOutputs['S']
sub_field_output = field_output.getSubset(region=element_set, position=CENTROID)
# Retrieve the coordinates
coord_field = last_frame.fieldOutputs['COORD']
sub_coord_field = coord_field.getSubset(region=element_set, position=CENTROID)
# Create numpy arrays and a mapping dictionary
coord_array = np.array([elem.data for elem in sub_coord_field.values])
field_values_array = np.array([elem.mises for elem in sub_field_output.values])
Best
lee