Manufacturing Solutions

TCL Functions

TCL Functions

Previous topic Next topic No expanding text in this topic  

TCL Functions

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

TCL (Tool Command Language) functions can be used to describe how some boundary or material quantity varies over space or time. For a detailed description of Tcl commands and procedures, please refer to your TCL online help (it comes with any TCL installation), or to any TCL reference book. In the following example, a basic yet representative TCL procedure is demonstrated.

TCL Example


The following example represents a function written in TCL language that returns the value of the z-component of the inlet velocity as a function of node's coordinates. (Note: Comment lines in a *.tcl file start with a # sign).

proc Zvel { x y z t } {

# proc is a tcl command indicating a function.

# The complete procedure should be within curly brackets.

# Zvel is the user-selected name of the function.

# x,y,z, and t are the input variables passed to the tcl function,

# indicating a point's coordinates and time:

# x : x-coordinate of the point

# y : y-coordinate of the point

# z : z-coordinate of the point

# t : Time

 

set uo 0.005

set h 0.105

set delta 0.0127

 

# Set values of local constants:

# u0 : Ram speed

# h : Billet Radius

# delta : Boundary layer thickness

 

set radius [expr sqrt($x*$x + $y*$y)]

 

# Compute radius at the point. Note the expression has to be within square brackets.

# Note also that variables within expressions are denoted by $ sign, followed by the variable name.

 

set dto [expr $delta / $h]

 

# nondimensionalize the boundary layer thickness

 

set yhat [expr ($h - abs($radius)) / $delta]

 

# nondimensional distance(yhat)of the integration point from wall.

# if yhat > 1.0 the point is outside the boundary layer

# if yhat <= 1.0 the point is inside the boundary layer

# Compute maximum velocity(uc)

# Max vel > Ram speed (since the velocity is less than ram speed in the boundary layer)

 

set uc [expr $uo/(1.0 - $dto / 3.0)]

 

# use an if structure to calculate the z-velocity uz:

 

if { $yhat <=3D 1.0 } {

set uz [expr $uc * $yhat * (2.0 - $yhat)]

} else {

set uz $uc

}

 

# the tcl procedure return the value of uz to the calling function:

return $uz

}

 

Other TCL Commands in HyperXtrude


TCL commands can be issued in HyperXtrude either by sourcing a TCL command file, or interactively through the command line. The command line (at the bottom of the main graphics window) allows you access to some advanced TCL commands, such as those designed to manipulate element sets or the post-processor. Please type help in the command line for more on that.

 

Additional Notes/Suggestions


The material constants supplied in the HyperXtrude material database are only representative data. Some of these values may vay considerably leading to a tangible difference in the results. For more accurate analysis, you should obtain accurate data for the specific material being extruded. This can be done at any of the material-testing laboratories.
When using Bearing Definition, select the extrusion direction to positive Z-direction (pset ExtrusionDirection "ZAxis").
For Axisymmetric analyses:
-Extrusion direction must be positive X-axis
-Mesh must be in XY-plane
-Use quadratic elements (QUAD8 or QUAD9)
-If solution iterations are divergent, try switching the linear equation solver from the default Sparse solver type to the  GMRES solver.

 

 

See also

Introduction to the HyperXtrude Post-processor