|
|
|
Python for ABAQUS Python is the scripting language for ABAQUS. You can use a python script to easily define materials for your analysis. This is helpful if you use the same materials in several models. In the example below, a material called 'iron' is defined and read into the current model in CAE. Copy the script below and paste it into a file called mats.py using a simple text editor. This script only defines 1 material, you can define as many as you like in this script. The actual funcitons that define the material property are produced by the MPDB software. You can use this script as a templet to define you own materials.
from abaqus import *
from material import *
# run this from the command prompt within Abaqus CAE by typing: execfile('mats.py')
# this file (mats.py) must be in the same directory from which you are running CAE
def main() :
try :
# for abaqus v6.2-x uncomment these next 2 lines and comment out the 2 v6.3-x lines
#myModelName = session.viewport[session.currentViewportName].displayedObject.modelName
#myModel = mdb.model[myModelName]
# for abaqus v6.3-x uncomment these next 2 lines and comment out the 2 v6.2-x lines
#myModelName = session.viewports[session.currentViewportName].displayedObject.modelName
#myModel = mdb.models[myModelName]
except :
print 'You must first have a part defined'
return
myModel.setValues(absoluteZero=0.0, stefanBoltzmann=5.67e-8) # W/m2/K4
myMaterial = myModel.Material(name='iron')
dataLineTuple = []
t = 190.0
for i in range(0,101) :
t = t + 10.0
dataLineTuple.append(elastic_mod_Fe(t), poissons_ratio_Fe(t), t)
dataTuple = tuple(dataLineTuple)
myMaterial.Elastic(temperatureDependency=ON, table=(dataTuple))
dataLineTuple = []
t = 190.0
for i in range(0,101) :
t = t + 10.0
dataLineTuple.append(mean_cte_Fe(t), t)
dataTuple = tuple(dataLineTuple)
myMaterial.Expansion(type=ISOTROPIC, zero=293.0, temperatureDependency=ON, table=(dataTuple))
dataLineTuple = []
t = 190.0
for i in range(0,101) :
t = t + 10.0
dataLineTuple.append(thermal_cond_Fe_solid(t), t)
dataTuple = tuple(dataLineTuple)
myMaterial.Conductivity(type=ISOTROPIC, temperatureDependency=ON, table=(dataTuple))
dataLineTuple = []
t = 190.0
for i in range(0,101) :
t = t + 10.0
dataLineTuple.append(specific_heat_Fe_solid(t), t)
dataTuple = tuple(dataLineTuple)
myMaterial.SpecificHeat(temperatureDependency=ON, table=(dataTuple))
dataLineTuple = []
t = 190.0
for i in range(0,101) :
t = t + 10.0
dataLineTuple.append(density_Fe_solid(t), t)
dataTuple = tuple(dataLineTuple)
myMaterial.Density(temperatureDependency=ON, table=(dataTuple))
##################################################################################################
def poissons_ratio_Fe(t) :
# Reference: see E and G
# Note: calculated from E and G; errors may be large
# Poissons ratio is unitless
# t must be in degrees Kelvin for these equations
if t >= 4.0 and t <= 273.0 :
return -6.293870E-13*t*t*t*t + 5.370994E-10*t*t*t -6.309382E-08*t*t + 4.180781E-08*t + 2.850633E-01
elif t > 273.0 and t <= 1053.0 :
return 1.246582E-11*t*t*t -3.856929E-08*t*t + 7.030261E-05*t + 2.712267E-01
elif t > 1053.0 and t <= 1500.0 :
return 1.661461E-09*t*t -1.242823E-06*t + 3.165268E-01
elif t < 4.0 :
return 2.850625E-01
elif t > 1500.0 :
return 3.184009E-01
##################################################################################################
def elastic_mod_Fe(t) :
# Reference: M. Fukuhara and A. Sanpei, ISIJ International, vol 33(4),
# p508 (1993); below 273K J.A. Rayne and B.S. Chandrasekhar,
# Physical Review, v122, p1714 (1961)
# Note: approximate values for plain carbon and low alloy steels;
# values below 273K were calculated from C11, C12, C44
# elastic modulus is in units of Pa
# t must be in degrees Kelvin for these equations
if t >= 4.0 and t <= 273.0 :
return -1.145454*t*t*t*t + 9.266601E+02*t*t*t -3.051404E+05*t*t + 5.020008E+06*t + 2.217366E+11
elif t > 273.0 and t <= 1050.0 :
return -1.063196E+05*t*t + 3.572844E+07*t + 2.109875E+11
elif t > 1050.0 and t <= 1500.0 :
return -6.773810E+07*t + 2.024261E+11
elif t < 4.0 :
return 2.217519E+11
elif t > 1500.0 :
return 1.008190E+11
##################################################################################################
def mean_cte_Fe(t) :
# F.C. Nix and D. MacNair, Physical Review, v60, p597 (1941); calculated
# from the linear expansion
# the reference temperature is 293K; 8% error
# data is in units of 1/K
# t must be in degrees Kelvin for these equations
if t >= 91.0 and t < 410.0 :
return 8.156945e-014*t*t*t -9.244895e-011*t*t +3.775811e-008*t +6.517108e-006
elif t >= 410.0 and t <= 960.0 :
return 4.782671e-017*t*t*t*t -1.357633e-013*t*t*t +1.324312e-010*t*t -4.591434e-008*t +1.664716e-005
elif t < 91.0 :
return 9.248995e-006
elif t > 960.0 :
return 1.512476e-005
##################################################################################################
def thermal_cond_Fe_solid(t) :
# Lucks, C.F. and Deem, H.W., Thermal Properties of 13 Metals,
# ASTM, Special Technical Publication No. 227 (1958)
# data is in units of W/(m-K)
# t must be in degrees Kelvin for these equations
if t >= 77.0 and t <= 1255.0 :
return 9.690376e-011*t*t*t*t -2.494362e-007*t*t*t +2.508465e-004*t*t -1.697584e-001*t +1.066114e+002
elif t < 77.0 :
return 9.491680e+001
elif t > 1255.0 :
return 3.599398e+001
##################################################################################################
def specific_heat_Fe_solid(t) :
# P.D. Desai, J. Phys. Chem. Ref. Data, v15(3), p967 (1986)
# 1.5% to 5% error
# data is in units of J/(kg-K)
# t must be in degrees Kelvin for these equations
if t >= 1.0 and t < 20.0 :
return 8.786827e-006*t*t*t*t +3.434114e-005*t*t*t +3.543513e-003*t*t +7.343790e-002*t +1.640777e-002
elif t >= 20.0 and t < 130.0 :
return 5.251765e-008*t*t*t*t*t -1.807849e-005*t*t*t*t +1.972324e-003*t*t*t -5.588171e-002*t*t +9.005499e-001*t -4.129967e+000
elif t >= 130.0 and t < 500.0 :
return -1.683141e-008*t*t*t*t +2.868283e-005*t*t*t -1.780930e-002*t*t +5.191206e+000*t -1.438118e+002
elif t >= 500.0 and t < 1000.0 :
return 1.852870e-008*t*t*t*t -4.990048e-005*t*t*t +5.023704e-002*t*t -2.189081e+001*t +3.998510e+003
elif t >= 1000.0 and t < 1042.0 :
return 6.672367e-004*t*t*t -1.889510e+000*t*t +1.783888e+003*t -5.606426e+005
elif t >= 1042.0 and t < 1184.0 :
return 3.231248e-006*t*t*t*t -1.504264e-002*t*t*t +2.625897e+001*t*t -2.037174e+004*t +5.927268e+006
elif t >= 1184.0 and t < 1665.0 :
return 1.496811e-001*t +4.295303e+002
elif t >= 1665.0 and t <= 1809.0 :
return 1.778200e-001*t +4.402844e+002
elif t < 1.0 :
return 9.343231e-002
elif t > 1809.0 :
return 7.619609e+002
##################################################################################################
def density_Fe_solid(t) :
# F.C. Nix and D. MacNair, Physical Review, v60, p597 (1941); calculated
# from the linear expansion
# the reference temperature is 293K; 8% error
# data is in units of g/cm^3
# t must be in degrees Kelvin for these equations
if t >= 91.0 and t < 190.0 :
return -6.010914e-009*t*t*t +2.196832e-006*t*t -4.306436e-004*t +7.924000e+000
elif t >= 190.0 and t <= 960.0 :
return 1.470685e-010*t*t*t -3.511597e-007*t*t -1.002710e-004*t +7.910967e+000
elif t < 91.0 :
return 7.898474e+000
elif t > 960.0 :
return 7.621195e+000
##################################################################################################
# call main to get program started
main()
|