[vc_row][vc_column][vc_column_text]

User subroutines

User subroutines are intended for computing user-defined fields that initially are not available in the list of fields of the QForm V8 program as well as for enhancing the capabilities of defining flow stresses in a workpiece. The following types of user-defined subroutines are possible:

  1. Postprocessing (executed after simulation)
  2. Processing (executed in the process of simulation)
  • dependent only on standard fields
  • dependent on standard fields and used-defined fields

User-defined fields just as the standard ones are computed in each node and displayed using standard viewing facilities.

User-defined programs in QForm V8 are written in a specialized language Lua (refer to http://www.lua.org, http://www.lua.ru, ru.wikipedia.org/wiki/Lua) designed for creation of built-in applications. This Manual is not just a guide to the Lua language. For more details of the language syntax refer to the links given above.

Advantages of the Lua language over alternative solutions such as Fortran and Visual Basic are as follows::

  • No compiler is required. Its compiling tool is built into the host program (QForm V8) and operates automatically;
  • Simple syntax
  • The program and program manuals are free

A program code in the Lua language may be written using a standard text editor (Notepad), although it is advisable to use Notepad++ (http://www.notepad-plus-plus.org). The file extension of the text document should be changed to *.lua. The name and location of this file are of no importance.

As per the Lua terminology — QForm V8 is a host program that includes a so-called JIT-compiler (just-in-time).  User-defined programs have access to all standard fields and variables in the QForm V8 program (refer to the table below). Fields are defined in each node of the finite-element mesh of tools and a workpiece. Note that names of variables in the Lua language are not always the same as names of fields in the QForm V8 interface, and they are measured in SI(metric) units.

All fields in the Lua language are accessible in two variations: values in the current step (for example, a value of the temperature in the current node – T) and in the previous step with the prefix prev_ (for example, a value of the temperature in the current node – prev_T). The following variables have no previous values: t, dt.

A list of standard variables available in user subroutines for a workpiece is as follows:

Variable

Name in QForm interface V8

Description

Unit of meas. in Lua

Available in processor as well as in postprocessor subroutines

t

Time
Simulation control panel

Time elapsed after the process has been started

sec

dt

Step
Simulation control panel

Time step

sec

T

Temperature

Temperature

oC

stress_mean

Mean Stress

Mean Stress

Pa

stress_flow

Effective stress

Flow stress (Mises criterion)

Pa

strain

Plastic strain

Strain intensity

strain_rate

Strain rate

Strain rate intensity

1/sec

density

Relative density

Relative density

x, y, z

Coordinates of the FE node

mm

disp_x, disp_y, disp_z

Displacement

Elastic displacements

mm

v_x, v_y, v_z

Velocity

Velocity components of FE node

m/s

node_id

Number of FE node

Available only in postprocessor subroutines

stress_xx, stress_yy,

stress_zz, stress_xy,

stress_yz, stress_zx

Stress tensor

Stress tensor components

Pa

stress_1, stress_2, stress_3

Principal stresses

Principal stresses

Pa

strain_xx, strain_yy,

strain_zz, strain_xy,

strain_yz, strain_zx

Strain tensor

Strain tensor components

Pa

strain_1, strain_2, strain_3

Principal strain

Principal strain

 

A list of standard variables available in user subroutines for the tools is as follows:

Variable

Name in QForm interface V8

Description

Unit of meas. in Lua

t

Time
Simulation control panel

Time elapsed after the process has been started

sec

dt

Step
Simulation control panel

Time step

sec

T

T

Temperature

oC

stress_mean

Mean Stress

Mean Stress

Pa

stress_eff

Effective stress

Flow stress (Mises criterion)

Pa

strain

Elastic strain

Elastic strain intensity

 

strain_vol

Volumetric strain

Volumetric strain

1/sec

x, y, z

Coordinates of the FE node

mm

disp_x,disp_y, disp_z

Displacement

Displacement of nodes along X, Y and Z axis

m

stress_xx, stress_yy,

stress_zz, stress_xy,

stress_yz, stress_zx

Stress tensor

Stress tensor components

Pa

stress_1, stress_2, stress_3

Principal stresses

Principal stresses

Pa

strain_xx, strain_yy,

strain_zz, strain_xy,

strain_yz, strain_zx

Strain tensor

Strain tensor components

strain_1, strain_2, strain_3

Principal strain

Principal strain

Example

Fracture in toolIn QForm software users may define functions with Lua programming language. For instance we can describe various tool fracture models with Lua. The figure on the right is a photograph of a real die set failure, and in the figure below is the definition and programming code of Cockroft & Latham fracture criterion, which is implemented for prediction of danger zones within the tool. Simulation results using this criterion show maximum values of fracture in the same area that corresponds to the real failure.

Distribution of calculated parameters by Cockroft-Latham fracture criterion

Definition and realization of the integral

The video below shows simulation of coupled deformation of an assembled tool. The first half of the video shows plastic strain distribution in the workpiece and the second half shows effective stress field in the tool.

[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_video link=”https://www.youtube.com/watch?v=ZxPS3hb6AEk”][/vc_column][/vc_row]

Share