Reputation: 37
I encountered a problem while trying to extract heat flux "HFL Magnitude" from nodes (nodesets) in an Abaqus ODB file using a Python script. However, the same script works correctly for extracting the temperature NT11. The code runs but always returns an empty list for the HFL values. Below is the HFL script, and underneath, I’ve added the functional NT11 script.
"NT11 script python :
from odbAccess import *
import numpy as np
# Path to the ODB file
path0 = 'E:/Job-TCMT.odb'
# Open the ODB file
odb = openOdb(path=path0)
# Name of the node sets
nodeset_1 = 'NODESET-ZCT-1'
nodeset_2 = 'NODESET-ZCT-2'
# Extract the node sets
mySet_1 = odb.rootAssembly.instances['PART-1-1'].nodeSets[nodeset_1]
mySet_2 = odb.rootAssembly.instances['PART-1-1'].nodeSets[nodeset_2]
# Extract the last frame of the step
lastFrame = odb.steps['Step-1'].frames[-1]
# Temperature field (NT11)
TEMP = lastFrame.fieldOutputs['NT11']
# Get temperature values for the two node sets
mySetTemp_1 = TEMP.getSubset(region=mySet_1)
mySetTemp_2 = TEMP.getSubset(region=mySet_2)
# Retrieve temperatures for each node set
temp_values_1 = [v.data for v in mySetTemp_1.values]
temp_values_2 = [v.data for v in mySetTemp_2.values]
# Combine temperatures from both sets
all_temp_values = temp_values_1 + temp_values_2
# Calculate the average temperature
Tint_moyenne_arith = np.mean(all_temp_values)
# Display the result
print('The average temperature (arithmetic) =', Tint_moyenne_arith)
# Close the ODB file
odb.close()
"HFL script python :
from odbAccess import *
import numpy as np
# Path to the ODB file
path0 = 'E:/Job-TCMT.odb'
# Open the ODB file
odb = openOdb(path=path0)
# Name of the node sets
nodeset_1 = 'NODESET-ZCT-1'
nodeset_2 = 'NODESET-ZCT-2'
# Extract the node sets
mySet_1 = odb.rootAssembly.instances['PART-1-1'].nodeSets[nodeset_1]
mySet_2 = odb.rootAssembly.instances['PART-1-1'].nodeSets[nodeset_2]
# Extract the last frame of the step
lastFrame = odb.steps['Step-1'].frames[-1]
# Heat flux field (HFL magnitude)
HFL = lastFrame.fieldOutputs['HFL']
# Get heat flux values for the two node sets
mySetHFL_1 = HFL.getSubset(region=mySet_1)
mySetHFL_2 = HFL.getSubset(region=mySet_2)
# Retrieve heat flux values for each node set
hfl_values_1 = [v.magnitude for v in mySetHFL_1.values]
hfl_values_2 = [v.magnitude for v in mySetHFL_2.values]
# Combine heat flux values from both sets
all_hfl_values = hfl_values_1 + hfl_values_2
# Calculate the average heat flux
HFL_moyenne_arith = np.mean(all_hfl_values)
# Display the result
print('The average heat flux (arithmetic) =', HFL_moyenne_arith)
# Close the ODB file
odb.close()
Upvotes: 0
Views: 30