# Two-Dimensional Mesoscale Finite Element Modeling of Concrete Damage and Failure
## 2 Two-Dimensional Heterogeneous Mesostructures of Concrete
### Aggregate Packing  
The next step after the aggregates are generated is their random distribution within the concrete mesoscale specimen. This process is called the placing process. During placement, three important conditions must be met. These conditions are as follows:  
1. The aggregate must be placed completely within the boundaries of the concrete specimen without crossing them. 2. The newly placed aggregate must not overlap with already placed aggregates. 3. A small gap should be left between each two positioned aggregates to create a mortar layer thickness between the aggregates. To meet all of the above conditions, the following intersection checks must be performed:  
* Check 1 The first condition is satisfied if all vertices of the generated aggregate lie within the boundary of the mesoscale concrete specimen. For the transfer of the generated aggregate within the boundaries of the concrete specimen, a translation vector is generated by extracting a random coordinate whose origin is at the center of the coordinate system. The chosen random value must be within the main frame of the mesoscale specimen. After the translation process, the coordinates of all vertices are compared with the main frame coordinates of the concrete, and if an overlap is detected, a new translation vector is built until the first condition is satisfied. After the first condition is satisfied, the overlap of the newly placed aggregate with already placed aggregate particles is checked. For circular and elliptical aggregates, this task is simply solved by implementing the corresponding construction Equations (see Equations (4) and (6)). For this purpose, two main intersection processes must be performed as follows:  
* Check 2 and Check 3 Intersection check 2 and check 3 are carried out simultaneously. Assume that the constructive Equation of the newly placed aggregate particle is denoted by \(f(x,y)\). To perform intersection check 2, the value of \(f(x,y)\) is calculated using the constructive vertices of each already placed aggregate. If the value of \(f(x,y)\) is equal to or smaller than one, this indicates that at least one already placed aggregate has an intersection with the new aggregate and the newly placed aggregate must be removed from the main frame. In addition, intersection check 3 is performed automatically by setting the minimum value of \(f(x,y)\) in intersection check 2 to 1.2. In this way, a small gap between the aggregate particles is realized. Therefore, the small gap condition is simultaneously fulfilled in this step. Check 4 The fulfillment of intersection check 2 and check 3 is a necessary condition. However, it is not sufficient, because in the developed Python code, the placement process always starts with the aggregates with larger sizes and it may happen that the newly placed aggregate is exactly inside the already placed aggregate without intersecting its boundaries. This condition cannot be detected by intersection check 2. To solve this problem, the constructive Equation of the already placed aggregate is established and its value is checked with the vertices of the newly placed aggregate. In this condition, if the result of the constructive equation becomes less than one, it shows that the smaller newly placed aggregate is exactly inside a larger aggregate and this aggregate must be removed from the main frame. The algorithms developed for this study automatically determine the morphology of the mortar layer based on the inserted aggregate particles, thereby providing control over the minimum thickness between two adjacent aggregates. When an aggregate particle is introduced, its contributing nodes are factored into the equations of previously positioned aggregates. Intersection with existing aggregates is indicated by equation outcomes less than 1, necessitating the removal of the newly inserted aggregate. Conversely, an outcome greater than 1 confirms non-intersection.