1 Introduction

It is well known that stress concentration, plastic strain localization as well as nucleation of microcracks and microdefects are controlled by the interfaces between microstructure constituents. Damage accumulation at the lower scale is generally followed by macroscopic failure of the engineering structure. Therefore, the knowledge of deformation and fracture mechanisms operating at the micro- and mesoscales is of critical importance for an accurate prediction of structure reliability and material lifetime under loading.

The value of microscale strains and stresses developing in the near-interface regions is, among other factors, controlled by the difference in mechanical properties of the contacting materials. The stronger the difference, the higher stresses may appear near the interfaces. Thus, the microscale stress–strain analysis acquires particular importance for composite materials characterized by a wide variety of well-defined interfaces between the constituents with strongly distinct properties. Even minor changes in the composite microstructure (e.g., chemical composition, shape and size of the reinforcing particles, their volume content and spatial arrangement) may lead to a change in the deformation mechanisms dominating at certain scales and thus affect the failure scenarios [1,2,3,4,5,6,7,8,9]. As an example, the effect of particle shape on the fracture mechanisms was studied in Ref. [9] for elastic-brittle particles embedded in an elastic–plastic matrix. A spherical particle was shown to exhibit interface debonding, while an irregular-shaped particle occupying the same volume experienced through-the-thickness crack propagation.

Along with experimental methods, a useful tool for studying multiscale deformation processes in polycrystalline and composite materials is the microstructure-based simulation, where the material microstructure is taken into account explicitly (see, e.g., [10,11,12,13,14]). While considerable progress in this field has been made in the recent few decades, the microstructure-based numerical analysis in many cases remains to be a challenge for the researchers primarily due to technical difficulties in its numerical implementation. For instance, among the key problems is the numerical solution to a quasistatic boundary-value problem, which requires substantial computational resources. On the one hand, the computational domain under study has to contain a sufficient number of structural elements for the micro- and mesoscale processes to be simulated as realistically as possible. On the other hand, the microstructure constituents and interface regions have to be approximated in sufficient detail to ensure a reasonable accuracy of the solution. In many cases, high-resolution computational meshes require the memory and computational time too large to make the numerical analysis practical.

Another challenging task is the construction of microstructure models including an explicit consideration of the geometrical features of the material constituents. Construction of a 2D model implies graphical reduction of an experimental microstructure image to a pure-color map and its subsequent meshing, which generally presents no difficulties [3, 7, 15]. This task, however, becomes much more complicated in a 3D case, where reproducing a real microstructure requires a series of microstructure images arranged layer-by-layer with a high spatial resolution. The experimental methods which would provide necessary data are based on the specimen sectioning techniques. Some of them use a successive removal of the material surface layers [8], while others are based on nondestructive testing (e.g., X-ray tomography [16,17,18]). While providing the most realistic and accurate microstructure description, the experiment-based methods are generally rather expensive and time consuming.

An alternative approach to designing 3D models of microstructure involves computer-aided simulations. Over a few recent decades, a number of methods for simulating 3D microstructures have been developed, including Monte Carlo [18, 19], Voronoi tessellation [10, 20,21,22], cellular automata [23,24,25], phase field [26], gravitational [27] and other methods. Some of them are reduced to a geometrical description while others take into account the physical phenomena governing the microstructure evolution (e.g., solidification, recrystallization, grain boundary migration, etc.). For most part, the methods are applicable to designing a certain kind of 3D microstructures. A comprehensive review of the methods in use is given in Refs. [27,28,29].

In this paper, we present a semi-analytical method, the so-called step-by-step packing (SSP), enabling us to design 3D microstructure models with a wide variety of geometrical features. The main idea of the method is to pack a pre-meshed volume with 3D microstructure elements in a stepwise fashion in accordance with a set of geometrically based algorithms specific for each type of the microstructure. The advantages of this method are the simplicity of numerical implementation, low computational costs and a possibility of designing microstructures with various geometrical features. Its disadvantage consists of the fact that every kind of the microstructure morphology calls for specific consideration, including the choice of input parameters and modification of design algorithms.

In the recent years, the SSP method has been successfully applied in the micromechanical simulations of polycrystalline metals [14, 30], two-phase composites [9, 31], coated and welded metals [32,33,34], and natural materials [35], but the numerical aspects of the SSP generation have never been given in sufficient detail. In this paper, we extend the SSP algorithms to generate microstructures typical for additive manufactured materials, friction stir welds, composites reinforced by irregular particles and others with special focus being on the discussion of numerical implementation.

2 Method of step-by-step packing

The construction of a geometrical microstructure model is the starting point in the microstructure-based numerical analysis. In our design of 3D microstructures of different kinds, we developed a method of step-by-step packing based on a combination of analytical and simulation tools. Let us look at the major steps of the SSP procedure intended for the general case. For illustration, the steps of the SSP construction of a polycrystalline structure are shown in Fig. 1.

Fig. 1
figure 1

Steps of SSP generation of a polycrystalline structure: a meshing, b seed distribution, c seed growth by the equation of a sphere, and d resulting structure

2.1 SSP input data

In the initial step, an arbitrary-shaped computational domain is discretized by a regular or irregular mesh, with the coordinates being determined in nodal and central points of the mesh elements (Fig. 1a). Each mesh element is associated with a digital index (DI), which indicates that this element belongs to a certain microstructure constituent. Initially, all mesh elements have the same DI equal to zero, suggesting they belong to none of the microstructure constituents. As the input data, some selected mesh elements referred to as microstructure seeds are assigned nonzero indices (Fig. 1b). Seed coordinates are determined in the central points of the seed mesh elements. Each seed is associated with an analytical function controlling its growth in the SSP procedure. Note that the seeds with different DIs can obey the same growth law. When implemented in the finite-element (FE) or finite-difference (FD) calculations, the mesh elements having the same DIs are assumed to belong to the microstructure constituents of the same type (e.g., grains of certain orientations, reinforcing particles with the same properties, pores, etc.), implying that they would be assigned the same constitutive models.

Since the SSP-designed microstructure is aimed at being further implemented in a boundary-value problem, the choice of the specimen geometry and mesh parameters (mesh density and element types) is dictated by the mechanical problem and the method of its numerical solution. As an example, a polycrystalline structure generated on a part of the dog-bone-shaped specimen is shown in Fig. 2b.

Fig. 2
figure 2

Schematic representation of the SSP grain growth by the equations of a sphere and ellipsoids (a) and the grain structure generated on a part of the dog-bone-shaped specimen using Eq. (3) with \(R_{a} = R_{b} = R_{c}\) for all grains (b)

2.2 SSP procedure

Generally, the SSP procedure is implemented via the following algorithm. The growth law for each seed is determined by an analytical function according to which the volume surrounding the seed is incremented in each step of the SSP procedure (Fig. 2a). The equations of ellipsoids, spheres, cylinders, etc. are the basic analytical functions enabling us to construct microstructures typical of many materials. Let us write the equations relative to a global Cartesian coordinate system \(x_{i}\) associated with the specimen geometry. According to a spherical law, the volume surrounding the nth seed is confined within a surface described by the equation of a sphere with the radius \(R^{n}\) (Fig. 2a):

$$(x_{1} - x_{1}^{n} )^{2} + (x_{2} - x_{2}^{n} )^{2} + (x_{3} - x_{3}^{n} )^{2} = R^{n} ,$$
(1)

where \(x_{i}^{n}\) are the coordinates of the nth seed. The radius \(R^{n}\) is incremented by the value \(\Delta r^{n}\) in each step of the SSP procedure, thus increasing the volume surrounding the nth seed. The value \(\Delta r\) preset for each individual seed or a group of seeds controls the seed growth rate. To avoid the appearance of rough stepwise interfaces between the microstructure constituents, the maximum value of \(\Delta r\) has to be three–four times smaller than the mesh step.

In a similar way, the growth of microstructure elements is described by the equation of an ellipsoid in the form:

$$\frac{{(x^{\prime}_{1} - x_{1}^{n} )^{2} }}{{(R_{a}^{n} )^{2} }} + \frac{{(x^{\prime}_{2} - x_{2}^{n} )^{2} }}{{(R_{b}^{n} )^{2} }} + \frac{{(x^{\prime}_{3} - x_{3}^{n} )^{2} }}{{(R_{c}^{n} )^{2} }} = 1$$
(2)

or

$$\frac{{(x^{\prime}_{1} - x_{1}^{n} )^{4} }}{{(R_{a}^{n} )^{4} }} + \frac{{(x^{\prime}_{2} - x_{2}^{n} )^{4} }}{{(R_{b}^{n} )^{4} }} + \frac{{(x^{\prime}_{3} - x_{3}^{n} )^{4} }}{{(R_{c}^{n} )^{4} }} = 1,$$
(3)

where \(x^{\prime}_{i} = A_{ij} x_{j}\), \(A_{ij}\) are the components of the rotation matrix determining the ellipsoid orientation relative to the global coordinate system \(x_{i}\). At each step of the SSP process, \(R_{a}^{n}\), \(R_{b}^{n}\) and \(R_{c}^{n}\), the semi-axes of an ellipsoid surrounding the nth seed, are incremented by the values \(\Delta r_{a}^{n}\), \(\Delta r_{b}^{n}\) and \(\Delta r_{c}^{n}\), respectively (see scheme in Fig. 2).

As the volumes of all seeds are increased, for all mesh elements belonging to none of the microstructural phases, it is subsequently checked whether the coordinates of their central points fall within any of the increased seed volumes. If this is the case, the zero DI of the mesh element is replaced with the DI of the respective seed and, thus, the mesh element is assumed to belong to the respective microstructural phase. All mesh elements with nonzero indices are discarded from further analysis. The SSP procedure is repeated until the growing phases reach the preset volume content. For example, in the case of a polycrystalline structure presented in Fig. 1d, 100% of the volume of the computational domain was packed with grains, which means that nonzero DIs were assigned to all mesh elements.

2.3 Efficient numerical implementation

It is evident that SSP generation requires by far fewer computational resources than other methods of microstructure simulations, and the computational costs can be further reduced with some ad hoc tools. One of the ways to make SSP generation more efficient is the preliminary design of a microstructure on a coarse mesh. As an example, Fig. 3a, b shows the microstructures generated with the same input parameters on the meshes with different resolutions. In both simulations, the SSP procedure was terminated when the volume fraction of the particles reached 40%. It is worthy of note that the mesh resolution has but a minor effect on the resulting structure pattern. While finer meshes provide smoother interfaces (Fig. 3b), the shape, size and spatial arrangement of the particles are the same as those for coarser meshes. It is, therefore, reasonable to test SSP parameters on coarse meshes and then apply them in constructing a detailed microstructure of the same geometry on a finer mesh.

Fig. 3
figure 3

SSP generation with the same parameters on a coarse mesh (a) and on a fine mesh (b)

Another method for reducing the computational time is based on numerical implementation of the SSP algorithms. Since in each SSP step the volumes surrounding the seeds are incremented by the values much smaller than the mesh step, only those mesh elements with zero DIs could fall within the growing volumes whose neighbors were assigned nonzero DIs in the previous step. Thus, from all mesh elements belonging to none of the microstructural phases, we select only those neighboring at least one of the elements with nonzero DIs. For each selected element, it is subsequently checked whether its coordinates fall within any of the growing regions with the same DIs as the neighboring elements have. Apparently, the larger the number of seeds with the same DIs, the longer is the check process. It is, therefore, reasonable to assign a unique DI to each seed when forming a set of the input data, even though all the seeds are assumed to grow by the same rules and at the same growth rate. In the postprocessing stage, the microstructure elements thought to have the same material properties are merged into a single phase, which takes on much less time than it does in the SSP procedure. For illustration, a two-phase structure is presented in Fig. 4. First, the SSP structure was generated on a coarse mesh (Fig. 3a). Each seed was assigned a unique DI even though all seeds grew by the same law at the same growth rate. Then a similar structure was generated on a finer mesh (Fig. 3b) using the input data and SSP algorithm. In the postprocessing stage, all the particles were reassigned the same DIs and, thus, merged into a single phase (Fig. 4). The resulting structure consists of two phases which could be treated, e.g., as a matrix and reinforcing particles or a material with pores.

Fig. 4
figure 4

Merging particles into a single phase

Finally, some postprocessing operations can be used to improve the interface geometry. Particularly, stepwise interfaces between the microstructural elements going through the nodes of a rectangular mesh can be subject to Laplacian smoothing. To this end, new coordinates are calculated for each interfacial node based on the position of its neighbors (see, e.g., [36] for detail). This operation has both advantages and disadvantages. On the one hand, the interfacial steps may give rise to unphysical stress and strain concentrations; smooth interfaces would, therefore, provide more natural results in micromechanical analysis. On the other hand, interface smoothing commonly requires remeshing of the interfacial regions with tetrahedral elements. Low-order tetrahedral elements are not recommended for solving the elastic–plastic problems due to their unphysical stiffness [37], while the use of higher order tetrahedral elements increases the computational costs. From this viewpoint, hexahedral elements are thought to be a better choice for simulating the elastic–plastic deformation phenomena, with a reasonable solution accuracy gained by mesh refining.

3 SSP generation of polycrystalline and composite microstructures

3.1 Seed distribution and growth law effects in the generation of polycrystalline models

The main parameters controlling the resulting microstructure geometry are the number of seeds, their types and spatial distributions, and the laws of their growth. Again, there is no unique way for choosing the SSP parameters since each kind of microstructure requires a special consideration. In the general case, these parameters have to be selected in a way to obtain a good correspondence between the model and real microstructures. The correspondence criteria based on statistical and visual estimations vary for different kinds of microstructures. Thus, for polycrystals, along with the visual analysis we can compare the statistical data on the grain size and edges-per-grain distributions obtained for the model and real microstructures. For particle-reinforced composites, the correspondence criteria are based on the estimations of the matrix-to-reinforcement volume ratio, particle shape, size, clusterization degree, etc.

In some cases, the SSP parameters providing a microstructure with desired geometrical features can be directly derived from the experimental data, while in other cases this is a more sophisticated task and its solution relies on the researcher’s intuition and experience. The latter requires the knowledge of the effects the SSP parameters exert on the resulting structure patterns. Let us illustrate the seed distribution and growth law effects using the examples of polycrystalline structures presented in Figs. 5 and 6.

Fig. 5
figure 5

SSP generation of polycrystalline structures using different seed distributions (color figure online)

Fig. 6
figure 6

SSP generation of polycrystalline structures using different grain growth laws: the equations of a sphere (a) and ellipsoids (b, c), and their combination (c) (color figure online)

Figure 5 shows a few polycrystalline models constructed on a mesh consisting of 200 × 200 × 200 hexahedral elements for different seed distributions. Generally, the seed distributions are characterized by the number of seeds, their types, the quantity of seeds of each kind, and their spatial arrangement. Evidently, the number of seeds per mesh element is the parameter controlling the accuracy of grain approximation. In our case, the number of seeds was equal to 2000 in all simulations, each seed having a unique DI. In the SSP process, all the seeds were grown by Eq. (1) at the same growth rate. The only thing varied in the simulations was the seed spatial arrangement which was responsible for the difference in the resulting patterns (Fig. 5).

Another set of calculations illustrates the effect of grain growth laws on the resulting microstructures. The polycrystalline models presented in Fig. 6 were generated on the 200 × 200 × 200 meshes using the same seed distribution but different grain growth laws. Two thousand seeds were scattered over the computational domain as shown in Fig. 5a. Note that each grain inherits the color of the seed it is grown from. To design the polycrystal with equiaxed grains shown in Fig. 6a, all grains were grown at the same growth rate in accordance with the equation of a sphere, Eq. (1). The grain shape is typical for many crystalline solids. Each grain is a convex polyhedron with plane faces and straight-line edges. This is the case of a polycrystalline geometry commonly constructed by Voronoi tessellation (see, e.g., [10, 22]). In the design of polycrystals with extended grains shown in Fig. 6b, c, the growth of all grains obeyed the equation of an ellipsoid, Eq. (3), with the aspect ratios of ellipsoid semi-axes being 2:3:2 and 1:2:1, respectively. The grain orientations were determined by a rotation matrix \(A_{ij}\) (see Eq. (3)) so that all grains in Fig. 6b were oriented horizontally, while those in Fig. 6c were tilted at an angle of 45°.

A common feature of the polycrystals presented in Fig. 6a–c is that the differences in the shape and size of the grains in each model are insignificant. In contrast, the microstructure presented in Fig. 6d demonstrates two structure components markedly differing in shape and size. Large green-color grains (Fig. 6d) are the irregular-shaped crystallites whose surface is formed by convex and concave faces. The second structure component is represented by small spherically shaped particles located inside the grains and near the grain boundaries. To design this kind of structure, 50 seeds randomly selected out of 2000 (Fig. 6d, green color) were grown at the same growth rate by the equations of ellipsoids equi-inclined to the specimen axes with the semi-axis aspect ratios 1:2:1. The rest of the seeds grew at the same growth rate in accordance with the equation of a sphere, Eq. (1). The value of the radius increment was the same as that of the minor axes of the ellipsoids described by Eq. (3). It is worth noting that the grains grown by Eq. (3) are irregular-shaped with both the concave and convex surface regions present (Fig. 7b), while those grown by the equations of a sphere at the same rate (Eq. (1)) are convex polyhedrons (Fig. 7a). The latter grains are typical for polycrystals constructed by Voronoi tessellation.

Fig. 7
figure 7

Typical shape of grains in polycrystals designed with spherical (a) and ellipsoidal laws (b)

Despite the fact that no particular materials were taken into consideration when constructing the models shown in Figs. 5 and 6, the polycrystalline structures obtained turned out to be typical of some real materials and processing techniques. For example, the equiaxed grain structures like those presented in Figs. 5a and 6a are characteristic of many as-received metals and alloys (Fig. 8a), while coaxially oriented elongated grains (Fig. 6b, c) commonly appear in polycrystalline metals after rolling. A gradual increase in the grain size with the distance from the surface, Fig. 5b, is observed in materials subjected to ultrasonic surface treatment [33, 39] (Fig. 8b). The polycrystalline structure in Fig. 5d with columnar grain arrangement is similar to that formed on the advancing side of a friction stir weld (Fig. 8c). Strongly elongated polycrystalline grains grown on an equiaxed grain substrate (Fig. 5c) are typical for metals manufactured by selective laser melting (Fig. 8d) [6, 40]. Finally, spherical particles in the two-component structure shown in Fig. 6d could be treated as second-phase precipitates, pores, etc. The examples at hand demonstrate that using different variations and combinations of seed distributions and growth laws it is possible to construct microstructure models with a wide variety of geometrical features.

Fig. 8
figure 8

Examples of experimental polycrystalline structures: a commercial purity titanium [38], b a surface-modified titanium alloy [33], c advancing side of an aluminum friction stir weld [13], and d selective laser melted aluminum alloy

3.2 SSP models of particle-reinforced composites

Morphological features of composite materials vary in a wide range with each kind of microstructure geometry calling for special consideration. Let us consider some examples of SSP applications in generating microstructural models of particle-reinforced composites.

The SSP generation of a two-phase microstructure consisting of a homogeneous matrix reinforced by round-shaped particles is illustrated in Figs. 3 and 4. In this particular case, all particles were grown by Eq. (1) at the same growth rate until they occupied 40% volume. Even after merging, the particles have no sharp corners. This kind of microstructure is typical for many composites and porous ceramics. In a similar way, more complicated composite structures consisting of regularly shaped particles of different size, volume fraction, spatial distribution, etc. can be generated.

Simulation of irregular reinforcements whose shape is not described analytically is a more sophisticated task. To do so, the SSP models can be processed in a multistep manner. Particularly, some Boolean operators can be used to merge or subtract selected phases of a polycrystalline model. In numerical implementation, the Boolean operations are applied to a set of DIs. For example, the result of a Boolean operation is illustrated in Fig. 9, where the reference grain structure is converted to that consisting of two phases. Each grain of the referenced polycrystalline structure has a unique DI (Fig. 9a). In postprocessing, most grains are assigned the same DI equal to 1 (white grains in Fig. 9b), while some selected isolated grains are assigned a different DI equal to 2 (red grains in Fig. 9b). The resulting two-phase microstructure (Fig. 9c) can be treated as a matrix reinforced with particles of irregular shapes like those in many real composite materials.

Fig. 9
figure 9

Grain merging: a reference grain structure, b grain merging, and c resulting two-phase structure

Another operation is a postprocessing reconstruction of some selected regions or sets of microstructure elements using new rules. The illustrative example is presented in Fig. 10. To design the reference model shown in Fig. 10a, two kinds of seeds were scattered over the meshed volume. In the SSP procedure, the regions surrounding the two kinds of seeds were grown according to Eqs. (3) and (1), respectively, while the growth rate of the ellipsoidal grains was several times higher than that of the spherical particles. The resulting model consists of two distinct phases of large grains and small spherical particles, Fig. 10a. In postprocessing, some large grains were selected to be reconstructed with finer grain structure (white-color regions in Fig. 10b). To do so, new seeds were randomly distributed over the selected regions and the SSP procedure was applied to design a new grain structure there. The resulting microstructure is shown in Fig. 10c.

Fig. 10
figure 10

Redesign of selected regions: a reference structure, b distribution of new seeds in selected grains (white-color regions), and c resulting structure (color figure online)

4 Summary

A semi-analytical method of step-by-step packing (SSP) to design three-dimensional microstructure models of composite and polycrystalline materials has been presented in greater detail. This method was successfully used to construct microstructure models of many materials applied in microstructure-based micromechanical simulations, but the aspects of its numerical implementation were poorly addressed before. In this paper, the method has been described in more detail with convincing illustrative examples.

The SSP method implies generation of a microstructure on a mesh according to the analytically determined seed growth functions. In the general case, the SPP procedure includes the following steps. A 3D volume to be filled with a microstructure is discretized with a regular or irregular mesh. Certain mesh elements are selected to be seeds of the microstructure elements. Seeds of each kind are associated with certain analytical functions, e.g., the equations of spheres, ellipsoids, etc., according to which the volumes surrounding the seeds are grown in the SSP generation. In each subsequent SSP step, for all mesh elements not belonging to any microstructure element yet, it is checked whether they fall within any of the incremented seed volumes. Thus, the meshed volume is filled with a microstructure in a stepwise manner.

It has been shown in particular examples that using different growth laws and seed distributions in various combinations it is possible to construct 3D microstructure models with a wide variety of geometrical features. If necessary, the SSP models can be further processed by means of Boolean operations, interface smoothing, and reconstruction of selected regions. An efficient numerical implementation involves a preliminary design on a coarse mesh to choose SSP parameters providing the desired microstructure geometry, and a subsequent SSP design on a finer mesh using the parameters thus specified. It is worthy of note that the SSP models being meshed by default can be directly imported into finite-element or finite-difference computations.