1 Introduction

Additive manufacturing (AM) is becoming increasingly popular in industries. Metal AM processes such as selective laser melting (SLM) [1, 2], selective electron beam melting (SEBM) [3] and selective laser sintering (SLS) [4] are layered approaches fabricating the products with complex shapes [5, 6]. One of the bottlenecks for metal AM is the thermal stress caused by the large temperature gradients during the high-frequency heating–cooling cycles [7]. High residual stress may result in defects [8, 9] such as the part distortion [10, 11], delamination [12] and poor fracture resistance [13,14,15]. The investigation of temperature history and stress evolution is therefore necessary for optimising the manufacturing parameters during the AM process.

Due to the large temperature gradients and high-frequency heating–cooling cycles during the manufacturing process, it is difficult to monitor the temperature and thermal stress in real time during experiments. For the residual stress measurement, the experimental approaches, such as the neutron diffraction [16, 17], X-ray diffraction [18], contour method [19] and semi-destructive hole drilling method [20, 21], are costly and sometimes limited to surface measurements. Numerical simulations are efficient to study the mechanical behaviours during the manufacturing process [22]. The finite element method (FEM) has been widely used in simulating thermal stresses in AM [23, 24]. One type of such models is based on the inherent strain method, where the deposited regions are activated with predefined strains to calculate the final deformation and residual stress of the part [25]. These models are computationally efficient, but the accuracy may be compromised due to the uncertainties of the inherent strains. Another type is thermo-mechanical coupling, where the temperature profile is calculated by solving the governing equations of heat transfer and then serves as the load for thermal stress calculation [26, 27].

Thermo-mechanical models are mostly constructed based on many geometrical simplifications and physical assumptions as the heat transfer part does not incorporate the thermal-fluid flow effects [28]. Most of the FEM simulations failed to resolve the track morphology and molten pool evolution as all the tracks are assumed to be uniform. Therefore, those simulations are only able to predict the overall part distortion at the macroscopic scales, but cannot calculate the thermal stress at the microscale.

An emerging type of the thermal stress models is the coupling between the computational fluid dynamics (CFD) and FEM models [29,30,31,32]. These coupled CFD-FEM models analyse the thermal stress and deformation using the high-accuracy temperature profiles output from the CFD simulations, particularly the powder-scale thermal-fluid flow simulations [33], instead of those from simplified analytical models [34]. Cheon et al. [30] proposed a CFD-FEM framework for welding to analyse the thermal stress along a single welding line, but the model did not consider the residual stress reset due to melting. Bailey et al. [29] implemented the temperature and surface profiles from thermal-fluid flow simulations into an FEM residual stress model to simulate the multi-track manufacturing cases of the laser directed energy deposition (DED) process. In our previous work [31], we simulated the multi-layer multi-track SLM process by mapping the temperature profiles from the high-fidelity thermal-fluid flow simulation into the FEM model, enabling the high resolution of the molten pool evolution and the morphology (rough surfaces and inner voids) of the FEM model. The quiet element method was used to simulate the melting and solidification, where the melted materials are assigned with null material properties.

There are two critical but common problems in the aforementioned thermo-mechanical models and CFD-FEM models:

  1. 1.

    How to represent the melting and solidification while avoiding numerically-induced deformation and numerical divergence. In the previous models, two methods are commonly used: first, the element activation method [24, 35,36,37,38] can activate elements for solidified materials but cannot deactivate elements again due to remelting, while the surface nodal temperature obtained by the interpolation between active and inactive elements [39] can cause significant inaccuracy and divergence problems. Second, the quiet element method [38,39,40], which is essentially the same as the stiffness degradation method commonly used in fracture mechanics [41,42,43], can remove the effect of the liquid phase on the solidified region, however upon solidification the liquid phase becomes solid with initial deformation that is incompatible with the deformation of the surrounding solid region, which induces un-physical deformation and may also cause numerical divergence.

  2. 2.

    None of the previous models has considered the detailed grain structures and the resultant temperature-dependent anisotropic mechanical properties at the microscale. Using simplified homogenized constitutive laws, the previous models cannot resolve the micro-scale residual stress [44], which can result in unique mechanical properties of the AM parts significantly differing from those by the conventional manufacturing [45].

In this paper, a crystal plasticity finite element model (CPFEM) [46, 47] is developed, incorporating the temperature profile from the thermal-fluid flow simulation [31] and grain structure from the grain growth simulation [48] and experimental data [44, 49], as to be described in Sect. 2. Particularly, an element elimination and reactivation method is proposed to model the melting and solidification. The comparison between this novel method and an alternative method based on the degradation of the stiffness tensor is carried out. The developed algorithm can reinitialize the state variables, as tested in a simple case in Sect. 3, such as the plastic deformation of the solidifying elements, which is critical to avoid the pre-existing plastic deformation just after solidification. Model calibration and simulation cases of SLM of 316 stainless steel are conducted as described in Sect. 4. The proposed element elimination and reactivation method and the commonly used stiffness degradation method are compared in terms of prediction accuracy, convergence and computational efficiency. Based on the simulation results, the formation of residual stresses in different grains and the correlation between plastic deformation, depth and residual stress are discussed in Sect. 5. The residual stress predicted by the model is compared to X-ray diffraction experiments on single and multi-layer SLM specimens.

2 Material model

2.1 Crystal plasticity framework

A crystal plasticity material model including thermal response is used for this work. The deformation gradient \({\varvec{F}}\) can be decomposed into elastic, thermal and plastic parts [16, 50,51,52]:

$$\begin{aligned} {\varvec{F}}={\varvec{F}}_e {\varvec{F}}_{th} {\varvec{F}}_p, \end{aligned}$$
(1)

where \({\varvec{F}}_e\) is the elastic part including the stretching and rigid body rotation, \({\varvec{F}}_{th}\) is thermal part and \({\varvec{F}}_p\) is the irreversible plastic deformation, which evolves according to [53, 54]:

$$\begin{aligned} {\varvec{L}}_p = \dot{{\varvec{F}}}_p {\varvec{F}}_p^{-1} = \sum _{\alpha =1}^n {\dot{\gamma }}^{\alpha }{\varvec{m}}^{\alpha } \otimes {\varvec{n}}^{\alpha }, \end{aligned}$$
(2)

where \({\dot{\gamma }}^{\alpha } \) is the shear rate of slip system \(\alpha \). The vectors \({\varvec{m}}^{\alpha }\) and \({\varvec{n}}^{\alpha }\) are unit vectors which describe the slip direction and normal of slip plane \(\alpha \), respectively. n is the number of slip systems in active state.

The plastic strain rate on slip system \(\alpha \) of face-centered cubic metals can be calculated by a power-law equation [55, 56]:

$$\begin{aligned} {\dot{\gamma }}^{\alpha }={\dot{\gamma }}_0 \left| \frac{\tau ^{\alpha }}{\tau _c^{\alpha }(T)} \right| ^{\frac{1}{m}} \text {sgn}(\tau ^{\alpha }), \end{aligned}$$
(3)

where \(\tau ^{\alpha }\) is the resolved shear stress, \(\tau _c^{\alpha }\) is the temperature dependent critical resolved shear stress (CRSS), \({\dot{\gamma }}_0\) and m are constants, which indicate the reference strain rate and rate sensitivity of slip, respectively.

An exponential model calibrated by experiments can be used to calculate the CRSS change with temperature decrease of each slip system [57, 58]:

$$\begin{aligned} \tau _c^{\alpha }(T)= \left( k_A+k_{B}\cdot \mathrm{exp} [-k_{C}(T-T_0)] \right) \cdot \tau _c^{\alpha }(T_0), \end{aligned}$$
(4)

where \(\tau _c^{\alpha }(T)\) is the CRSS of slip system \(\alpha \) at temperature T, \(T_0\) is the reference temperature, \(k_A\), \(k_B\) and \(k_C\) are constants. These constants are determined by fitting the yield strength measurements by Daymond and Bouchard [57]. For slip system \(\alpha \), its hardening behaviour is influenced by other slip systems \(\beta \) as [59]:

$$\begin{aligned} {\dot{\tau }}_c^{\alpha } = \sum _{\alpha =1}^{n}h_{\alpha \beta } \left| {\dot{\gamma }}^{\beta } \right| , \end{aligned}$$
(5)

where \(h_{\alpha \beta }\) is the hardening matrix given by [53]:

$$\begin{aligned} h_{\alpha \beta }=q_{\alpha \beta }\left[ h_0 \left( 1-\frac{{\tau _c^{\alpha }}}{\tau _\text {sat}} \right) ^{a} \right] , \end{aligned}$$
(6)

where \(q_{\alpha \beta }\) is a hardening coefficient matrix for latent hardening, \(h_0\) is an initial hardening term, \(\tau _{sat}\) is the saturation slip resistance and a is a constant. The parameters of the crystal plasticity model are calibrated using the experimental data in [44].

For the thermo-mechanical response during the laser scan process, the Green-Lagrange strain tensor can be expressed by the equation composed of thermal and elastic deformation gradients as:

$$\begin{aligned} {\varvec{E}}_e = \frac{1}{2} \left( {\varvec{F}}_\text {th}^T{\varvec{F}}_{e}^T{\varvec{F}}_{e}{\varvec{F}}_\text {th}-{\varvec{I}} \right) , \end{aligned}$$
(7)

where \({\varvec{I}}\) is the identity matrix. To describe how the size of the substance changes with the temperature, the linear thermal expansion coefficient \(\alpha _l\) of 316L SS is introduced [60]. The volumetric thermal expansion coefficient can be expressed by \(\alpha _v=3\alpha _l\) [61]. Since the thermal expansion coefficient of 316L stainless steel varies slightly with temperature [62, 63], the temperature dependence is given by fitting the experimental data into a linear equation [64]:

$$\begin{aligned} \alpha _v=\alpha _0+\alpha _1(T-T_0), \end{aligned}$$
(8)

where \(\alpha _0\) denotes the thermal expansion coefficient at room temperature and \(\alpha _1\) is the linear coefficient of the temperature dependence of \(\alpha _v\). The infinitesimal volumetric change dV from \({T_0}\) to T can be described by [52]:

$$\begin{aligned} \alpha _{v}\mathrm {d}T= \frac{\mathrm {d}V}{V}, \end{aligned}$$
(9)

where V is the volume of the region and \(T_0\) is the reference temperature (room temperature). Substituting Eq. (8) into Eq. (9), the thermal eigenstrain tensor \(\varvec{\alpha }\) can be expressed by [65]:

$$\begin{aligned} \varvec{\alpha }=\frac{1}{2}\left[ \mathrm{exp}\left( \frac{1}{3}\alpha _{1}(T-T_{0})^2+\frac{2}{3}\alpha _{0}(T-T_0) \right) - 1 \right] {\varvec{I}}.\nonumber \\ \end{aligned}$$
(10)

The 2nd Piola–Kirchhoff stress can be calculated by:

$$\begin{aligned} {\varvec{S}}={\mathbb {C}}({\varvec{E}}_{e}-\varvec{\alpha }), \end{aligned}$$
(11)

where \({\mathbb {C}}\) is the rank four elasticity tensor of 316L stainless steel [66, 67]. The elasticity tensor of the solid is temperature dependent [57], which can be described by a linear function for the components:

$$\begin{aligned} {\mathbb {C}}_{ij}^{\mathrm{solid}}(T)={\mathbb {C}}_{ij}^{\mathrm{solid}}(T_0) + \frac{\mathrm {d}{\mathbb {C}}_{ij}^{\mathrm{solid}}}{\mathrm {d}T}(T-T_0), \end{aligned}$$
(12)

where \({\mathbb {C}}_{ij}^{\mathrm{solid}}(T_0)\) is the elasticity tensor component at room temperature, and the derivative term indicates the change of the components caused by temperature change. Phase change can be modelled by changing the stiffness tensor \({\mathbb {C}}\), as to be explained in Sect. 2.2. Since positive strain represents tension and negative strain represents compression, the same applies to the stress tensor components. In the following, compression will appear as a negative stress component while tension will appear as a positive stress component.

The temperature T is obtained from thermal-fluid flow simulations [31]. It should be mentioned that the temperature mapping from thermal-fluid to mechanical simulation is one-way, and the heat transfer analysis is merely conducted in the high-fidelity thermal-fluid flow simulation, from which the thermal information are extracted for the crystal plasticity calculation. Thus, deactivation of the melted parts will not affect the temperature distribution in the representative volume. In the following Sects. 2.2 and 2.3 , two alternative methods to model phase transformation are presented. Comparison between the two methods will be presented in the results in Sect. 4.

2.2 Stiffness degradation method

During the additive manufacturing process, the phase transitions cause significant change in the mechanical properties, which should be taken into consideration. Since in our simulation the temperature profiles are obtained by mapping and interpolating the thermal-fluid flow simulation results to the finite element model in time and space [31, 68], there are liquid phase and gas phase existing in the model, which represent the melted material and void region above the molten pool, respectively. Therefore, a stiffness degradation method based on the temperature field is applied here to prevent sudden changes in mechanical properties caused by the temperature dependence of the stiffness tensor and avoid the convergence problem of simulation. The specific method is to set a temperature range, called solid temperature range in the following, between the melting point \(T_m\) of 316L stainless steel and the reference temperature \(T_0\). In this temperature range, the stiffness tensor of the solid material is \({\mathbb {C}}_{ij}^{\mathrm{solid}}(T)\), which conforms to Eq. (12).

The temperature from the thermal-fluid flow simulation is recorded every 45 \(\upmu \)s and these time points are called the “CFD output” or “temperature output”. The CPFEM simulations have smaller time steps, therefore an interpolation is necessary. For instance, in the time interval \(\left[ t_1, t_2 \right] \) the temperature is interpolated linearly from \(T_1\) to \(T_2\), as shown in Fig. 1. The temperature values in the thermal-fluid flow simulation are mapped directly into the finite element model; the only modification applied to the temperature values is related to the gas phase. If one element in the thermal-fluid flow simulation is in gas or void state, then the temperature value of that specific element in the finite element model is set to be \(T_a=\) 298 K, which is lower than the reference temperature \(T_0\). This setting is useful for phase identification in the finite element model, as described in the following paragraph, because it avoids the introduction of another specific state variable to describe the phase state.

A phase identification algorithm has been implemented: if the temperature is higher than the melting temperature \(T_m\) or lower than the reference temperature \(T_0\), it means that the material is in liquid or gas phase. This algorithm transforms the stiffness matrix \({\mathbb {C}}_{ij}\) linearly with time between those of phase 1 at \(t_1\) and phase 2 at \(t_2\), as shown in Fig. 1. The equations to find the stiffness tensor are listed in Table 1. A residual stiffness coefficient \(q_r\) is introduced to describe the residual stiffness tensor of the material in the liquid or gas state:

$$\begin{aligned} {\mathbb {C}}_{ij}^{\mathrm{residual}}=q_{r}\cdot {\mathbb {C}}_{ij}^{\mathrm{solid}}(T_0) \ . \end{aligned}$$
(13)

The stiffness tensor \({\mathbb {C}}_{ij}\) in Table 1 is used in Eq. (11) and the time interpolation avoids discontinuities in the stiffness tensor that would create convergence problems.

The choice of setting the temperature of gas/void regions to 298 K does not affect the simulation results because the gas barely applies stress on the solid or liquid regions. It is worth noting that, in the thermal-fluid flow simulation, the high-temperature vapor/gas near the liquid surface is not explicitly incorporated.

Fig. 1
figure 1

Schematic of the phase identification algorithm to implement the stiffness degradation method for liquid and gas phases

Table 1 Time evolution of the stiffness tensor depending on the phase state at time \(t_1\) and \(t_2\)
Table 2 Material and model parameters used in the simulations

The equations above are implemented into the MOOSE finite element framework [69], where a Newton-Raphson approach to find the Cauchy stress tensor \(\varvec{\sigma }\) is applied. To obtain the 2nd Piola–Kirchhoff stress in Eq. (11), a function \(\varvec{\psi }={\varvec{S}}-{\mathbb {C}}({\varvec{E}}_{e}-\varvec{\alpha })\) is defined, the absolute value of which must be minimised. An iterative return mapping algorithm, in which the stress \({\varvec{S}}\) is the variable is implemented. The stress increment during the return mapping algorithm can be written as [70, 71]:

$$\begin{aligned} {\varvec{S}}_{i+1}={\varvec{S}}_{i}-\left( \frac{\partial \varvec{\psi }}{\partial {\varvec{S}}} \right) ^{-1}\cdot \varvec{\psi }, \end{aligned}$$
(14)

where i and \(i+1\) indicate two subsequent iterations. The Cauchy stress \(\varvec{\sigma }\) is obtained by [72]:

$$\begin{aligned} \varvec{\sigma }=\frac{1}{{\mathrm{det}}({\varvec{F}}_{e})}\cdot {\varvec{F}}_{e}\cdot {\varvec{S}}\cdot {\varvec{F}}_{{\varvec{e}}}^{{\varvec{T}}} \ . \end{aligned}$$
(15)

The Cauchy stress is used by the finite element solver to find the displacement field \({\mathbf {u}}\) that leads to stress equilibrium.

The parameters used in the simulations and the elastic constants of 316L stainless steel in Voigt notation are listed in Table 2.

2.3 Implementation of the element elimination and reactivation method

An element elimination and reactivation approach is developed and employed to model phase transformation. It is alternative to the stiffness degradation method explained in Sect. 2.2 and the results obtained with the two methods will be compared in the results in Sect. 4. This approach is based on a moving subdomain paradigm that is originally developed [74], which is based on MOOSE subdomain restricted system [69]. Specifically, the physical domain is divided into an active subdomain (\(\Omega _a\)) and an inactive subdomain (\(\Omega _i\)). The thermo-mechanical finite element computation is defined and carried out in \(\Omega _a\), while \(\Omega _i\) only carries the geometric information. In other words, the elements in the inactive domain, or inactive elements, do not contribute to the equation system that calculates stress equilibrium.

The active and inactive subdomains are determined only by the prescribed temperature field. At a typical CPFEM time step, any active element \({\mathcal {T}} \in \Omega _a \) with an average temperature that is above the melting temperature (i.e., \(T_{\text {avg}} > T_m\)) or below the reference temperature (i.e., \(T_{\text {avg}} < T_0\)) is moved from the active subdomain to the inactive one, i.e.:

$$\begin{aligned} \Omega _a \rightarrow \Omega _a \backslash {\mathcal {T}}, \quad \Omega _i \rightarrow \Omega _i \cup {\mathcal {T}}. \end{aligned}$$
(16)

This process mimics the solid material being eliminated from the physical domain, which happens when the material is melted around the laser beam, and is therefore referred to as element elimination. Similarly, when the average temperature of one inactive element \({\mathcal {T}} \in \Omega _i \) falls to the solid temperature range (i.e., \(T_0 \le T_{\text {avg}} \le T_m\)), it is moved to the active subdomain, i.e.:

$$\begin{aligned} \Omega _a \rightarrow \Omega _a \cup {\mathcal {T}}, \quad \Omega _i \rightarrow \Omega _i \backslash {\mathcal {T}}. \end{aligned}$$
(17)

This mimics the process of material being added back to the solid physical domain, which happens when the material solidifies behind the laser beam, thus is referred to as element reactivation. It is worth noting that this method uses the local temperature as the only criterion to determine the local phase in one element. This is possible because the gas/void phase is identified by the specific temperature 298 K, as described in Sect. 2.2.

After elements being transferred between the two subdomains, several tasks need to be accomplished before the subsequent computation. First, the boundary information is updated based on the coverage of the new subdomains. Here, the subdomain boundaries are updated for both \(\Omega _a \) and \(\Omega _i\). The boundary conditions are projected to the updated boundaries correspondingly. Second, the initial conditions of the displacement variables and the material properties that define the crystal plasticity behaviour, such as the plastic deformation (see Sect. 2.1), are projected to the quadrature points of the reactivated elements. Projection of the initial condition indicates that the displacement, strain, and stress calculations are reset to zero. This allows for the restart of the plastic deformation calculation during the simulation, which cannot be implemented easily in the stiffness degradation method. Indeed, if the elements are not eliminated and reactivated, they can still carry a certain amount of load. In the stiffness degradation method, a sudden change of the plastic deformation due to melting and solidification causes convergence problems because an elastic deformation jump, and consequent stress discontinuity, occur.

Finally, as will be shown in Sect. 4.3, the element elimination and reactivation method resolves the issue that is brought by large deformation of the reactivated elements due to the thermal expansion of the surrounding active domain.

3 Test case: element elimination during tension

The element elimination and reactivation method is tested on a simple example geometry, as shown in Fig. 2. The aim of this test is to demonstrate that inactive elements do not contribute to the stress equilibrium calculations, i.e. they do not exert stress on the active elements, and to prove that boundary conditions are implemented correctly on the continuously changing free surface.

A cubic representative volume is constituted of \(10 \times 10 \times 10\) elements and has a size of 1 \(\upmu \)m \(\times \)\(\upmu \)m \(\times \)\(\upmu \)m. Boundary condition \(u_x = 0\) is applied on the surface \(x = 0\), \(u_y = 0\) on \(y=0\) and \(y = 1\) \(\upmu \)m, \(u_z = 0\) on \(z=0\) and \(z = 1\) \(\upmu \)m. Displacement boundary condition is imposed on the surface \(x = 1\) \(\upmu \)m. \(u_x\) is increased up to 0.001 \(\upmu \)m on that surface before the element elimination algorithm starts. The element elimination algorithm is based on a prescribed temperature field, which is chosen in such a way that elements from the surface \(z = 1.0\) \(\upmu \)m are progressively removed, down to the surface \(z = 0.5\) \(\upmu \)m. The displacement \(u_x\) on the surface \(x = 1\) \(\upmu \)m is kept constant during element elimination, as shown in Fig. 2a–c, therefore \(\varepsilon _{xx}\) remains constant at the value of 0.001.

Plasticity and thermal eigenstrain are not activated in this simulation case, and the elastic constants are set as \({\mathbb {C}}_{11} = 1.5\) GPa and \({\mathbb {C}}_{12} = 0.75\) GPa. \(\varepsilon _{yy}\) and the off diagonal strain components are zero. When no element elimination has taken place, the boundary condition \(u_z = 0\) on the surface \(z=1\) \(\upmu \)m holds, therefore \(\varepsilon _{zz} = 0\) and \(u_z = 0\) everywhere in the representative volume, as shown in Fig. 2d. This lateral constraint is reflected by the large positive value of the stress component \(\sigma _{zz}\) in Fig. 2g. Therefore, a tensile stress is present on that surface.

Fig. 2
figure 2

Test case for the element elimination and reactivation method. a, b, c Firstly, a displacement \(u_x\) is applied and elements are eliminated. d The lateral displacement starts at zero, e, f then lateral contraction appears due to the newly created free surface perpendicular to the z axis. For the same reason, g the lateral stress \(\sigma _{zz}\) starts at 750 MPa, h, i then \(\sigma _{zz}\) becomes zero

After the element elimination algorithm starts, the top surface perpendicular to the z axis becomes unconstrained. Therefore, lateral contraction takes place because of the constant displacement along the x axis. The lateral contraction can be calculated as follows: \(\varepsilon _{zz} = - \left( {\mathbb {C}}_{12} / {\mathbb {C}}_{11} \right) \varepsilon _{xx} = -0.0005\). For example, in Fig. 2e, 8 elements are still present along the z axis, therefore the lateral displacement on the top surface is given by \(u_z = \varepsilon _{zz} \cdot 0.8\) \(\upmu \)m \(= -0.0004\) \(\upmu \)m. The same holds in Fig. 2f, in which the lateral displacement on the top surface is \(u_z = -0.00025\) \(\upmu \)m because 5 elements are still present along the z axis.

As shown in Fig. 2h and i, there is no lateral stress \(\sigma _{zz}\) after the element elimination algorithm starts. This proves that the method developed creates new free surfaces in the representative volume and the eliminated elements do not apply stress on the active elements.

4 Simulation of selective laser melting

4.1 Simulation setup

A modelling framework to simulate the SLM process is developed as shown in Fig. 3, including thermal-fluid flow simulations, phase field modelling for grain growth and the CPFEM using the element elimination and reactivation method as described in Sect. 2.

The temperature field is obtained from thermal-fluid flow simulations [31, 75, 76]. The governing equations are the conservation of mass, momentum and energy. Most of the physical factors are incorporated, including the ray-tracing heat source model for laser, thermal conduction, surface radiation and convection, latent heat, evaporation, recoil pressure, viscosity, buoyancy force, surface tension and Marangoni effect [32, 77]. The Volume of Fluid method [78] is applied in this thermal-fluid flow model, and the gas-liquid interface is set as a free surface [76]. The details of the thermal-fluid flow model and material parameters are reported in our previous works [75, 76].

The grain structure is obtained from a phase field model for grain growth [48], where heterogeneous nucleation and the initial grain structures in powder particles and substrate are incorporated, and the same temperature profile from the thermal-fluid flow simulation is used. The phenomena, including grain nucleation and growth, competitive growth, epitaxial growth from powder particles and substrate, and grain coarsening in heat affected zones (HAZs), are comprehensively considered and experimentally validated. The details of the grain growth model and parameters are reported in our previous work [48].

Crystal plasticity simulations of a representative region of a single-track SLM process are carried out using the representative volume in Fig. 4. The CPFEM model represents a small region inside a larger sample during SLM process, which is extracted from a section of single-layer powder and part of its underlying region. The reason for the extraction is that the deposited track will be remelted by the subsequent layers, causing the regeneration and redistribution of residual stress, while the bottom region will not be remelted, thus the residual stress can be maintained and accumulated. The dimensions along the X, Y and Z axes are 200 \(\upmu \)m, 160 \(\upmu \)m and 108 \(\upmu \)m respectively, which can accommodate the complete molten pool passing through this domain with some margin. However, it is representative of the texture because of the large number of grains included.

Fig. 3
figure 3

Flowchart of the modelling framework

A total of 4522 grains are present with different orientations. The voxels obtained from the phase field model for grain growth are mapped directly into the CPFEM mesh to produce the grain structure for subsequent simulations. The Euler angles \(\varphi _1\), \(\Phi \) and \(\varphi _2\), obtained from electron backscatter diffraction (EBSD) experiments provided by Dr. Yin Zhang and published elsewhere [44], are assigned to the grain structure in the CPFEM to get a realistic texture of AM 316L stainless steel in the simulations. This is important because the grain orientation determines both the macroscopic and microscopic mechanical properties of the sample. The pole figures corresponding to those measurements are reported in Chen et al. [44]. On the other hand, the 3D shape of the grains cannot be fully extracted from EBSD measurements, therefore simulation results from the grain growth model are adopted. Fig. 4 shows the value of \(\varphi _1\) in degrees. The average grain size is approximately 16 \(\upmu \)m. However, grains in the center of the laser track tend to be elongated along the z axis, as shown in Fig. 4.

The temperature field obtained from thermal fluid-flow simulations is projected on the mesh of the CPFEM simulations. Melting in the crystal plasticity simulations is described either by the stiffness degradation model described in Sect. 2.2 or by the element elimination and reactivation method described in Sect. 2.3. The temperature fields at different time steps are shown in Fig. 5a–c, in which the eliminated elements are hidden from view. A structured mesh made of first order hexahedral cubic elements is used. Simulations are carried out with the cubic element edge length being 4 \(\upmu \)m or 8 \(\upmu \)m, respectively. The numbers of elements are 54,000 and 7000 respectively. The simulations with different numbers of elements are made to investigate the impact of the element size on the computational cost and simulation convergence, as will be shown in Sect. 4.3.

Fig. 4
figure 4

Representative volume for the selective laser melting simulations and grain structure implemented from the phase field simulation for the crystal plasticity model. Coordinates of some vertices are labeled for clarity

Fig. 5
figure 5

Snapshots of the temperature field using the element elimination and reactivation method at a \(t = 99\) \(\upmu \)s, b \(t = 226\) \(\upmu \)s, c \(t = 451\) \(\upmu \)s; df corresponding stress component \(\sigma _{xx}\) using the stiffness degradation method

The CPFEM simulations include two parts: first the SLM process is simulated by using the temperature field from thermal fluid-flow simulations, then, when the temperature has reached \(T_0 = 303\) K in the entire representative volume, a relaxation simulation is carried out. In the relaxation simulation, some of the boundary conditions are removed, as described in the following, while temperature is maintained constant at \(T_0\). The relaxation simulation represents the relaxation of the residual stress at room temperature and the fact that also the surrounding material undergoes thermal shrinkage while reaching room temperature.

The boundary conditions used in the SLM simulations represent the constraints applied by the substrate and surrounding material. The displacement components are zero on the surfaces \(x = 0\), \(x = 200\) \(\upmu \)m, \(y = 0\) and \(y = 160\) \(\upmu \)m. The vertical displacement \(u_z\) is zero on the bottom surface, \(z = 0\), to avoid translation along the z axis. These conditions on the displacement represent the stiffness of the surrounding material. This is colder than the simulated representative volume, therefore the yield strength of the surrounding material is higher and fixed walls boundary conditions are more reasonable than free boundaries. The displacement is free on the upper surface (\(z = 108\) \(\upmu \)m), where the laser beam is present. In the relaxation simulations, the boundary conditions on the surfaces \(x = 200\) \(\upmu \)m and \(y = 160\) \(\upmu \)m are removed, thus lateral expansion of those surfaces takes place. This compensates for the fixed walls boundary conditions applied during the SLM process simulations.

A multi-layer SLM process is not simulated in this work because modelling the repeated remelting and solidification with the complete framework presented in Fig. 3 would require very long computation time. This is particularly true for this work because an iterative calibration procedure has been carried out.

4.2 Model calibration

Initially, to determine the parameters of the CPFEM model for yielding (\(\tau _c^\alpha \)) and hardening behaviour (\(h_{\alpha \beta }\)), a polycrystal model with a cubic representative volume is constructed using the Neper software [79]. It contains 1101 grains, whose orientations are obtained by the previously mentioned EBSD data of AM 316L SS, which are published elsewhere [44]. Tension boundary conditions are applied along the x direction. The comparison with experimental stress–strain curves [44], shown in Fig. 6, allows to calibrate the model parameters \(\tau _c^\alpha \) and \(h_{\alpha \beta }\). The values found are 213 MPa and 3839 MPa respectively, as reported in Table 2. The calibration simulation is performed without temperature field from AM process, but it provides approximated values of the CPFEM parameters for subsequent simulations.

Fig. 6
figure 6

Stress–strain curves of calibration simulation and experimental data [44]

4.3 Simulation convergence

The convergence speed of the simulations using the stiffness degradation method depends mainly on the residual stiffness parameter \(q_r\). A value smaller than 0.001 significantly increases the simulation time, but there is very small difference in the plastic deformation between the simulations with \(q_r=0.01\) and \(q_r=0.001\), as will be shown in the following. Simulations with both \(q_r=0.01\) and \(q_r=0.001\) are carried out.

If the element elimination method is used, the time step must be decreased immediately before and after the temperature steps at which element elimination takes place, as described in Sect. 2. In this way, good convergence can be obtained. Specifically, the time step is reduced to 0.1 \(\upmu \)s in an interval of 2 \(\upmu \)s around each temperature step, i.e. every 45 \(\upmu \)s. For instance, considering the first temperature step, the time step is reduced to 0.1 \(\upmu \)s at \(t = 44\) \(\upmu \)s and it is increased again to 1 \(\upmu \)s after \(t = 46\) \(\upmu \)s. This time step reduction applies only during the laser scan, while time step is kept constant at 1 \(\upmu \)s during the subsequent cooling stage, which is the second part of the simulation, carried out after the laser beam has exited the geometry. By contrast, in the stiffness degradation method, the value of the time step is always 1 \(\upmu \)s. Since the eliminated elements do not contribute to the residual or Jacobian calculation of the solver, the computation of each time step is slightly faster if the element elimination method is used. However, a reduction of the time step size before and after the element elimination steps is necessary in that case. Therefore, the simulations carried out with the element elimination method are not necessarily faster, unless the number of eliminated elements is a significant fraction of the total number of elements. This is shown by the computational costs reported in Table 3. As stated before, the element elimination steps require a reduction of the time steps, however, they do not cause further convergence problems. The scalability of the model is shown by the computational costs of the simulation with 4 \(\upmu \)m elements and 8 \(\upmu \)m elements. An eightfold increase in the number of elements leads to an increase of the computational time using both methods.

Table 3 Computational costs of the simulations
Fig. 7
figure 7

Vertical displacement \({\mathbf {u}}_z\) at \(t = 771\) \(\upmu \)s: a just before element reactivation, c, d just after element reactivation in case the reinitialisation \({\mathbf {u}}_z = 0\) or \({\mathbf {u}}_z = 3\) \(\upmu \)m is used respectively. b Element distortion due to the reinitialisation \({\mathbf {u}}_z = 0\)

The maximum number of nonlinear iterations of the Newton-Krylov method used in the simulations [69] is set to be 10, after which a time step reduction takes place. In the simulations with element elimination method, there are 69 time steps reaching the maximum 10 iterations among the 1935 steps, while 1633 steps finished within two iterations. Using the stiffness degradation method, the maximum nonlinear iteration number is 5 and 1531 steps among the total 1567 steps finished within two iterations. When the laser reaches the center of the domain, the residual of the equations system is reduced by a factor 0.028 at each nonlinear iteration using the element elimination method, while it is reduced by a factor 0.008 using the stiffness degradation method. When the laser reaches the end of the representative volume and the molten pool is extended throughout the entire domain along the x axis, the residual is reduced by a factor 0.031 at each nonlinear iteration using the element elimination method, while it is reduced by a factor 0.0021 using the stiffness degradation method. Most time steps converged with no more than two nonlinear iterations and time step reduction seldom takes place. Although the element elimination method requires slightly more nonlinear iterations, this has little effect on the computational time, as shown in Table 3.

The time steps at which element reactivation takes place leads to the following problem. Because of thermal expansion, there is a significant displacement along the z axis on the top surface, as shown in Fig. 7a. Normally, reactivated elements have zero displacement because the displacement variable is reinitialized. In the MOOSE framework, the displacement in the reinitialized nodes is assigned in such a way as to get an average zero displacement at the eight integration points, as shown in Fig. 7b. Therefore, when an element is reactivated with zero displacement, the excessive distortion leads to divergence, as shown in Fig. 7c.

The order of magnitude of the thermal expansion along the z direction of the representative volume can be estimated using the following reasoning: the volumetric thermal expansion coefficient is \(\alpha _0 = 44.73 \times 10^{-6}\) K\(^{-1}\) and the temperature increase near the molten pool is \(T_m - T_0 = 1345.15\) K. Therefore, the thermal expansion of the representative volume along the z axis is given as \((\alpha _0 / 3) \cdot \left( T_m - T_0 \right) \cdot 108\) \(\upmu \)m \(=2.2\) \(\upmu \)m. This is only an approximation because non-linear thermal expansion is considered, there is thermal expansion also along the x and y directions, and elements in the molten pool are eliminated. The actual simulated thermal expansion at the top surface along the z axis is shown in Fig. 7a and the maximum value is about 3.5 \(\upmu \)m.

Several attempts have been carried out in which the initial conditions on the displacement after element reactivation are changed as a function of the coordinates. A solution is to reinitialize \(u_z = 3\) \(\upmu \)m when elements are reactivated, while \(u_x\) and \(u_y\) are reinitialised to zero everywhere. This displacement value is closer to the average displacement of the molten pool region on the top surface in the simulation using the stiffness degradation method, while it also leads to good convergence. This implementation is made possible by the MOOSE framework because the initial conditions can be set as a function of time. At \(t = 0\), the displacement is initialized to zero, while for \(t > 0\), the components \(u_x\), \(u_y\) are reinitialized to zero and \(u_z\) is reinitialized to 3 \(\upmu \)m everywhere in the geometry. This strategy can be applied to any additive manufacturing simulation and can be extended by setting the initial conditions as a more complex function of space and time.

4.4 Comparison between the computational methods

The two computational methods presented in Sects. 2.2 and 2.3 are compared. The plastic deformation is a very important quantity because it determines the residual stress after the laser scan. The diagonal components of \({\varvec{F}}_p-{\varvec{I}}\) are averaged over the central part of the representative volume, which has a width that is comparable to the width of the molten pool, constituted of the highlighted elements in Fig. 8d. The choice of the averaging region in Fig. 8d is based on the distribution of the plastic strain during and after the laser scanning. As shown in the Fig. 10, the plastic deformation is concentrated around the molten pool. Therefore, we choose to average the plastic deformation on a region which corresponds to the volume that becomes liquid during the simulation with some margin. Averaging over the entire volume would not be representative of the magnitude of plastic deformation because regions where the plastic deformation is lower would be accounted in the averaging process. This procedure is carried out for simulations using the element elimination method and the stiffness degradation method.

Fig. 8
figure 8

ac Plastic strain components in the center of the representative volume, averaged over the highlighted elements in d

Figure 8a–c show the comparison of simulation results by the two methods. During laser scan, the hot region undergoes thermal expansion and applies compression on the neighbouring regions. Therefore, plastic compression along the x and y axes takes place in the central region. Since plastic deformation is isochoric, the elements expand along the z axis, as shown in Fig. 8c.

The plastic deformation is always larger using the element elimination and reactivation method. If the stiffness degradation method is used, the residual plastic deformation component along the y axis, after laser scan and cooling, is underestimated by about 20%. The difference is particularly important at time 400-500 \(\mu \)s, when the laser just passes the representative volume but the melting pool is still deep. In this time interval, the stiffness degradation model underestimates the plastic deformation by a factor 2.

In addition, the simulated stress–strain curves using the two methods are obtained by running a tensile load simulation, in which tension boundary conditions are applied, after the relaxation simulation explained in Sect. 4.1. Tension is applied by adding a displacement boundary condition on the surface \(x=\) 200 \(\upmu \)m. The displacement is applied along the x axis, which is the laser scanning direction, until 5% total strain is reached. Meanwhile, the displacement perpendicular to the surfaces \(x=0\), \(y=0\) and \(z=0\) is maintained at zero to avoid translation. The results are shown in Fig. 9. It can be seen that the simulated yield strength is higher when using the stiffness degradation method, while the other curve using the element elimination and reactivation method matches better the reported yield strength in experiments [49]. The overestimation of yield strength reflects the difference in the predicted plastic deformation.

Fig. 9
figure 9

Comparison of stress–strain curves between element elimination method and stiffness degradation method

Fig. 10
figure 10

Component \(({\varvec{F}}_p-{\varvec{I}})_{yy}\) of the plastic deformation gradient at time \(t = 179\) \(\upmu \)s using the stiffness degradation method with a \(q_r=0.01\) and b \(q_r=0.001\)

Overall, in the stiffness degradation method, the presence of low stiffness elements prevents the elements near the melting pool to accommodate part of the plastic deformation. Simulations with both \(q_r=0.01\) and \(q_r=0.001\) are carried out and the plastic deformation along the y axis is shown in Fig. 10 when the laser beam is approximately in the center of the representative volume. The strong similarity between the plastic deformation in the two simulations confirms that the range of values chosen for the parameter \(q_r\) does not affect the simulation results. The other components of the plastic deformation gradient are also very similar, therefore a value \(q_r = 0.001\) is suitable for this kind of simulations.

4.5 Grain orientation and plastic deformation

The element elimination and reactivation method will be used in the following simulation results to understand the correlation between plastic deformation, residual stress and grain orientation. Firstly, the correlation between residual plastic deformation (after the laser scan and cooling) and grain orientation is analysed. The scatter plots in Fig. 11a–c are obtained as follows: the plastic deformation components are averaged over each element in the representative volume and one element is selected every 16 \(\upmu \)m and represented as a point in the scatter plots. The distribution of these elements is uniform in the representative volume and this algorithm allows to select a representative set of elements that do not fill completely the scatter plot. Given the Euler angles in each selected element, the maximum Schmid factor among the slip systems is calculated for load along a particular direction (x, y or z axes respectively) [80]. This is motivated by the fact that, despite of the complex load undergone by different regions, the stress component along one direction should in principle induce plastic deformation along that particular direction. The colour of the points in Fig. 11a–c corresponds to the position of the element along the z axis.

Fig. 11
figure 11

Correlation between maximum Schmid factor among the slip systems and plastic deformation after laser scanning

Fig. 12
figure 12

Correlation between maximum Schmid factor among the slip systems and the range of plastic deformation after laser scanning

As shown in Fig. 11, the maximum plastic deformations occur on some points that are at an intermediate depth (about 40–80 \(\upmu \)m). This is related to the solidification and thermal stress around the molten pool, as also revealed in Fig. 14. Moreover, it is clear that a higher number of grains with larger maximum Schmid factors along a specific direction (x, y or z) tends to have larger plastic deformation along that direction. However, there are grains with large maximum Schmid factors that show little plastic deformation. Many of this kind of points are dark blue in Fig. 11a–c, which means they are near the substrate. Because the substrate is fixed during simulation, the plastic deformation near the substrate is limited. Nevertheless, there are still some points at intermediate depth that do not have much plastic deformation, this is quite surprising and reflects the complexity of the thermal load in different regions. This behaviour will be clarified in the following, when the plastic deformation during laser scan is shown near the melting pool. There are also some grains with larger Schmid factor that show little plastic deformation and are located near the top stress-free surface (dark red points), as shown in Fig. 11a–c.

To investigate the directionality of the plastic deformation, the range of the plastic deformation components is investigated, which shows a greater correlation with the maximum Schmid factor [81, 82], as shown in Fig. 12a–c. The range is calculated as the difference between maximum and minimum values of the plastic strain components for a given maximum Schmid factor. This correlation does not depend strongly on the depth z. The majority of the grains undergo plastic compression along the x and y axes, while plastic tension is observed along the z axis. This is consistent with the average plastic strain in Fig. 8.

4.6 Plastic deformation and residual stress

The residual stress, after laser scan and cooling, is due to the heterogeneity of the plastic strain in different grains. In order to maintain strain compatibility, the elastic deformation must compensate the difference in plastic deformation, therefore residual stresses are generated, as modelled by Eqs. (1) and (11). The correlation between residual stress and plastic deformation can be visualised using the scatter plots in Fig. 13. Each point represents an element in the representative volume, selected every 16 \(\upmu \)m, with its corresponding residual stress and plastic strain, averaged over the integration points. The colour of each point represents the z coordinate of the corresponding element.

There is a moderate correlation between residual stress and plastic strain: the correlation coefficients, calculated from the data in Fig. 13, are 0.58, 0.50, 0.54 for the x, y, z components respectively. Compressive plastic strain along the x and y axes corresponds to tensile residual stress components along those directions, while tensile plastic strain along the z axis corresponds to compressive residual stress along z. However, few points show the opposite behaviour: for instance, a tensile residual stress \(\sigma _{yy}\) is associated with a small tensile plastic strain along the y axis in some regions. Overall, the tensile residual stress components \(\sigma _{xx}\) and \(\sigma _{yy}\) are similar and large, therefore these pre-tensions can induce fracture along both the x and y directions.

Fig. 13
figure 13

Correlation between the components of the residual stress and components of the plastic deformation gradient. The absolute values of the correlation coefficients are 0.58, 0.50, 0.54 for the x, y, z components respectively

The plastic deformation depends also on the depth. In Fig. 13, it is evident that the regions at the top of the representative volume, represented by dark red points, are not the ones accommodating the largest plastic strain. The points with the largest plastic deformation are the ones with depth in the interval 30 \(\upmu \)m \(< z < 80\) \(\upmu \)m. These are the points that are closer to the bottom of the melting pool during laser scan. However, the points at the top surface can have residual stresses that are similar to points that undergo larger plastic deformations. This shows that the influence of the plastic deformation in the substrate is very important; it will be discussed in more details in Sect. 5. It is important to note that some elements show values of the residual stress components that are larger than the critical resolved shear stress to induce plastic deformation. This is due to large volumetric stress in those elements. Moreover, some dark red points in Fig. 13c have residual stress \(\sigma _{zz}\) that is different from zero. These points are picked just below the surface, in the coordinate interval 90 \(\upmu \)m \(< z < 100\) \(\upmu \)m. Indeed the stress component \(\sigma _{zz}\) on the free top surface is very close to zero, as shown in Fig. 15c.

Fig. 14
figure 14

Components of the plastic deformation gradient \({\varvec{F}}_p\) at the bottom of the melting pool at time \(t = 179\) \(\upmu \)s

Fig. 15
figure 15

ac Residual stress components after the cooling stage of the simulation. d Average stress components along depth

In order to understand the plastic deformation in the representative volume induced by the laser scan, the components of \({\varvec{F}}_p\) are shown in Fig. 14a–c when the laser beam is approximately in the center of the representative volume. The thermal expansion ahead of the laser beam leads to plastic compression along the x axis. This is visible on the two sides and at the bottom of the melting pool in Fig. 14a, where blue areas are present. By contrast, the plastic deformation along the y axis is compressive at the bottom of the melting pool but it is tensile on the two sides, as shown by the red regions in Fig. 14b. Since plastic deformation is isochoric, the region at the bottom of the melting pool expands along the z axis, as shown in Fig. 14c. Because of the subsequent solidification, the melting pool becomes more shallow and the plastic deformation concentration shown in Fig. 14a–c spreads in the central region of the representative volume. This is the reason why the regions with the largest plastic deformation are concentrated at depth 30 \(\upmu \)m \(< z < 80\) \(\upmu \)m, as shown in Fig. 13. At the top free surface, the plastic deformation is slightly smaller than in the center of the representative volume, as shown in Fig. 11a–c. This is the reason why not all grains with larger Schmid factor at the top surface can accommodate large plastic deformations, as stated in Sect. 4.5.

The diagonal components of the residual Cauchy stress tensor are shown in Fig. 15a–c. \(\sigma _{xx}\) and \(\sigma _{yy}\) are heterogeneous at the top surface and in the center of the representative volume, as shown in Fig. 15a and b. This shows that they are strongly affected by the grain orientation and that the substrate is applying an important constraint along x and y on the top surface. In fact, even if the top surface is free, large values of \(\sigma _{xx}\) and \(\sigma _{yy}\) are present. The compressive stress \(\sigma _{zz}\) is concentrated in the substrate but it is not very large at the top surface because of the free boundary condition.

To quantify the effect of the bottom boundary (\(z=0\)), the residual stress components \(\sigma _{xx}\) and \(\sigma _{yy}\) are averaged over slices in the \(x-y\) plane. This averaged residual stress as a function of the depth z is shown in Fig. 15d. At the top surface the residual stress components are zero, then they become tensile between \(z = 40\) \(\upmu \)m and \(z = 80\) \(\upmu \)m. Closer to the bottom surface, for \(0< z < 20\) \(\upmu \)m, the slope of the curves in Fig. 15d increases significantly. This indicates that the bottom boundary has an effect for that particular value of the depth.

5 Discussion

The simulations suggest the following mechanism for the build up of the residual stresses, as shown in Fig. 16. The thermal expansion around the molten pool induces plastic compression along the horizontal directions, x and y, and plastic tension along the out-of-plane z direction. This is particularly obvious at the bottom of the melting pool, as shown in Fig. 14. After the laser scanning is over, tensile residual stresses build up along x and y directions to compensate the plastic compression. This effect is more relevant in the center of the representative volume, however constraints are present between the regions close to the top surface and the center. This induces residual stresses along the x and y directions also close to the top surface, as shown in Fig. 15.

Fig. 16
figure 16

Mechanism for the build up of the residual stresses

The different grain orientations cause the heterogeneity of the residual stress. Grains with slip systems favourably oriented for plastic slip during loads along the x, y and z directions are more likely to develop plastic deformation along the corresponding directions. The simulations show that the maximum Schmid factor along the three axes is a suitable quantity to predict the corresponding plastic deformation and consequent residual stress, as shown in Figs. 11 and 13.

The simulations show that, in the stiffness degradation method, the presence of regions with a small residual stiffness imposes a constraint on the regions near the melting pool, preventing more plastic deformation to take place. This is the origin of the underestimation of the plastic deformation and of the residual stress using the stiffness degradation method. By contrast, the element elimination and reactivation method predicts higher plastic deformation in selective laser melting simulations. This difference between the two methods must be taken into account in future studies.

Regions with larger tensile residual stresses along specific directions are more likely to undergo fracture perpendicular to those directions. Therefore, the present simulations suggest that fracture perpendicular to the x and y axes is more probable because of the magnitude of the corresponding residual stresses \(\sigma _{xx}\) and \(\sigma _{yy}\). These two directions have similar residual stresses, as shown in Fig. 13. This is consistent with laser-induced microcracking [83], in which fracture is observed at the top surface perpendicular to the laser scan direction.

The residual stress components \(\sigma _{xx}\) and \(\sigma _{yy}\) in Fig. 15 can be directly compared with experimental values in the literature [62, 84]. The simulated stress components \(\sigma _{xx}\) and \(\sigma _{yy}\) in the elements belonging to the top 50 \(\upmu \)m region of the representative volume have been averaged and the corresponding standard deviation, representing the grain-to-grain variation of the residual stress, is calculated. This is represented by the green error bars in Fig. 17a and b. The average over the top region allows a direct comparison with the experiments by Yadroitsev et al. [62] on a single-layer 316L stainless steel sample because the same 50 \(\upmu \)m depth was analysed. The comparison between model and experiments is shown in Fig. 17. Other data are added to clarify how much the present simulations are comparable to multi-layer experiments. The error bars in the experimental data represent the variation of the residual stress with depth and the experimental error. It is worth noting that, as shown in Sect. 4.6, the bottom boundary conditions do not have a large effect of the residual stress on the top region of 50 \(\upmu \)m in thickness.

The simulated residual stress is lower than the single-layer sample but the experimental error bar is compatible with the simulated grain-to-grain variation. The variation is much larger than the experimental variation with depth. This is because these experimental X-ray measurements cannot resolve individual grains but provide a value of the residual stress that is averaged over several grains. Multi-layer experiments show better agreement with the simulation results; this indicates that the specific relaxation procedure that we use in the simulations is more comparable to samples in which the laser maintains a higher temperature for a longer time. It also shows that the fixed walls boundary conditions during the SLM simulation, followed by a relaxation stage simulation, do not lead to an overestimation of the residual stress compared with experiments.

Fig. 17
figure 17

Comparison between the simulated and experimental residual stress. The error bar in the simulation represents the grain to grain variation of the residual stress, while in the experiments it represents the variation of residual stress with depth [62, 84]

Currently, the constitutive model is suitable for single track simulations. Extending the model to multiple track simulations would require to add a back-stress term in Eq. (3) that accounts for cyclic effects. The present model is specific for the prediction of type II residual stress at the grain length scale. In the present work, there is no attempt to model sub-granular cellular structures [85]. The effect of sub-granular structures is embedded in the calibration of the CPFEM model parameters. This is shown by the comparison with experiments in which the residual stress is averaged over the length scale of one deposited layer, where the effect of the sub-granular structures is averaged out. Currently the CPFEM simulations do not incorporate the rough surfaces during AM process, which is a possible improvement in our future plan. About the limitations of the thermal-fluid flow model, it currently does not consider the vapor flow during AM process and simplify the vapor effect to the pressure on the surface of the molten pool. Meanwhile, the powder spattering during laser scanning is not simulated.

6 Conclusions

A modelling approach to predict residual stresses at the grain length scale in additive manufactured 316 stainless steel is developed. Thermal-fluid flow and grain growth simulations are used to provide the temperature field and the grain structure respectively, which are implemented in crystal plasticity finite element simulations. This computational framework is novel and reasonable to realize a complete simulation chain for AM parts at the grain length scale, which can incorporate the complex thermal-fluid flow fields that are characteristic of the AM process, grain morphology information, anisotropic material properties and plasticity.

A method for element elimination and reactivation is developed to simulate melting and solidification during the laser scan. This method allows to reinitialize state variables, such as the plastic deformation, when elements are reactivated and it represents a step forward compared with previous studies. Combined with the CPFEM, the simulations can predict the residual stress at the grain length scale, as well as the variation of the residual stress from grain to grain, which is difficult to obtain through experiments.

Simulations show that residual stresses are strongly correlated with the plastic deformation, which in turn depends on the grain orientation. The directions with largest residual stresses are on the laser scan plane, both parallel and perpendicular to the laser scan direction. This is consistent with the microcracks observed experimentally. Even though this study is focused on 316L stainless steel and selective laser melting, the computational method developed can be applied to other metals and other additive manufacturing processes like directed energy deposition and electron beam additive manufacturing. More detailed simulations of residual stresses will be conducted in the future with experimental validation to systematically investigate the relationships between the manufacturing parameters, molten pool flow, grain structures, and residual stresses.