## Creating flow lines

Flow lines are defined by a set of points. The points can be element nodes or Gauss quadrature points inside elements. Because the velocity is chosen parallel to the x-axis in this example, the flow lines are always parallel to the x-axis.

The first step in constructing flow lines loops over all points. The layered tree structure is used to organize the points into flow lines as described above. Having the x-layer of the structure free, the structure fills its vertices with the points according to their y - and z - coordinates. After all points have been installed, each vertex contains a flow line with one or more points.

A controller or tester is set to prevent a flow line passing through an element without including the pointer to the element. This can be the case when all the element edges are not parallel to the coordinate axes. If this happened, the history of the flow line would be not only
incomplete but also inconsistent. The distance between a preceding point and current point is calculated and compared to the length of the element. The distance should not exceed the length.

After flow lines are created, they are collected and sorted according to the position of the head of each flow line, as shown in Figure 4-8. The starting conditions of each flow line can then be found as described below.

By using the technique described above, find an element containing the head of the flow line. Take the maximum x - coordinate of this element plus an increment as a new point, and find a new element containing this new point. The new element is the upstream element of the former one and the new point is the predecessor of the head of the flow line in the direction of flow. In the order in Figure 4-8 all points of the new element would have been calculated before the new flow line starts. The new element can thus be used as an interpolation basis for the starting condition.

If no such element is found, then the flow line must start in an element on the free surface of the mesh, and a free surface condition can be applied. If the surface is an upstream boundary then cold
material with the initial microstructure can be assumed. If the surface is the wall of a weld pool, then a hot material with a pure austenite or delta ferrite structure can be assumed.

Figure 4-9 shows what flow lines look like in a real discriticized domain.