Accessing Tdyn data from the Tcl script

From the Tcl procedures defined in the Tdyn extension, it is possible to access Tdyn internal data. This access is done by means of the following functions:

TdynTcl_VecVal vec inode

Returns the value of the variable identified by vec, corresponding to the node inode. vec must be one of the vector names defined in the section Function Syntax. Example: TdynTcl_VecVal Tm 10

TdynTcl_DVecVal vec inode idim

Returns the value of the derivative in the direction given by idim (1 -x-, 2 -y-, 3 -z-) of variable identified by vec, corresponding to the node inode. vec must be one of the vector names defined in the section Function Syntax. Example: TdynTcl_DVecVal Tm 10 2

TdynTcl_VecVals vec node_list

Returns a list with the values of the variable identified by vec, corresponding to the nodes in the list given by node_list. vec must be one of the vector names defined in the section Function Syntax. Example: TdynTcl_DVecVal Tm [list 10 12 14]

TdynTcl_VecValsAverage vec node_list

Returns the average of the values of the variable identified by vec, corresponding to the nodes in the list given by node_list. vec must be one of the vector names defined in the section Function Syntax. Example: TdynTcl_VecValsAverage Tm [list 10 12 14]

TdynTcl_Coord inode idim

Returns the coordinate idim (1 for x component, 2 for y component and 3 for z component) of the node inode. Example: TdynTcl_Coord 10 2

TdynTcl_Coords inode idom

Returns the coordinates of the node (1 for x component, 2 for y component and 3 for z component) of the node inode. The index of the can be global (idom = 0) fluid (idom = 1) or solid (idom = 2). Example: TdynTcl_Coords 10 0

TdynTcl_NNode itype

Returns the number of nodes of the problem. If itype is 0, returns the total number of nodes, for itype 1 returns the number of fluid nodes and for itype 2 returns the number of solid nodes. Example: TdynTcl_NNode 0

TdynTcl_Dt

Returns the current time increment. Example: TdynTcl_Dt

TdynTcl_Time

Returns the current physical time of the simulation. Example: TdynTcl_Time

TdynTcl_Step

Returns the current step of the simulation. Example: TdynTcl_Step

TdynTcl_FixSystemRow idof val

Fixes the idof row of the current system of equations to val. Example: TdynTcl_FixSystemRow 10 0.0

TdynTcl_DelSystemRow idof

Sets to 0.0 all the entries of the idof row of the current system of equations. Example: TdynTcl_DelSystemRow 10

TdynTcl_GetRhs idof

Returns the idof value of the right hand side vector of the current system of equations. Example: TdynTcl_GetRhs 10

TdynTcl_SetRhs idof val

Sets the idof value of the right hand side vector of the current system of equations to val. Example: TdynTcl_SetRhs 10 0.0

TdynTcl_IsFluid inode

Returns 1 if the index inode corresponds to a fluid node and 0 otherwise. Example: TdynTcl_IsFluid 10

TdynTcl_IsSolid idof

Returns 1 if the index inode corresponds to a solid node and 0 otherwise. Example: TdynTcl_IsSolid 10

TdynTcl_GetFluidBodyNodes name

Returns a list containing the indexes of the nodes of the FluidBody name. Example: TdynTcl_GetFluidBodyNodes fluid_body

TdynTcl_GetFluidBodyElems name

Returns a list containing the conectivities of the elements of the FluidBody name. Example: TdynTcl_GetFluidBodyElems fluid_body

TdynTcl_GetSolidBodyNodes name

Returns a list containing the indexes of the nodes of the SolidBody name. Example: TdynTcl_GetSolidBodyNodes solid_body

TdynTcl_GetSolidBodyElems name

Returns a list containing the conectivities of the elements the SolidBody name. Example: TdynTcl_GetSolidBodyElems solid_body

TdynTcl_GetFluidElems name

Returns a list containing the conectivities of the elements of the Fluid Material name. Example: TdynTcl_GetFluidElems fluid

TdynTcl_GetSolidElems name

Returns a list containing the conectivities of the elements of the Solid Material name. Example: TdynTcl_GetSolidElems solid

TdynTcl_Message message type

Print the notice or error given by message. type can be "error", "warning" or "notice". Error messages will stop calculation. Example: TdynTcl_Message "Tcl script executed correctly" notice

TdynTcl_UnitsConversor value in_units out_units magnitude

Convert the value of the defined magnitude from the units given by in_units to the units given by out_units . Units format must follow the criteria defined in Units Syntax section. Example: TdynTcl_UnitsConversor 1.0 "\[m\]" "\[mm\]" Length

TdynTcl_SetGlobalVariable variable value

Set the Tdyn variable to the given value . Available variables are: Number_of_Steps, Max_Iterations, Total_Time, OutPut_Start and OutPut_Step. Example: TdynTcl_SetGlobalVariable OutPut_Start 10

TdynTcl_GetGlobalVariable variable

Returns the value of the given Tdyn variable . Available variables are: Number_of_Steps, Max_Iterations, Total_Time, OutPut_Start and OutPut_Step. Example: TdynTcl_GetGlobalVariable OutPut_Start

TdynTcl_GlobalToFluid inode

Converts the global node index inode to local index in fluid domain. Example: TdynTcl_GlobalToFluid 10

TdynTcl_GlobalToSolid inode

Converts the global node index inode to local index in solid domain. Example: TdynTcl_GlobalToSolid 10

TdynTcl_FluidToGlobal inode

Converts the local node index inode in fluid domain to global index. Example: TdynTcl_FluidToGlobal 15

TdynTcl_GlobalToSolid inode

Converts the local node index inode in solid domain to global index. Example: TdynTcl_GlobalToSolid 15

TdynTcl_SetFluidBodyVariable name variable value

Set the variable of fluid body name to the given value . Available variables are: AccelerationX/Y/Z, RAccelerationX/Y/Z, DisplacementX/Y/Z, RotationX/Y/Z. Example: TdynTcl_SetFluidBodyVariable fluid_body DisplacementX 0.02

TdynTcl_GetFluidBodyVariable name variable

Returns the value of the variable of fluid body name . Available variables are: AccelerationX/Y/Z, RAccelerationX/Y/Z, DisplacementX/Y/Z, RotationX/Y/Z. Example: TdynTcl_GetFluidBodyVariable fluid_body RAccelerationY

TdynTcl_X/Y/Z

Returns the x coordinate of the current node. This function can only be used in those tcl functions called from entries of Materials and Boundaries windows. Example: TdynTcl_Y

TdynTcl_Index type

Returns the index of the current node. Depending on type, the global (type = 0), fluid (type = 1) or solid (type = 2) index is returned. This function can only be used in those tcl functions called from entries of Materials and Boundaries windows.