#
# COPYRIGHT ANSYS, ALL RIGHTS RESERVED
# 
# This file is use for icepak results file to automatically create 
# 1. Temperature gradient and its components
# 2. heat flux vectors from the user defined memory variables and 
#    Temperature gradient components
# 3. Thermal Chokepoint variable
# 4. Thermal Cross variable
#
# The units for User Defined Memory is being explicitly added here
# as they cannot be read from the results file.

! if( objectExists("Temperature") && 
!	objectExists("User Defined Memory 0") &&
!	objectExists("User Defined Memory 1") &&
!	objectExists("User Defined Memory 2") ){

USER VECTOR VARIABLE:Temperature.Gradient
  Recipe = Gradient
  Variable to Gradient = Temperature
END
USER SCALAR VARIABLE:Temperature.Gradient X
  Component Index = 1
  Recipe = Vector Component
  Variable = Temperature.Gradient
END
USER SCALAR VARIABLE:Temperature.Gradient Y
  Component Index = 2
  Recipe = Vector Component
  Variable = Temperature.Gradient
END
USER SCALAR VARIABLE:Temperature.Gradient Z
  Component Index = 3
  Recipe = Vector Component
  Variable = Temperature.Gradient
END
USER VECTOR VARIABLE:Heat Flux Vector
  Recipe = Expression
  X Expression = -User Defined Memory 0 * Temperature.Gradient X * 1 [W m^-1 K^-1] 
  Y Expression = -User Defined Memory 1 * Temperature.Gradient Y * 1 [W m^-1 K^-1]
  Z Expression = -User Defined Memory 2 * Temperature.Gradient Z * 1 [W m^-1 K^-1]
END

USER SCALAR VARIABLE:Thermal Chokepoint
  Recipe = Expression
  Expression = abs( -User Defined Memory 0 * 1 [W m^-1 K^-1] * Temperature.Gradient X^2 - User Defined Memory 1 * 1 [W m^-1 K^-1] * Temperature.Gradient Y^2 - User Defined Memory 2 * 1 [W m^-1 K^-1] * Temperature.Gradient Z^2 )
END

USER VECTOR VARIABLE:Thermal Cross
  Recipe = Expression
  X Expression = -User Defined Memory 1 * 1 [W m^-1 K^-1] * Temperature.Gradient Y * Temperature.Gradient Z + User Defined Memory 2 * 1 [W m^-1 K^-1] * Temperature.Gradient Z * Temperature.Gradient Y
  Y Expression = -User Defined Memory 2 * 1 [W m^-1 K^-1] * Temperature.Gradient Z * Temperature.Gradient X + User Defined Memory 0 * 1 [W m^-1 K^-1] * Temperature.Gradient X * Temperature.Gradient Z
  Z Expression = -User Defined Memory 0 * 1 [W m^-1 K^-1] * Temperature.Gradient X * Temperature.Gradient Y + User Defined Memory 1 * 1 [W m^-1 K^-1] * Temperature.Gradient Y * Temperature.Gradient X
END

!}
