## 3 Modeling  
### Modeling Domains and an Interface between Them  
Two modeling tools are used to model the SLM process. The first one based on Unity implements the PBG model. The domain of size 100 \(\times\) 100 \(\times\) 100 m\({}^{3}\) is applied. Such a large domain is caused by the relatively large gaps between the particles and between the particles and other elements of the modeled domain (walls, floor, or terrain). The gap is almost independent of the domain size and in the range of about 0.1-0.5 m or 0.1-0.5% of the modeling domain but it reaches about 2-10% of the particle size. The scale of the disposed particles depends on the sizes of the modeling domain of the second modeling tools and the real sizes of the particles. To reduce the gap and reach the real packing density, the sizes of the deposited particles are slightly increased during the transfer from Unity. The input data for powder deposition include the type of particle shape (atomized or arbitrary), distribution of particle size, and deposition basement, which can be presented by the terrain collider described using heights in the nodes of the horizontal mesh. The output information consists of a list of the particles in parametric form. There are several types of grains, coordinates of the center of mass, scales of three local axes of the particle, and three Euler rotation angles. There are 50 types of particles of arbitrary-shaped and spherical particles. When the atomized particles are deposited, the scales of three local axes are the same. They determine the radius of the sphere, and the rotation angles are irrelevant. The second tool for modeling is the code developed the author of this study for parallel calculations on a GPU (graphics processing unit) and CPU (central processing unit) and visualization with OpenGL. It performs the internal circuit of the algorithm (Figure 3) and is based on the LBM. The interfaces between the Unity and LBM modules in both directions are part of this code and include the cycle initialization and powder removal model. Transfer of the disposed particles from the Unity domain to the LBM domain takes place in parametric and discretized forms with scaling. The sizes of the discretized Unity and LBM domains can be set independently, but the sizes of the cells in both domains should be the same. The name 'cell' originates from the CA method and defines the volume of the LBM nodes. The neighboring cells are in contact with each other without a gap; that is, the sizes are equal to the length between the nodes. Then, the sizes of the discretized Unityand LBM domains are defined by the number of cells in three dimensions. Therefore, the number of cells of the LBM domain in each direction should be equal to or less than those in the Unity domain. The size of the cell is mainly defined by the conditions of the simulated process. This means that the sizes of the particles in Unity should be in agreement with the sizes of the cells before the simulation of powder deposition in Unity. For example, if the two domains in the horizontal plane are of the same number of cells (equal to 256 \(\times\) 256), the cell sizes in the LBM domain are 1.25 \(\upmu\)m, and the particle radius is 10 \(\upmu\)m, then the radius of this particle in the Unity simulation is 3.125 m (= 25/1.25 \(\times\) 100/256). The more general equation for such calculations is as follows:  
\[R_{\text{U}}=\frac{RL_{\text{U}}}{N_{\text{U}}l_{\text{c}}} \tag{1}\]  
where \(R_{\text{U}}\) is the particle radius in the Unity domain (m), \(R\) is the real particle radius in the LBM domain (\(\upmu\)m), \(L_{\text{U}}\) is the size of the Unity domain (m), \(N_{\text{U}}\) is the number of cells in one direction in the Unity domain, and \(l_{\text{c}}\) is the cell size in the LBM domain (\(\upmu\)m). The initialization of the cycle also contains a schedule of the laser movement and pauses between the subsequent tracks. The schedule is loaded from the previously prepared file.