UserDefined Heat Transfer Properties
 The QVOL and QVOLLIB Bulk Data Entries for the definition of timedependent and temperaturedependent volumetric heat generation through userdefined external functions, and/or,
 The PCONV and PCONVLIB Bulk Data Entries for the definition of timedependent and temperaturedependent freeconvection coefficient through userdefined external functions.
 The QBDY1 and QBDYLIB Bulk Data Entries for the definition of timedependent and temperaturedependent uniform heat flux through userdefined external functions.
 The SPCD and SPCDLIB Bulk Data Entries for the definition of timedependent and temperaturedependent uniform heat flux through userdefined external functions.
The external functions may be written in Fortran or C. The resulting libraries and files should be accessible by OptiStruct regardless of the coding language, provided that consistent function prototyping is respected, and adequate compiling and linking options are used.
Write External Functions
The OptiStruct installation provides an example file with subroutines for Fortran (uht.F) with proper subroutine definition, arguments, and compilation directives. This file can be used as a starting point to write your own subroutines.
Two Fortran subroutines are available, one is to define userdefined volumetric heat addition and the second is to define userdefined free convection coefficient.
Volumetric Heat Addition Subroutine
subroutine USRQVOL(ldsid,elabl,elset,nsetl,nsets,max_elset_len,
temp,max_temp_len,time,dtime,tbllabel,tblxy,tbllen,max_table_len,
ntables,evol,ethick,ecentroid, qheat,itablest,jtablest,rtablest,idtablest,
itables1,rtables1,ntables1,ltables1,ntablest,ltablest,itablemd,
rtablemd,nitablemd,ntablemd,ltablemd)
Argument  Type  Input/Output  Description 

ldsid 
Integer  Input  This is the userdefined QVOL Load Set
identification number (User ID). 
elabl 
Character, vector  Input  elabl is the label of the
elset (the identifier). It indicates the
HyperMesh component
name. 
elset 
Integer, vector  Input  The element ID’s in elabl . Internal IDs and
then userdefined IDs following them (only for debugging
purpose). 
nsetl 
Integer, vector  Input  Actual length of each elset 
nsets 
Integer, vector  Input  Total number of elset 
max_elset_len 
Integer, vector  Input  Maximum length of all the elset 
temp 
Double, vector  Input  Temperature calculated at the element centroid. This is based on internal IDs. 
time 
Double, scalar  Input  Current time 
dtime 
Double, scalar  Input  Time step 
tbllabel 
Character, vector  Input  Label of the TABLEG table 
tblxy 
Double, vector  Input  Contains the TABLEG XY values 
tbllen 
Integer, vector  Input  Actual length of each TABLEG table 
max_table_len 
Integer, vector  Input  Maximum length of all the TABLEG tables 
ntables 
Integer, vector  Input  Total number of TABLEG tables 
evol 
Double, vector  Input  Element volumes 
ethick 
Double, vector  Input  Element thicknesses 

Double, vector  Input  Element centroid XYZ coordinates 
qheat 
Double, vector  Output  q calculated at the element centroid – the
volume is calculated within the main source code of OptiStruct. qheat is
vector, it will contain the q ’s of all heated
elements. 
itablest 
Integer, vector  Input  TABLEST integer data 
itablest(1) 
Integer  Input  Table identification number 
itablest(3) 
Integer  Input  Starting index of jtablest 
itablest(4) 
Integer  Input  Ending index of jtablest 
jtablest 
Integer, vector  Input  Contains the indexes for the TABLEST temperature values and TABLES1 entries. 
rtablest 
Double, vector  Input  TABLEST temperature values 
idtablest 
Integer, vector  Input  TABLEST and TABLES1 entries 
itables1 
Integer, vector  Input  TABLES1 integer data 
itables1(1) 
Integer  Input  Table identification number 
itables1(3) 
Integer  Input  Starting index of rtables1 
itables1(4) 
Integer  Input  Ending index of rtables1 
rtables1 
Double, vector  Input  TABLES1 XY values 
ntablest 
Integer, vector  Input  Total number of TABLEST tables 
ltablest 
Integer, vector  Input  Total length of each TABLEST table 
ntables1 
Integer, vector  Input  Total number of TABLES1 tables 
ltables1 
Integer, vector  Input  Total length of each TABLES1 table 
itablemd 
Integer, vector  Input  TABLEMD Integer data 
rtablemd 
Integer, vector  Input  TABLEMD XY values 
nitablemd 
Integer, scalar  Input  Total length of each TABLEMD table 
ntablemd 
Integer, scalar  Input  Total number of each TABLEMD table 
ltablemd 
Integer, scalar  Input  Total length of each RTABLEMD table 
FreeConvection Coefficient Subroutine
subroutine
USERHTC(pconvid,pconlabel,num_pconvlabels,cnvlabl,cnvset,cnvnsetl,
cnvnsets,max_cnvset_len,sidtemp,max_sidtemp_len,time,dtime,tbllabel,
tblxy,tbllen,max_table_len,ntables,xyzcoord,qvol_temperatures,
qvol_element_sets,qvol_element_sets_len,qvol_labels,num_qvol_labels,
max_qvol_sets_len,max_qvol_temp_len,htc,itablest,jtablest,rtablest,idtablest,
itables1,rtables1,ntables1,ltables1,ntablest,ltablest,itablemd,rtablemd,nitablemd,
ntablemd,ltablemd)
Argument  Type  Input/Output  Description 

pconvid 
Integer  Input  Convection property identification number 
pconlabel 
Character  Input  Convection property identification label. This is the HyperMath property name. 
num_pconvlabels 
Integer, vector  Input  Number of pconlabels . 
cnvlabl 
Character, vector  Input  Label of the cnvset (the identifier). This
is the HyperMath component
name. 
cnvset 
Integer, vector  Input  Element ID’s and their side in cnvlabl .
Internal element IDs defined on the CONV
entry and then user element IDs to follow. 
cnvnsetl 
Integer, vector  Input  Actual length of each cnvset 
cnvnsets 
Integer, vector  Input  Total number of cnvset 
max_cnvset_len 
Integer, vector  Input  Maximum length of all the cnvset 
sidtemp 
Double, vector  Input  Temperature calculated at the element side centroid 
time 
Double, scalar  Input  Current time 
dtime 
Double, scalar  Input  Time step 
tbllabel 
Character, vector  Input  Label of the TABLEG table 
tblxy 
Double, vector  Input  Contains the TABLEG table XY values 
tbllen 
Integer, vector  Input  Actual length of each TABLEG table 
max_table_len 
Integer, vector  Input  Maximum length of all the TABLEG tables 
ntables 
Integer, vector  Input  Total number of TABLEG tables 
xyzcoord 
Double, vector  Input  Element’s side centroid nodal coordinates 
qvol_temperatures 
Integer, vector  Input  Temperatures calculated at the element centroid associated with a QVOL Bulk Data Entry. 
qvol_element_sets 
Integer, vector  Input  Element IDs in QVOL labels 
qvol_element_sets_len 
Character, vector  Input  Actual length of each QVOL element set 
qvol_labels 
Integer, vector  Input  Label of the QVOL element set 
num_qvol_labels 
Character, vector  Input  Total number of QVOL labels 
max_qvol_sets_len 
Integer, vector  Input  Maximum length of all QVOL element sets 
max_qvol_temp_len 
Integer, vector  Input  Maximum length of all QVOL temperatures 
htc 
Double, vector  Output  Convection Heat Transfer Coefficient calculated at the side centroid 
itablest 
Integer, vector  Input  TABLEST integer data 
itablest(1) 
Integer  Input  Table identification number 
itablest(3) 
Integer  Input  Starting index of jtablest 
itablest(4) 
Integer  Input  Ending index of jtablest 
jtablest 
Integer, vector  Input  Contains the indexes for the TABLEST temperature values and TABLES1 entries. 
rtablest 
Double, vector  Input  TABLEST temperature values 
idtablest 
Integer, vector  Input  TABLEST and TABLES1 entries 
itables1 
Integer, vector  Input  TABLES1 integer data 
itables1(1) 
Integer  Input  Table identification number 
itables1(3) 
Integer  Input  Starting index of rtables1 
itables1(4) 
Integer  Input  Ending index of rtables1 
rtables1 
Double, vector  Input  TABLES1 XY values 
ntablest 
Integer, vector  Input  Total number of TABLEST tables 
ltablest 
Integer, vector  Input  Total length of each TABLEST table 
ntables1 
Integer, vector  Input  Total number of TABLES1 tables 
ltables1 
Integer, vector  Input  Total length of each TABLES1 table 
Heat Flux Subroutine
subroutine
USERQBDY1(ldsid,elabl,elset,nsetl,nsets,max_elset_len,temp,max_temp_len,
time,dtime,tbllabel,tblxy,tbllen,max_table_len,ntables,areas,thicknesses,
xyzcoords,qbdy1,itablest,jtablest,rtablest,idtablest,itables1,rtables1,
ntables1,ltables1,ntablest,ltablest,itablemd,rtablemd,nitablemd,ntablemd,
ltablemd)
Argument  Type  Input/Output  Description 

ldsid 
Integer  Input  This is the userdefined QBDY1 Load Set Identification number (User ID). 
elabl 
Character, vector  Input  elabl is the label of the
elset (the identifier). It indicates the
HyperMesh component name.

elset 
Integer, vector  Input  The element ID’s in elabl . Internal IDs and
then userdefined IDs following them (only for debugging
purpose).

nsetl 
Integer, vector  Input  Actual length of each elset 
nsets 
Integer, vector  Input  Total number of elset 
max_elset_len 
Integer, vector  Input  Maximum length of all the elset 
temp 
Double, vector  Input  Temperature calculated at the element centroid. This is based on internal IDs. 
time 
Double, scalar  Input  Current time 
dtime 
Double, scalar  Input  Time step 
tbllabel 
Character, vector  Input  Label of the TABLEG table 
tblxy 
Double, vector  Input  Contains the TABLEG table XY values 
tbllen 
Integer, vector  Input  Actual length of each TABLEG table 
max_table_len 
Integer, vector  Input  Maximum length of all the TABLEG tables 
ntables 
Integer, vector  Input  Total number of TABLEG tables 
areas 
Double, vector  Input  Element area 
thicknesses 
Double, vector  Input  Element thicknesses 
xyzcoords 
Double, vector  Input  Element centroid nodal coordinates. 
qbdy1 
Double, vector  Output  q calculated at the element centroid
qbdy1 is a vector, it will contain the
q ’s of all heated elements. 
itablest 
Integer, vector  Input  TABLEST integer data 
itablest(1) 
Integer  Input  Table identification number 
itablest(3) 
Integer  Input  Starting index of jtablest 
itablest(4) 
Integer  Input  Ending index of jtablest 
jtablest 
Integer, vector  Input  Contains the indexes for the TABLEST temperature values and TABLES1 entries 
rtablest 
Double, vector  Input  TABLEST temperature values 
idtablest 
Integer, vector  Input  The TABLEST and TABLES1 entries 
itables1 
Integer, vector  Input  The TABLES1 integer data 
itables1(1) 
Integer  Input  Table identification number 
itables1(3) 
Integer  Input  Starting index of rtables1 
itables1(4) 
Integer  Input  Ending index of rtables1 
rtables1 
Double, vector  Input  TABLES1 XY values 
ntablest 
Integer, vector  Input  Total number of TABLEST tables 
ltablest 
Integer, vector  Input  Total length of each TABLEST table 
ntables1 
Integer, vector  Input  Total number of TABLES1 tables 
ltables1 
Integer, vector  Input  Total length of each TABLES1 table 
itablemd 
Integer, vector  Input  TABLEMD Integer data 
rtablemd 
Double, vector  Input  TABLEMD XY values 
nitablemd 
Integer, scalar  Input  Total length of each TABLEMD table 
ntablemd 
Integer, scalar  Input  Total number of TABLEMD tables 
ltablemd 
Integer, scalar  Input  Total length of each RTABLEMD table 
SPCD Temperature Subroutine
subroutine
USERSENSOR(ldsid,nlabl,ndset,ndsetl,cntrlset,cntrlsetl,ndsets,max_ndset_len,
max_cntrlset_len,tempn,max_tempn_len,max_tempinf_len,time,dtime,tbllabel,tblxy,
tbllen,max_table_len,ntables,tempinf,itablest,jtablest,rtablest,idtablest,itables1,
rtables1,ntables1,ltables1,ntablest,ltablest,itablemd,rtablemd,nitablemd,ntablemd,
ltablemd)
Argument  Type  Input/Output  Description 

ldsid 
Integer  Input  SPCD load set ID (userdefined SPCD ID) 
nlabl 
Character, Vector  Input  Label of the NDSET (identifier). This is the HyperMesh node SET label (for ambient node). 
ndset 
Integer, vector  Input  Node ID’s in nlabl . It contains the internal
IDs and then the user IDs follow. 
ndsetl 
Integer, vector  Input  Actual length of each ndset 
ndsets 
Integer, vector  Input  Total number of ndset 
max_ndset_len 
Integer, vector  Input  Maximum length of all the ndset 
cntrlset 
Integer, vector  Input  Control node IDs. These are internal IDs and then userdefined IDs to follow. 
cntrlsetl 
Integer, vector  Input  Actual length of each cntrlset . 
cntrlsets 
Integer, vector  Input  Total number of cntrlset . 
max_cntrlset_len 
Integer, vector  Input  Maximum length of all the cntrlset

tempn 
Double, vector  Input  Calculated nodal temperature. 
tempinf 
Double, vector  Output  Ambient Temperatures at the control nodes. 
time 
Double, scalar  Input  Current time 
dtime 
Double, scalar  Input  Time step 
tbllabel 
Character, vector  Input  Label of the TABLEG table 
tblxy 
Double, vector  Input  Contains the TABLEG table XY values 
tbllen 
Integer, vector  Input  Actual length of each TABLEG table 
max_table_len 
Integer, vector  Input  Maximum length of all the TABLEG tables 
ntables 
Integer, vector  Input  Total number of TABLEG tables 
itablest 
Integer, vector  Input  TABLEST integer data 
itablest(1) 
Integer  Input  Table identification number 
itablest(3) 
Integer  Input  Starting index of jtablest 
itablest(4) 
Integer  Input  Ending index of jtablest 
jtablest 
Integer, vector  Input  Contains the indexes for the TABLEST temperature values and TABLES1 entries 
rtablest 
Double, vector  Input  TABLEST temperature values 
idtablest 
Integer, vector  Input  The TABLEST and TABLES1 entries 
itables1 
Integer, vector  Input  The TABLES1 integer data 
itables1(1) 
Integer  Input  Table identification number 
itables1(3) 
Integer  Input  Starting index of rtables1 
itables1(4) 
Integer  Input  Ending index of rtables1 
rtables1 
Double, vector  Input  TABLES1 XY values 
ntablest 
Integer, vector  Input  Total number of TABLEST tables 
ltablest 
Integer, vector  Input  Total length of each TABLEST table 
ntables1 
Integer, vector  Input  Total number of TABLES1 tables 
ltables1 
Integer, vector  Input  Total length of each TABLES1 table 
itablemd 
Integer, vector  Input  TABLEMD integer data. 
rtablemd 
Double, vector  Input  TABLEMD XY values 
nitablemd 
Integer, scalar  Input  Total length of each TABLEMD table. 
ntablemd 
Integer, scalar  Input  Total number of TABLEMD tables. 
ltablemd 
Integer, scalar  Input  Total length of each RTABLEMD table. 
Build External Libraries for UserDefined Materials
You can build shared libraries on Windows or Linux. Refer to Build External Libraries for more information.