Laser powder-bed fusion (LPBF) additive manufacturing is being widely explored in both industry and academia1,2 for the production of metal parts. During LPBF, mid-power (~ 100–1000 W) but tightly focused (spot sizes ~ 20–100 µm) lasers are scanned across successive layers of fine metal powder at high speed (~0.05–4 m s−1), selectively melting and consolidating the powder to build a fully dense part. The typical processing-structure–property linkage for LPBF is: steep thermal gradients and high cooling rates3 (~104–106 K s−1) favouring fine, columnar grains oriented along the build direction, producing as-printed LPBF parts that typically exhibit increased strength, reduced ductility, and increased microstructural and mechanical property anisotropy4, depending on the alloy systems.

The laser fluence during LPBF is sufficient to vaporise the metal, generating a recoil pressure that pushes molten metal away from the laser–matter interaction zone5. With increasing laser fluence, the recoil pressure is large enough to open a deep, high aspect ratio vapour depression, referred to as a keyhole6. This is commonly used in laser welding to achieve thin and deep joints7. LPBF often operates in keyhole mode melting6 to ensure complete fusion between successive layers. Additionally, laser absorptivity increases dramatically in keyhole melting due to multiple reflections of the laser beam along the keyhole8, opening the door for fabrication of highly reflective materials (e.g., aluminium matrix composites with ~91% reflectivity9) by LPBF, or enable a more economical laser heat source (e.g., diode laser) to be used in LPBF without sacrificing build efficiency10. However, the keyhole is subjected to axial fluctuations and radial perturbations11 that are governed by the balance of energy and pressure12,13,14, posing a significant risk for keyhole instability15,16 and in some cases, collapse. Keyhole collapse often results in the formation of a bubble in the melt pool, which may get trapped by the solidification front to form a pore. Keyhole pores remaining in the final part may act as stress concentrators and sites for crack initiation and growth, making them potentially detrimental to fatigue life17 and other final component mechanical properties18,19.

Several process models5,12,13,14,20 explained the physics of keyhole pore formation during laser welding and LPBF, revealing the interactive effects of recoil pressure, surface tension, and Marangoni convection on the keyhole, and the competing influence of gravity, drag, buoyancy and thermocapillary forces on bubble motion. Recently, in situ synchrotron X-ray imaging21,22,23,24 has been applied to LPBF, capturing some dynamics of the keyhole and keyhole pore in the sub-surface of melt pool, including: keyhole morphology evolution25; pore formation at turn-around points during raster scanning26; pore elimination by thermocapillary forces27; pore migration under Marangoni-driven flow and pore coalescence28,29; pores being pushed away from the keyhole tip by acoustic waves emanating from a keyhole collapse16, and pore evolution during multi-layer LPBF30,31. However, the dynamics of keyhole pore formation are still not fully understood. The role of keyhole fluctuations in keyhole collapse and the evolutions of bubbles (e.g., formation, growth, shrinkage and migration) before being captured by the solidification front, are largely unexplored. For the latter, previous studies32,33 explored the influence of evaporation and condensation on the dynamics of water–vapour bubbles in a superheated liquid, and effect of dissolved gas diffusion on bubble growth in casting34,35, but it remains unclear how evaporation, vapour condensation, and dissolved gas diffusion affect bubble evolution in LPBF.

Here, we perform in situ synchrotron X-ray imaging during LPBF of a commercial aluminium alloy Al7A77 (HRL laboratory, USA), which has critical applications in aerospace, biomedical and automotive industries19, and also a high laser reflectivity36 in the near-infra-red, presenting challenges for laser processing. We discover a transition regime (II) between the stable (I) and unstable (III) keyhole regimes in LPBF, where the keyhole morphology changes from wide and shallow in II to narrow and deep in III. Pores are also observed to form in II, mostly present at the rear keyhole wall (RKW), while keyhole porosity is more prevalent in III with pores typically forming at the keyhole bottom. Although some prior work has suggested keyhole fluctuation is largely random, we observe regular oscillations in keyhole width and depth with significant trends in fluctuation frequency across the three keyhole regimes. We find these regimes are well defined by the front keyhole wall (FKW) angle, which collapses to a single function of the normalised enthalpy product37 for different materials. By comparing our bubble model with experimental data, we find that the bubble dynamics are defined by fast initial growth induced by pressure equalisation, followed by shrinkage due to metal-vapour condensation. Concurrent with condensation, hydrogen may diffuse into the bubble, slowing bubble shrinkage and stabilising the bubble size. Lastly, we investigate the rapid distortion of bubbles as they interact with the advancing solidification front.


Keyhole collapse mechanism and related regime transitions

In situ and operando X-ray imaging was used to probe the keyhole collapse behaviour and keyhole pore formation mechanisms during LPBF, which was carried out using an in situ and operando process replicator (ISOPR, Supplementary Fig. 1), as described in the “Methods” section. We systematically characterised the changes in keyhole shape and bubble development across a wide range of area energy densities AED38, \({{\mathrm {AED}}}={P}_{{\mathrm {\it{l}}}}/\left({v}_{{\mathrm {\it{l}}}}{d}_{{\mathrm {\it{l}}}}\right)\) (Pl laser power, \({v}_{{\mathrm {\it{l}}}}\) laser scan velocity, \({d}_{{\mathrm {\it{l}}}}\) laser spot size), from AED = 6 to 17 mJ m−2 in the keyhole melting regime6. We observed that the keyholes change in morphology from wide and shallow to narrow and deep (Fig. 1a, Supplementary Fig. 2a and Supplementary Movies 112). Simultaneously, bubbles first form at the RKW, then prevail at the bottom of keyhole once the keyhole becomes deep and narrow (Fig. 1a, Supplementary Fig. 2a). Those findings indicate that the transition from a stable to unstable keyhole melting may be more nuanced than previously suggested16,25 (discussed in detail later). We also noticed that the FKW remained relatively smooth at an approximately constant inclination angle, whereas the RKW presented random wrinkles and perturbations. With increasing AED, the keyhole penetration depth increases and the inclination of the FKW become steeper (higher FKW angle \(\theta\), \({{\tan }}\,\theta \sim {v}_{{\mathrm {\it{d}}}}/{v}_{{\mathrm {\it{l}}}}\)39), which is attributed to higher drilling velocity40 (\({v}_{{\mathrm {\it{d}}}}\)) and increased energy coupling due to multiple reflections8.

Fig. 1: Keyhole collapse mechanism and related keyhole melting regime transitions in LPBF.
figure 1

a Keyhole morphology variations from wide and shallow to narrow and deep across the (I) quasi-stable, (II) transition and (III) unstable keyhole regimes under different laser scan velocities. b Front keyhole wall (FKW) angle as a function of normalised enthalpy product for 9 datasets with four different materials. Curve fit is \(\theta ={\arctan }\left[a\cdot \left(\varDelta H/{h}_{{\mathrm {\it{m}}}}\cdot {{L}_{{{\mathrm {\it{th}}}}}}^{* }+b\right)\right]\) (\(a={0.29}_{-0.04}^{+0.04},b={-0.2}_{-0.6}^{+0.2}\) with 95% confidence bounds), performed in Matlab using the Levenberg–Marquardt/least absolute residuals robust fitting algorithm. c Radiographs of laser melting with bare aluminium plate in (II) transition regime, showing rear keyhole wall (RKW) collapse with associated illustration (d). e Radiographs of laser melting with bare aluminium plate in (III) unstable regime, showing keyhole bottom collapse with associated illustration (f). t0 is the time of the captured frame before the RKW or bottom keyhole expands. The red, blue and green arrows in d and f represent the laser beam, fluid flow and vapour flow, respectively. \(d\) and \(\theta\) represent the keyhole depth and FKW angle, respectively. Laser power 500 W, laser spot size 50 µm. All scale bars correspond to 150 µm. The datasets of LPBF with Ti–6Al–4V are cited from Cunningham et al. 25 (Fig. 4, S5 and S7) and Zhao et al.16 (Movies S1S5) with permission from AAAS. Datasets for LPBF with Inconel 718, SS 304 and aluminium bare plate are cited from Kouraytem et al. 40, Parab et al. 41, and Hojjatzadeh et al. 42, respectively.

By supplementing our results with previous studies16,25,40,41,42 across a wide range of powder materials, process conditions with different LPBF replicators and beamlines, we found that the FKW angle \(\theta\) collapses to an inverse tangent of the normalised enthalpy product \(\left(\Delta H/{h}_{{\mathrm {\it{m}}}}\cdot {L}_{{{\mathrm {\it{th}}}}}^{* }\right)\)37 (Fig.1b), where \({L}_{{{\mathrm {\it{th}}}}}^{* }\) is the normalised thermal diffusion length37 and the normalised enthalpy6,43 \(\Delta H/{h}_{{\mathrm {\it{m}}}}\) a ratio of \(\triangle H\), the deposited energy density6 (also named as specific enthalpy) and \({h}_{{\mathrm {\it{m}}}}\), the enthalpy at melting. This relationship is derived by the governing laws of heat transfer and kinematic equilibrium, elaborated in the “Methods” section. The agreement between the theorical derivation and experimental measurements (Fig.1b), suggests that the FKW inclination during LPBF is not only controlled by the deposited energy density \(\triangle H\) and the material’s melting enthalpy \({h}_{{\mathrm {\it{m}}}}\), but also affected by the thermal diffusion length \({L}_{{{{ th}}}}\).

Previous work has related the front keyhole wall to the laser fluence. Cunningham et al. 25 reported a nonlinear relationship between the FKW angle and the power density (\(2{P}_{{\mathrm {\it{l}}}}/\pi {d}_{{\mathrm {\it{l}}}}^{2}\)), which changes with the laser scan velocity as well as powder materials. Gan et al. 44 found that the tangent of FKW angle is approximately proportional to the “keyhole number \({{\mathrm {Ke}}}\)” (\({{\mathrm {Ke}}}=\frac{1}{\sqrt{\pi }}\cdot \Delta H/{h}_{{\mathrm {\it{m}}}}\)), which is a scaled version of the normalised enthalpy. Here, we find even stronger agreement between the FKW angle and the normalised enthalpy product (Supplementary Fig. 3d), rather than the normalised enthalpy (Supplementary Fig. 3c). Our result builds on the work of Ye et al. 37, who first introduced the normalised enthalpy product in their scaling laws for keyhole depth (similar relations for keyhole depth measurements are shown in Supplementary Fig. 3a, b). The relationship derived here also allows for defining thresholds between different melting regimes, similar to King et al. 6, who found the transition from conduction to keyhole melting occurs at a normalised enthalpy \(\Delta H/{h}_{{\mathrm {\it{m}}}}\approx \left(30\pm 4\right)\) for 316L stainless steel.

Within the keyhole-melting regime, recent studies have reported a sharp transition between stable and unstable keyhole melting, typically defined by the onset of keyhole porosity16,25,44. From our data, we observed that the threshold for this transition can vary significantly between alloys. For Ti-6Al-4V16,25 and Al7A77 (Figs.1b and 2d), we found this transition occurs at \({\Delta H/{h}_{{\mathrm {\it{m}}}}\cdot L}_{{{\mathrm {\it{th}}}}}^{* } \sim \left(8\pm 3\right)\) or \({ \sim 60\deg}\) FKW angle, and \({\Delta H/{h}_{\it{m}}\cdot L}_{{\it{th}}}^{* } \sim \left(20\pm 3\right)\) or \({ \sim 80\deg}\) FKW angle, respectively. The larger threshold for Al7A77 is likely a combined result of its lower absorptivity at ambient temperature (~0.15 vs. ~0.45), larger Brewster angle (\({ \sim\!85\deg}\)45 vs. \({ \sim\!80\deg}\), Supplementary Fig. 4), and lower melting enthalpy (\({h}_{\mathrm {{\it{m}}}}=2.63\) vs. 6.26 J mm−3).

Fig. 2: Keyhole dynamics in LPBF.
figure 2

a Keyhole width relative to the mean, for laser scan velocities of 1.6 m/s (top, blue) and 0.8 m/s (bottom, red). Detected peaks/valleys are highlighted with marker size and example X-ray radiographs (1a, b; 2a, b). Average period between successive peaks/valleys in keyhole width b and depth c as a function of the normalised enthalpy product. Data for SS304, Inconel 718, and Ti64 are cited from references Kouraytem et al. 40, Parab et al. 41 and Zhao et al. 25, 16, respectively. Dashed lines are smoothing spline fits as a guide for the reader. d Percentage area porosity for cases with and without powder. Error bars represent standard deviation.

In addition, we find that there can be an extended transition regime (II) between the stable (I) and unstable (III) keyhole regimes under high-power-velocity (high-PV). Pores begin to form in this transition regime, and initiate at the RKW rather than at the bottom of the keyhole (typical in III), which was also observed during laser welding of aluminium alloys15 and low carbon steel46, as well as LPBF of Ti–6Al–4V42. For similar AED, we found this transition regime becomes sharper with decreasing laser power and scan velocity (\({P}_{{\mathrm {\it{l}}}}=500\,{\mathrm {W}}\), \({v}_{{\mathrm {\it{l}}}}=1.4\,{\mathrm {m/s}}\), Supplementary Fig. 5a, c; \({P}_{{\mathrm {\it{l}}}}=200\,{\mathrm {W}}\), \({v}_{{\mathrm {\it{l}}}}=0.6\,{\mathrm {m/s}}\), Supplementary Fig. 5b, d), in agreement with Zhao et al. 16. We speculate that the (II) transition regime is induced by the high-PV combination under large AED, which enlarges the melt pool and vapour depression zone, leading to a relatively wider transition from the stable (I) to the unstable (III) keyhole regime. For the laser spot size and alloy used in this study, a high-PV with large AED is defined as \({P}_{{\mathrm {\it{l}}}}=500\,{\mathrm {W}}\), \({v}_{{\mathrm {\it{l}}}}=1.2\,{\mathrm {m/s}}\), \({{\mathrm {AED}}}\ge 7\,{{\mathrm {MJ}}}\cdot {{\mathrm {m}}}^{-2}\). The typical AED for LPBF is around 10 MJ m−2 based on reference14. At high-PV processing schemes for achieving large build rate in LPBF, we speculate that these schemes are most likely fall into this transition regime (II).

To further investigate the different keyhole collapse mechanisms in II and III, we compared the keyhole dynamics (Fig.1c, e and Supplementary Movies 112). “Humps” regularly form on the FKW due to the dependence of laser absorption on angle of incidence (Fresnel absorption47, Supplementary Discussion 1), which becomes especially pronounced around the Brewster angle47 (above which, absorptance falls off dramatically, Supplementary Fig. 4). In II (Fig.1c–i, \({{\mathrm {AED}}}=8\,{\mathrm {{MJ}}}\cdot {{\mathrm {m}}}^{-2}\), FKW angle 81.2 ± 1.7°), these humps tend to reflect the laser beam and the vapour flow towards the RKW. This leads to intensive evaporation and recoil pressure on the RKW and builds up a stagnation pressure12, correspondingly deforming and expanding the RKW (Fig.1c–ii). Generally, the combined recoil and stagnation pressure balances the surface tension acting on the free surface of the RKW, holding the overhanging RKW from collapse14. However, should the reflected laser beam and vapour flow be blocked or redirected by a perturbation of the keyhole (Fig.1c-ii), the surface temperature of the unilluminated RKW will quickly decrease. As the temperature decreases, surface tension increases linearly5, overcoming the recoil pressure which decreases exponentially5, causing a RKW collapse. We observed that this collapse can sometimes lead to the formation of bubbles from the RKW, approximately at the half-depth of keyhole (Fig.1c-iii), followed by the temporary formation of a deep, high aspect ratio depression. The melt flow at the middle of the pool half way up the RKW is still strong48, as a result of the Marangoni-driven flow, propelling the bubble towards the rear of the melt pool, as discussed in detail later.

In the unstable regime (III) (Fig.1e–i, AED = 10 MJ m−2 FKW angle 84.8 ± 0.8°), a narrow, deep keyhole forms, and humps on the FKW predominantly direct metal vapour and reflected laser beams to the bottom of the keyhole. Intense evaporation and recoil pressure at the keyhole bottom can be further amplified by the rapid formation of a vapour cavity (“J-shaped” keyhole, Fig.1e-ii), which traps reflected laser light and metal vapour, increasing the number and density of multiple reflections8,20 and building up a significant stagnation pressure12. With energy concentrated in this cavity, the keyhole is prone to capillary instability and may sometimes collapse, pinching off a cavity to form a vapour filled bubble (Fig.1e–iii) and leads to a sharp decrease in keyhole depth. This is similar to, but not the same as the “spiking” as initially named in laser welding11. Spiking is also prevalent in LPBF but at turn-around points in raster scan patterns due to the finite acceleration of the laser beam, near-zero instantaneous scan velocity, and resulting pores at the “root” of keyhole26. While a small number of the bubbles we observed were re-captured by the expanding keyhole (Supplementary Fig. 2b), most were captured almost instantaneously by the advancing solidification front at the bottom of the keyhole to form pores in III.

Keyhole radial and axial fluctuation and keyhole porosity

To quantify the keyhole and bubble dynamics, we built an image processing pipeline (see the “Methods” section) to extract the keyhole depth and width from in situ X-ray radiographs (Fig.2a, Supplementary Fig. 6a, b). This was carried out for both our own study of LPBF with and without Al7A77 powder (Supplementary Movies 18 and 1012), as well as a number of previous synchrotron X-ray studies25,40,41 across different powder materials, process conditions, LPBF replicators, and beamlines (e.g., Parab et al. 41). Note that the keyhole width is extracted as the median width along the whole keyhole depth.

Figure 2a shows the regular fluctuations in the keyhole width across different keyhole melting regimes (transition II, blue; unstable III, red). Similar, if not more regular, fluctuations were also observed without powder (Supplementary Fig. 6a, b). To further quantify these fluctuations, we calculated the average peak-to-peak period (see the “Methods” section) and found the corresponding frequencies of keyhole depth and width fluctuations range from ~2.5 to ~10 kHz, in agreement with previous acoustic, optical and radiometric measurements8,49,50. We also found significant trends in the keyhole width (Fig. 2b) and depth (Fig. 2c) fluctuations across different keyhole regimes: starting in I (\({\Delta H/{h}_{{\mathrm {\it{m}}}}\cdot L}_{{{\mathrm {\it{th}}}}}^{* } \, < \,10\)), the frequency of keyhole width fluctuations first increases, peaks in II (\({10 \, < \,\Delta H/{h}_{{\mathrm {\it{m}}}}\cdot L}_{{{\mathrm {\it{th}}}}}^{* } \, < \,20\)), and then slightly decreases in III (\({\Delta H/{h}_{{\mathrm {\it{m}}}}\cdot L}_{{{\mathrm {\it{th}}}}}^{* } \, > \, 20\)). Similar patterns for the keyhole depth fluctuation are shown in Fig. 2c, which increases in frequency from I to II, and then remains high in III.

The keyhole width and depth fluctuation trends are consistent with the keyhole collapse mechanisms discussed above. In II, the high-frequency hump formation and subsequent migration down the FKW (Supplementary Discussion 1) can cause an open, wide vapour depression to temporarily collapse into a deeper, higher aspect ratio keyhole, with a significant decrease in keyhole width and increase in keyhole depth (although sometimes less significant), boosting the fluctuation frequency of keyhole. In III, relatively higher oscillation frequencies for the depth vs. the width also agrees with the discussion of Fig. 1, corresponding to bubbles being pinched off at the keyhole bottom, followed by a sharp decrease in keyhole depth. As shown in Fig.  2d, keyhole pores begin to form in II and increase in frequency through III. Comparing the final depth of pores relative to the substrate with the average keyhole depth (Supplementary Fig. 7) corroborates that bubbles initiate at the RKW in II and at the keyhole bottom in III.

Prior studies16,25 reported larger keyhole fluctuations with powder compared to bare substrate. Zhao et al. 16 hypothesised that this phenomenon is induced by the momentary interaction between particle spatter and the laser beam13, which shades the laser illumination and reduces recoil pressure, correspondingly increasing keyhole fluctuation. Here, by comparing the fluctuation frequency of keyhole width (Fig. 2b), depth (Fig. 2c), and also the tracked bubble numbers at per unit track length (Supplementary Fig. 8) with and without powder, we observed limited differences between the powder and bare plate samples. We hypothesise that the shadowing effect of particle spatter on the laser beam is less significant when a high laser power and a thin powder layer thickness are applied (for the laser spot size and alloy used in this study, a high laser power and a thin layer thickness is defined as ≥500 W and ≤30 µm, respectively), which is consistent with the finding reported by Khairallah et al. 13. Khairallah et al. found that there exists a power threshold beyond which the particle spatter expulsion mechanism is activated and could vaporise the spatter quickly, inversely, inducing pores due to laser shadowing with rapid cooling.

Keyhole-induced bubble lifetime dynamics in LPBF

Using our image processing pipeline (e.g., Kalman filter tracking51), we traced the evolutions of the keyhole-induced bubbles and extracted their centroids and equivalent diameters over their lifetime, starting after a bubble is pinched off from the keyhole and ending when the bubble is fully captured by the solidification front (see examples in Fig. 3, Supplementary Fig. 9a and Supplementary Movies 7, 8 with AED = 10 MJ m−2; Supplementary Figs. 9b, 10 and Supplementary Movies 14 with AED = 17 MJ m−2). We observed that bubbles evolve through three main stages, with and without the presence of a powder layer:

  1. (1)

    bubbles rapidly grow immediately after being pinched off from the keyhole (Fig. 3a–ii, iii, b–ii, iii, Fig. 3c, Supplementary Fig. 10d), thought to be due to pressure equalisation; then

  2. (2)

    the bubbles shrink while migrating towards the rear side of the melt pool (Fig. 3a–iv, v, b–iv, v Supplementary Fig. 10a–ii, iii, b–ii, iii, c), hypothesised to be caused by the condensation of the metal vapour in them, competing with the diffusion of hydrogen into the bubbles; and finally

  3. (3)

    they are captured by the advancing solidification front (Fig.3a–vi, b–vi, Supplementary Fig. 10a–v, b–v).

Fig. 3: Keyhole bubble lifetime dynamics during LPBF.
figure 3

Laser scan velocity 1 m/s and laser power 500 W. a and b are radiographs with Al7A77 powder and bare aluminium plate, respectively. c and d show example time evolutions of bubble equivalent diameter during LPBF with (solid line) and without (dash line) Al7A77 powder, respectively. The equivalent diameter is calculated using \(\sqrt{6A/\pi }\), where \(A\) is the bubble area measured from the X-ray image. Note the bubble size error is calculated as ±2 pixels (1.96 µm/pixel), equivalent to the segmentation uncertainty. The total tracked bubble numbers are 5 and 8 for the powder and bare plate cases (Supplementary Fig. 9a), respectively, using a criterion where the minimum number of frames that a bubble is identified is 6 (see the “Methods” section). The time t0 is set to the moment a bubble is first identified (Note, t0 is set as t0 = 0 in c and d). The black dashed circles show initial bubble growth in c. The bubbles of interest shown in a and b are marked by green and lavender colours, respectively, corresponding to same colours in c. Vap. vapour, Ar argon, H2 hydrogen. All scale bars correspond to 100 µm.

In stage (1), as the bubble was pinched off from the keyhole, the bubble inner pressure \({p}_{{\mathrm {\it{i}}}}\) is expected to be similar to the keyhole bottom recoil pressure (\(\sim \!{10}^{5}-{10}^{6}\,{{\mathrm {Pa}}}\)14,40), which is generally larger than the ambient pressure \({p}_{\it{a}}\) (~\(1\times {10}^{5}\,{{\mathrm {Pa}}}\)). This pressure difference then drives bubble growth according to the ideal gas law52 (\(p={nRT}/V\)), where the volume, \(V\), must increase to accommodate the reduction in pressure \(p\) from \({p}_{{\mathrm {\it{i}}}}\) to \({p}_{{\mathrm {\it{a}}}}\). (Note, \(n\) is the molar number of gas, \(R\) the universal gas constant, and \(T\) the temperature). Simultaneously, as the surrounding liquid metal cools the bubble, the superheated metal-vapour inside the bubble will condense, reducing \(n\), and hence decreasing the bubble volume \(V\), but at a slower rate than the pressure equalisation (discussed in detail later). This is also known as the bubble contraction mechanism in laser welding15,53.

In stage (2) bubbles shrink while migrating towards the rear side of melt pool, we observed that the bubble shrinkage undergoes a marked slowdown at the later stage of condensation (e.g., bubble 3 from 40 to 120 µs in Fig. 3d, bubble 1 from 40 to 80 µs in Supplementary Fig. 10c), and the bubble size then get stabilised. We speculate the reduction in shrinkage rate and eventual bubble size stabilisation are caused by the hydrogen diffusion34. The presence of hydrogen in keyhole pores was observed by Matsunawa et al. 15, who measured ~3–12% hydrogen content in pores formed during laser welding of aluminium alloy using mass spectrometry. Hydrogen is expected to be present in both the virgin substrate and powder particles. During LPBF, the melt at the advancing solidification front can then become supersaturated with hydrogen, driving hydrogen diffusion from the melt into the bubble30,32 and it is several orders faster than the diffusion of other atoms54.

In stage (3) as bubbles interact with the solidification front, we observed that they experience sudden bursts of growth and shrinkage (e.g., bubble 2 at 80–120 µs in Fig. 3c, Supplementary Fig. 11a, b). This phenomenon may be explained by the interaction of the bubble with the rapidly growing solidification microstructure55, where the cells and dendrites can restrict and distort the bubbles (Supplementary Fig. 11c), forming complex non-spherical pores, as described in Supplementary Discussion 2. Occasionally, other bubble dynamics were observed, including re-captured by the expanding keyhole, coalescence, and even splitting (Supplementary Movies 112).

Based on the above findings, from the initiation of a bubble until it gets frozen as a pore, its composition will initially be a combination of metal vapour and shielding gas argon (Ar), which is driven into the keyhole via the Bernoulli effect56. The metal vapour will condense, leaving the Ar, and reducing the bubble size. Simultaneously some hydrogen (H2) will diffuse in, slowing the bubble shrinkage. These stages are highlighted by the tracked bubble colours in Fig. 3a, b. Note that the argon can be treated as insoluble in molten aluminium57, and is therefore expected to be the major content left in the frozen pore.

To verify our hypothesis in the above discussion, we combined the Rayleigh–Plesset equation58, bubble condensation model from Florschuetz and Chao59, and the ideal gas law52 to build a united bubble model (see the “Methods” section) while considering pressure-driven growth, vapour condensation and hydrogen diffusion. We compared the modelled results with experimental measurements under different keyhole melting regimes (III, II), shown in Fig. 4, where we presented the tracked keyhole and keyhole pore transient trajectories at 0.8 and 1.2 m/s laser velocities (Fig. 4a, b) based on the X-ray images (Supplementary Movies 5, 6, 10, 11), corresponding to III (AED = 12.5 MJ m−2) and II (AED = 8 MJ m−2).

Fig. 4: Tracking and modelling of keyhole induced bubble dynamics.
figure 4

Colour map tracking for keyhole and bubble under low a and high b laser scan velocities, corresponding to regimes (III) and (II), respectively. Comparing the modelled bubble size variations with in situ X-ray measurements at low c and high d laser scan velocities. The equivalent diameter is calculated using \(\sqrt{6A/\pi }\), where \(A\) is the bubble area measured from X-ray image (see the “Methods” section). The bubble size error is calculated as ±2 pixels (1.96 µm/pixel), equivalent to the segmentation uncertainty. Note, the bubble shown in a split into two small ones in the later stage, where the equivalent diameter is estimated based on their sum area in (c). The temporal resolution of X-ray imaging (20 µs) is insufficient to capture the whole process of bubble growth, therefore, we are unable to get enough data and fully verify the bubble growth model. e Bubble migration distance compared to their initial formed location. The bubble migration distance error is calculated based on the bubble motion with instantaneous speeds (0–5 m/s) during the finite camera exposure time (2.5 µs). Low laser scan velocity 0.8 m/s, high scan velocity 1.2 m/s, laser power 500 W. The time 0 is set when a bubble first appears.

As seen from Fig. 4c, d, immediately after forming the bubble experiences explosive growth, which plateaus after about ~3–5 µs (Supplementary Table 1). The bubble then begins to shrink at a slower rate, and eventually stabilises (~50–150 µs), being consistent with the experimental measurements. (Note that deviations may be caused by the effect of surface tension and fluid flow that are not included in the built model.) We hypothesise that the explosive growth is caused by the pressure equalisation, with the bubble volume increasing like \({t}^{3}\) (see the “Methods” section). The decline and plateau in bubble growth is explained by the decrease in driving force (\({p}_{\it{i}}-{p}_{\it{a}}\)) with increasing bubble volume, based on the ideal gas law. We also speculate that the bubble shrinkage rate is slower than the bubble growth rate, proportional to \({t}^{-1/2}\) and \(t\), respectively (see the “Methods” section). Additionally, we hypothesise that the bubble shrinkage rate can be further slowed by the diffusion of hydrogen. The modelling results (Fig. 4c, d) show that accounting for the hydrogen diffusion is necessary to explain the latter stage of bubble size stabilisation and this leads to good agreement with the tracked bubble equivalent diameter. Note that our temporal resolution of X-ray imaging (20 µs) is insufficient to capture the whole process of bubble growth after being pinched off from the keyhole. With a calculated growth time on the order of microseconds, it is likely that we often fail to capture this growth, explaining why immediate bubble shrinkage is observed more frequently than initial bubble growth then shrinkage (Supplementary Fig. 9a, b).

The bubbles migrated a larger distance in II with a tendency of going backward and upward, when initiated at the RKW, than in III (Fig. 4e), when initiated at the bottom of the keyhole, remaining almost stationary. This is due to two effects (i) the proximity of the solidification front to the bottom of the keyhole, bubbles having insufficient time to move upwards in the melt pool20; and (ii) the melt flow velocity and flow pattern are location dependent across the melt pool48, and the induced drag force is local flow velocity dependent. The flow velocity is higher in the middle of the pool, hence when a bubble is formed half way along the RKW, it quickly flows backwards to the rear of melt pool. At the bottom of the pool near the solid–liquid interface, the flow velocity is low, hence bubbles detaching from the very bottom of keyhole remain nearly stationary until captured by the solidification front and turn to pores. The bubble in Fig. 4a (regime III) has an average velocity of \(1.0\pm 0.5\) m/s (measured over the first 60 µs), while the bubble in Fig. 4b (regime II) moves at \(2.4\pm 0.7\) m/s. In regime III with high AED, the pore migration speed of 1.0 m/s agrees well with our previous measurements of the Marangoni flow speed with tungsten carbide particles (0.97 m/s under the same AED)60. In regime II at lower AED, we assume that a strong viscous drag force is responsible for the higher initial speed of bubbles initiated at the RKW.


In summary, this manuscript reveals the lifetime dynamics of keyhole pore (growth, shrinkage, migration, interaction with solidification microstructure and capture by advancing solidification front), introducing a threshold, the normalised enthalpy product, to reveal and elucidate different keyhole pore generation mechanisms and their corresponding keyhole melting regimes under stable, transition and unstable conditions in LPBF. Our findings on keyhole fluctuation and bubble dynamics provide critical guidance (e.g., bubble growth/shrinkage rate, pore location and size) to achieve in situ pore elimination by remelting27,61 using dual-laser LPBF machines62 or hybrid LPBF63, and pore suppression via real-time control of keyhole dynamics (e.g., beam oscillation64) in a broad range of high-energy-beam processing techniques (e.g., electron beam melting65, keyhole laser welding64 and laser drilling66).

In this study, we combined our in situ synchrotron X-ray imaging results from LPBF of an aluminium alloy Al7A77 with recent studies of other key additive manufacturing alloys (e.g., Ti–6Al–4V, Inconel 718, SS 304). We found a transition regime (II) between the stable (I) and unstable (III) keyhole regimes. This transition regime (II) is most pronounced for high-PV combinations with large AED (\({{\mathrm {AED}}}\ge 7\,{{\mathrm {MJ}}}\cdot {{\mathrm {m}}}^{-2}\)). As shown in Fig. 1, the vapour depression becomes unstable in regime (II), randomly collapsing and inducing pores at the middle of the rear keyhole wall (RKW), as opposed to at the bottom of the keyhole in regime (III), which is the traditionally observed location for pore formation. We also observed significant trends in keyhole fluctuation frequency (radial and axial) across the different keyhole regimes, with the fastest fluctuation occurring in the transition regime (II) at ~10 kHz (Fig. 2). Based on our observations, we developed a material, machine and process condition agnostic relationship for the front keyhole wall (FKW) angle, which collapses to a single function of the normalised enthalpy product (Fig. 1b). The resulting relation provides a non-dimensional threshold for predicting the three keyhole regime transitions and the onset of keyhole porosity for different alloys and processing conditions (e.g., laser spot size, laser power, laser scan velocity).

In addition, we clarified the keyhole pore formation process, including the lifetime dynamics of vapour bubbles in the melt pool, which is characterised by three stages (Fig. 3): (1) fast pressure-driven growth, (2) shrinkage by metal vapour condensation, slowed by hydrogen diffusion, and (3) interaction with solidification microstructure (e.g., cellular-dendrites) and capture by the advancing solidification front. Furthermore, we proposed a model of bubble growth and shrinkage (Fig. 4), including the physics of pressure-driven growth, vapour condensation and hydrogen diffusion. This model was found to be consistent with the experimental data, supporting our hypotheses: (i) explosive bubble growth during the early lifetime of stage (1) is mainly a pressure-driven process, where the bubble volume expands like ~\({t}^{3}\); and (ii) hydrogen diffusion is sufficiently high to stabilise the bubble size at the later stage of condensation in stage (2).


LPBF replicator (ISOPR) system and processing conditions

In situ synchrotron X-ray imaging was performed at the Argonne National Laboratory’s Advanced Photon Source (APS) to probe keyhole and bubble dynamics during LPBF using ISOPR (Supplementary Fig. 1). ISOPR was custom-designed to accommodate synchrotron X-ray imaging of the LPBF process and includes a continuous wave Ytterbium-doped fibre laser (IPG YLR-500-AC, USA) with a wavelength of 1070 ± 10 nm and maximum power of 520 W, an XY galvanometer scanner (intelliSCANde 30, SCANLAB GmbH, Germany), an environmental chamber and a sample holder positioned at the centre of the chamber. During the experiment, the chamber was filled with argon gas at a pressure of +10 kPa to reduce oxidation. The keyhole and pores were imaged at high spatial (1.96 µm) and temporal (frame rate 50 kHz) resolutions with a FASTCAM SA-Z 2100K (Photron, USA) camera by converting the attenuated X-ray beam to optically visible light using a 100 μm-thick LuAg:Ce scintillator. The resultant field of view was 512 pixels (1 mm) in width by 680 pixels (1.33 mm) in height. The commercially Al7A77 powder (HRL Laboratory, USA, material composition shown in Supplementary Table 2) with a particle size range of 15–45 µm, and pure aluminium (Goodfellow, UK) plate with purity of 99.99% sandwiched between two 1 mm thickness glassy carbon plates (HTW, Germany), were used in this study with the process parameters shown in Table 1. Thermophysical properties of the materials are listed in Supplementary Table 3.

Table 1 Process parameters for the LPBF experiments.

Dimensionless analysis on front keyhole wall angle

The FKW angle is determined by its equilibrium kinematic condition, described as \({\tan }\,\theta ={v}_{{\mathrm {\it{d}}}}/{v}_{{\mathrm {\it{l}}}}\), which can also be estimated based on keyhole geometry as in reference67, \({\tan }\,\theta \approx d/{d}_{{\mathrm {\it{l}}}}\) (\(d\) is the keyhole depth). Linear relations between \({\tan }\theta\) and the keyhole depth \(d\) have been verified by recent studies16,25 over different materials in LPBF. Note, Zhao et al.16 found that the ratio \(d/{\tan }\theta\) can fluctuate around an effective laser spot size and falls with decreasing scan velocity. Here, we assume that the effective laser spot size might be approximated by the original laser beam diameter and the FKW angle may be expressed as, \({\tan }\theta \approx d/{d}_{{\mathrm {\it{l}}}}\), the keyhole depth \(d\) is approximately equal to the melt pool depth \({d}_{{\mathrm {\it{m}}}}\) with any difference being incorporated into the coefficient \({K}_{1}\) as44, \(d\approx {K}_{{\mathrm {1}}}\cdot {d}_{{\mathrm {\it{m}}}}\). The melt pool depth is estimated as the distance that the melt front advances in the axial direction during the dwell time (\({r}_{{\mathrm {\it{l}}}}/{v}_{{\mathrm {\it{l}}}}\), where rl is the laser beam radius), in the form of Eq. (1) based on the governing laws of heat transfer37,

$${d}_{{\mathrm {\it{m}}}}={K}_{2}\cdot \left(\frac{\triangle H}{{h}_{{\mathrm {\it{m}}}}}\right) {L}_{{{\mathrm {\it{th}}}}}$$

the FKW angle can therefore be expressed as a function of the normalised enthalpy product,

$$\theta \approx {atan}\left({K}_{3}\cdot \frac{\triangle H}{{h}_{{\mathrm {\it{m}}}}}\cdot {L}_{{{\mathrm {\it{th}}}}}^{* }\right)$$

where \({K}_{2}\) is a coefficient to account for differences between the actual and modelled melt pool dimensions, \({K}_{3}={K}_{1}\cdot {K}_{2}/2\),  \({L}_{{{\mathrm {\it{th}}}}}=\sqrt{({\alpha }_{{\mathrm {\it{l}}}}\cdot {r}_{{\mathrm {\it{l}}}})/{v}_{{\mathrm {\it{l}}}}}\) the thermal diffusion length, \(\Delta H/{h}_{{\mathrm {\it{m}}}}=(\beta \cdot {P}_{{\mathrm {\it{l}}}})/\left({h}_{{\mathrm {\it{m}}}}\sqrt{\pi \cdot {\alpha }_{{\mathrm {\it{l}}}}\cdot {v}_{{\mathrm {\it{l}}}}\cdot {r}_{{\mathrm {\it{l}}}}^{3}}\right)\) the normalised enthalpy6,43 (Note, \(\beta\) is the laser absorptivity, \({\alpha }_{\it{l}}\) is the liquid thermal diffusivity, \({h}_{{\mathrm {\it{m}}}}={\rho }_{{\mathrm {\it{l}}}}\cdot {c}_{{\mathrm {\it{l}}}}\cdot {T}_{{\mathrm {\it{l}}}}\) the enthalpy at melting with \({\rho }_{{\mathrm {\it{l}}}}\) the density, \({c}_{{\mathrm {\it{l}}}}\) the heat capacity at melting temperature \({T}_{{\mathrm {\it{l}}}}\)) and \({L}_{{{\mathrm {\it{th}}}}}^{* }={L}_{{{\mathrm {\it{th}}}}}/{r}_{{\mathrm {\it{l}}}}\) is the normalised thermal diffusion length.

Image and data processing pipeline

The major steps of our image processing pipeline (Supplementary Fig. 12) are as follows:

  1. i.

    Flat field correction, subtracting the offset background, followed by a 2D Gaussian filtering (Supplementary Fig. 12a, b). Note that the flat field correction used a general equation28: FFC = (I0−Flatavg)/(Flatavg−Darkavg), where FFC, I0, Flatavg and Darkavg represent the flat field corrected image, raw image, average of 100 flat filed images and average of 100 dark field images, respectively.

  2. ii.

    Initial image segmentation (Supplementary Fig. 12c) with K-means clustering algorithm68. The segmentation uncertainty is around ±2 pixels (1.96 µm/pixel).

  3. iii.

    Frame stack time-domain integration (Supplementary Fig. 12d) by applying volume threshold for noise reduction.

  4. iv.

    The final segmented keyhole and keyhole bubble were achieved by applying (iii) over the whole radiograph stack. Examples are shown in Supplementary Fig. 13a-iii, b-ii and Supplementary Movies, 2, 4, 6, 8, 11, where the keyhole and keyhole bubble were marked with green and red colours, respectively.

  5. v.

    Kalman filter tracking algorithm51 was developed based on the segmented keyhole bubble in step (iv). The minimum number of frames that a bubble is identified was set as 6 for being considered as an effective track. Bubbles observed for less than 6 frames were mainly recaptured by the keyhole.

Note that the segmentation algorithm developed in step (ii) fails in very limited cases due to background fluctuations (e.g., particles randomly falling into the gap between the glassy carbon and aluminium plates). Here we also developed a supervised machine learning (random decision forests) model to segment keyhole and bubbles (Supplementary Fig. 13b-iii), but found that the machine learning model fails more often during segmentation, possibly induced by the non-perfect ground-truth labelling as the X-ray frames may have different background fluctuations. The Kalman tracking algorithm developed in step (v) also fails occasionally due to the splitting or coalescence of bubbles, as well as background fluctuations. However, these segmentation and tracking errors are minor and do not significantly affect the quantified keyhole and bubble dynamics.

Peak-to-peak period for keyhole width/depth

Matlab’s built-in findpeaks function69 was used to extract peaks and valleys from the keyhole width/depth signatures. To mitigate the effect of outliers and noise, the signatures were pre-processed using a moving mean filter with a width of 3. A linear fit of the data was also subtracted to remove slow changes in the width/depth. To remain safely below the Nyquist frequency (25 kHz), the minimum peak distance was set to 5 (100 µs), acting as a simple low pass filter with cut-off frequency of 10 kHz. The minimum peak prominence was set to 1 standard deviation of the keyhole width/depth data set.

Bubble growth model with condensation and hydrogen diffusion

In the LPBF process, a rigorous modelling of the bubble dynamics while coupling the mesoscale and nanosecond multi-physics of the process remains a challenge. Here, we assume that the contents, temperature and pressure within the bubble are homogeneous, the bubble remains spherical and at rest relative to the incompressible melt pool flow. We take the bubble equivalent radius that the bubble is first identified as the bubble initial radius \({r}_{{\mathrm {\it{b}}}0}\) at the moment \(t=0\). In stage (1), considering the very short time of bubble growth, we suppose that there is negligible mass or thermal transfer over the bubble interface (no condensation or gas diffusion). Accordingly, the instantaneous bubble radius \({r}_{\it{b}}\left(t\right)\) at time \(t\) can be described by the Rayleigh–Plesset equation58,

$${r}_{{\mathrm {\it{b}}}}\cdot \frac{\partial }{\partial t}\left(\frac{\partial {r}_{{\mathrm {\it{b}}}}}{\partial t}\right)+\frac{3}{2}{\left(\frac{\partial {r}_{{\mathrm {\it{b}}}}}{\partial t}\right)}^{2}=\frac{1}{{\rho }_{{\mathrm {\it{l}}}}}\left({p}_{{\mathrm {\it{i}}}}-{p}_{{\mathrm {\it{a}}}}-\frac{2\sigma }{{r}_{{\mathrm {\it{b}}}}}-4{\mu }_{{\mathrm {\it{l}}}}\cdot \frac{\partial {r}_{{\mathrm {\it{b}}}}}{\partial t}\right)$$

where \(\sigma\) is the surface tension and \({\mu }_{{\mathrm {\it{l}}}}\) is the viscosity.

Since the surface tension and the viscosity terms (\(\sim \!{10}^{4}\,{\mathrm {{Pa}}}\)) are both negligible compared to the pressure difference \({p}_{{\mathrm {\it{i}}}}-{p}_{{\mathrm {\it{a}}}}\) (\(\sim \!{10}^{5}-{10}^{6}\,{{\mathrm {Pa}}}\))14,40, which can be omitted in the above Rayleigh–Plesset equation, the bubble growth rate can be approximated as58

$$\frac{\partial {r}_{{\mathrm {\it{b}}}}}{\partial t}\to {\left(\frac{2}{3}\cdot \frac{{p}_{{\mathrm {\it{i}}}}-{p}_{{\mathrm {\it{a}}}}}{{\rho }_{\it{l}}}\right)}^{\frac{1}{2}},{r}_{{\mathrm {\it{b}}}}\left(t\right)\gg {r}_{{\mathrm {\it{b}}}}\left(0\right)$$

This derived bubble growth rate suggests that, early in stage (1) with maximum pressure difference, the bubble grows with a function of time \(t\), while the bubble volume expands like \({t}^{3}\). The initial bubble inner pressure \({p}_{{\mathrm {\it{i}}}}(0)\) may be approximated as the recoil pressure \({p}_{{{\mathrm {\it{recoil}}}}}\), \({p}_{\it{i}}(0)\approx {p}_{{\it{recoil}}}\), where the recoil pressure is a function of temperature \(T\) based on Anisimov’s evaporation model5,14,

$${p}_{{{\mathrm {\it{recoil}}}}}=0.54{p}_{{\mathrm {\it{a}}}}{\exp }\left[\frac{\lambda }{{K}_{{\mathrm {B}}}}\left(\frac{1}{T}-\frac{1}{{T}_{{\mathrm {\it{v}}}}}\right)\right]$$

where \(\lambda =293.4\,{{{{{\rm{kJ}}}}}}\, {{{\mathrm {mol}}}}^{-1}\) is the latent heat of evaporation per atom of aluminium, \({K}_{{\mathrm {B}}}=8.314\times {10}^{-3}\,{{\mathrm {kJ}}}\, {{{\mathrm {mol}}}}^{-1}\, {K}^{-1}\) the Boltzmann constant, \(T\) the keyhole surface temperature, \({T}_{{\mathrm {\it{v}}}}=2753.15\,{\mathrm {K}}\) is the evaporation temperature of aluminium. By using the 2D moving heat source model6, the keyhole surface temperature is approximated by the melt pool peak temperature,

$$T=\frac{\sqrt{2}\beta I{r}_{{\mathrm {\it{l}}}}}{{k}_{{\mathrm {\it{l}}}}\sqrt{\pi }}{{\tan }}^{-1}\sqrt{\frac{2{a}_{{\mathrm {\it{l}}}}}{{v}_{{\mathrm {\it{l}}}}{r}_{{\mathrm {\it{l}}}}}}$$

where \(I\) is the laser intensity (approximated as \(I={P}_{{\mathrm {\it{l}}}}/\left(\pi {r}_{{\mathrm {\it{l}}}}^{2}\right)\)), and \({k}_{{\mathrm {\it{l}}}}={\rho }_{{\mathrm {\it{l}}}}\cdot {c}_{{\mathrm {\it{l}}}}\cdot {a}_{{\mathrm {\it{l}}}}\) is the liquidus thermal conductivity.

By combining the above Eqs. (4)–(6) and the ideal gas law52 (\(p={nRT}/V\)), the transient bubble size in stage (1) can be calculated as \({r}_{{\mathrm {\it{b}}}}\left(t\right)={r}_{{\mathrm {\it{b}}}0}+\triangle {r}_{{\mathrm {\it{b}}}1}\left(t\right),{t}\le {t}_{{\mathrm {1}}}\), where \(\triangle {r}_{{\mathrm {\it{b}}}1}\left(t\right)\) (solved from simultaneous Eqs. (4)–(6) and the ideal gas law) is the pressure-driven increment in bubble radius at time \(t\), and \({t}_{{\mathrm {1}}}\) is the pressure-driven bubble growth time. Note that \({t}_{1}\) is calculated as the time that the pressure difference \({p}_{{\mathrm {\it{i}}}}-{p}_{{\mathrm {\it{a}}}}\) reduces to a percentage threshold of \({p}_{{\mathrm {\it{a}}}}\) (we used 5% and defined as \({p}_{{\mathrm {\it{i}}}}\left({t}_{{\mathrm {1}}}\right)-{p}_{{\mathrm {\it{a}}}}\le 0.05{p}_{{\mathrm {\it{a}}}}\)).

In the condensation dominated stage (2), Florschuetz and Chao59 built the following relation between the bubble instantaneous radius \({r}_{b2}\left(t\right)\) and the radius at the beginning of vapour condensation \({r}_{b2}\left(0\right)\) (approximated as the \({r}_{b}({t}_{1})\)),

$$\frac{1}{3}{\left[\frac{{r}_{{\mathrm {\it{b}}}2}\left(t\right)}{{r}_{{\mathrm {\it{b}}}2}\left(0\right)}\right]}^{2}+\frac{2}{3}\frac{{r}_{{\mathrm {\it{b}}}2}\left(0\right)}{{r}_{{\mathrm {\it{b}}}2}\left(t\right)}=1+\frac{t}{{t}_{{{\mathrm {\it{cond}}}}}},\,{t}_{{{\mathrm {\it{cond}}}}}=\frac{\pi {\left[{r}_{{\mathrm {\it{b}}}2}\left(0\right)\right]}^{2}}{4{{Ja}}^{2}{a}_{{\mathrm {\it{l}}}}}$$

where \({t}_{{{\mathrm {\it{cond}}}}}\) is the condensation characteristic time and \({{\mathrm {Ja}}}\) is the Jakob number, \({{\mathrm {Ja}}}=\frac{{\rho }_{{\mathrm {\it{l}}}}{c}_{{\mathrm {\it{l}}}}\left({T}_{{{\mathrm {\it{bs}}}}}-{T}_{{{\mathrm {\it{sat}}}}}\right)}{{\rho }_{{\mathrm {\it{v}}}}{L}_{{\mathrm {\it{v}}}}}\) (\({T}_{{{\mathrm {\it{bs}}}}}\) is the bubble surface temperature, \({T}_{{{\mathrm {\it{sat}}}}}\) is the saturated temperature, \({L}_{{\mathrm {\it{v}}}}=1.02\times {10}^{7}\,{\mathrm {J}}\, {{{\mathrm {kg}}}}^{-1}\) is the latent heat of evaporation and \({\rho }_{{\mathrm {\it{v}}}}=1850\,{\mathrm {{kg}}}\, {{\mathrm {m}}}^{-3}\) is the vapour density).

In stage (2), the dissolved hydrogen in melt pool may diffuse into the bubble driven by the concentration difference. The bubble size \({r}_{{\mathrm {\it{b}}}3}\) induced by hydrogen diffusion may be estimated by the characteristic length of hydrogen diffusion limited growth \({l}_{{\mathrm {\it{D}}}}\)35 as, \({r}_{{\mathrm {\it{b}}}3}={l}_{{\mathrm {\it{D}}}}/2,{l}_{{\mathrm {\it{D}}}}=\sqrt{{\it{D}}_{{\mathrm {\it{h}}}}t}\), where \({D}_{{\mathrm {\it{h}}}}\) is the mass diffusivity of hydrogen in liquidus aluminium and may be approximated as an average of \({D}_{{\mathrm {\it{h}}}}\left({T}_{{\mathrm {\it{l}}}}\right)=1.0943\times {10}^{-7}{{\mathrm {m}}}^{2}\, {{\mathrm {s}}}^{-1}\) and \({D}_{{\mathrm {\it{h}}}}\left({T}_{{\mathrm {\it{v}}}}\right)=1.1302\times {10}^{-5}{{\mathrm {m}}}^{2}\, {{\mathrm {s}}}^{-1}\) based on ref. 70. Accordingly, the bubble radius in stage (2) that is controlled by vapour condensation and hydrogen diffusion may be described as \(\frac{4}{3}\pi {r}_{{\mathrm {\it{b}}}}^{3}=\frac{4}{3}\pi {r}_{{\mathrm {\it{b}}}2}^{3}+\frac{4}{3}\pi {r}_{{\mathrm {\it{b}}}3}^{3}\), based on mass balance (assuming that the contents, temperature and pressure within the bubble are homogeneous). Therefore, the instantaneous bubble radius in stages (1) and (2) can be approximated as

$${r}_{{\mathrm {\it{b}}}}\left(t\right)=\left\{\begin{array}{c}{r}_{{\mathrm {\it{b}}}0}+\triangle {r}_{{\mathrm {\it{b}}}1}\left(t\right),\,t\le {t}_{1}\\ \root 3 \of{{\left[{r}_{{\mathrm {\it{b}}}2}\left(t-{t}_{1}\right)\right]}^{3}+{\left[{r}_{{\mathrm {\it{b}}}3}\left(t-{t}_{1}\right)\right]}^{3}},\,t \, > \,{t}_{1}\end{array}\right.$$

All the parameters used in the model were listed in Supplementary Table 1 (characteristic parameters) and Supplementary Table 3 (thermal–physical properties), which were used to plot the bubble diameter graph in Fig. 4c, d. Note that we used the liquidus temperature for aluminium \({T}_{{\mathrm {\it{l}}}}=933.5\,{\mathrm {K}}\) to approximate the bubble saturation temperature \({T}_{{{\mathrm {\it{sat}}}}}\) in the melt pool, while for the bubble surface temperature \({T}_{{{\mathrm {\it{bs}}}}}\), we approximated its magnitude by fitting between observed data and the modelled results (Note, the bubble is subcooled in the melt pool with uncertainty temperature change under unknown time period after it has being pinched off from keyhole). For a spherical vapour bubble, the total condensation time is around \(1 \sim 3{t}_{{{\mathrm {\it{cond}}}}}\)32. Here, we used the average \(2{t}_{{{\mathrm {\it{cond}}}}}\) and modelled the bubble dynamics within \(2{t}_{{{\mathrm {\it{cond}}}}}\).