## 2 Holistic Model of the SLM Process and Main Algorithm
### Powder Bed Generation Models  
Four variants of the powder deposition model have been developed. The first three variants use a quasi-kinematic approach with a simplified static stability test and are based on a similar algorithm. The simplified representation of the algorithm is shown in Figure 3a. Figure 1: SLM process with associated physical phenomena and submodels [39]. Figure 2: Graphical representation of the main algorithm [39]. Briefly, each particle falls onto the basement (flat, curved, or arbitrary shape after treatment) or onto the previously deposited particles. First, the first contact of the falling particle with the basement is searched, which restricts the first degree of freedom. Then, the particle begins to roll, slide, or rotate over the surface or other particles until it finds the second contact. After the tests, the algorithm can go further or return to the previous stages. Next, the particle continues to move with a restriction of two degrees of freedom. When the third contact point is found and the last degree of freedom is restricted, the stability of the particle is tested. If the stability conditions are satisfied, the location of the particle is treated as final, and the algorithm passes to the next particle. The algorithms of the variants differ in detail depending on the shape of the particles and the accepted assumptions. The first variant based on 2.5D CA considers a powder with atomized particles (spherical shape) (Figure 3b). The algorithm considers only rolling movements. A detailed description of this variant, simulation results, and model verification and validation can be found elsewhere [33]. The validation confirms high accuracy in terms of packing density. The second variant based on 2.5D CA has been developed for arbitrary-shaped particles. A database containing 50 particles was created. The particles are modified before deposition by their rotation on three random Euler angles with consequent random scaling along three independent axes, giving an unlimited number of unique particles. The particles are represented by a cloud of points on the surface of the particles. The particle can be translated (fall or slide) or rotated around an axis fixed by one or two points. The simulation results can be found in [34; 36; 38] and are presented in Figure 3c. The third variant was created after the development and implementation of the laser beam heating (LBH) model based on the ray-tracing algorithm in the holistic model. The LBH model requires a parametric (continuous, vectorizing) representation of the material surface that could not be achieved with the previous variants. Surfaces are represented by vertices, edges, and faces (triangles). During the particle movement (translation and rotation), two types of contacts are analyzed: vertex-to-face and edge-to-edge. After deposition, the results can be represented in two forms: vector (continuous) and discrete. Figure 3: A simplified algorithm of the powder deposition model (**a**), and examples of particle deposition obtained by the first (**b**), and second (**c**) variants of the model. Discrete representation is necessary for LBM models. An example of deposition presented in the parametric and discrete forms are presented in Figure 4. The other simulation results with this variant can be found elsewhere [39]. The last variant presented here uses the Unity(r) platform with the same database of particles of arbitrary shape extended by the spherical (atomized) particle. Unity is a cross-platform game engine developed by Unity Software Inc. (doing business as Unity Technologies) is a video game software development company based in San Francisco (USA). The particles in the database were adapted to Unity by creating so-called prefabs. The particles are considered to be rigid bodies with bounce. They move and rotate under gravity and forces of interaction with the terrain and other particles. The movement is described by the [PERSON] and Euler equations. Collisions are identified by colliders.