Introduction

Metallic foams have a wide range of applications including shock absorbers, heat exchangers, load bearings, and catalysts1. Some of the important properties of these materials are high energy absorption, high compressibility, and bending stiffness2,3,4. These properties are determined by the metallic character of the constituents, on the one hand, and the underlying porous microstructure, on the other hand. However, despite growing interest in using metallic foams, little is known about the mechanisms of microstructure formation in this class of materials.

This problem is at least partially related to the complexity of the processes involved in manufacturing metallic foams. A way to create bubbles is by subjecting the melt pool to a jet of gas5,6. Another, more frequent, route is to create a homogeneous distribution of bubbles in a melt pool via a suspension of solid particles, which start to produce gas above a threshold temperature7. Interestingly, the suspension mechanism is also used to producing porous structures in the polymer and the metal industry2,8. In this approach, the generated tiny bubbles grow by increasing the gas concentration until they form a space-filling porous microstructure, which is then frozen via solidification2,9,10. Since bubbles come in close contact during the growth process, a primary challenge is controlling the bubble coalescence, which usually proceeds significantly faster than bubble rearrangement dynamics. If not properly tuned, the coalescence of bubbles can lead to the formation of an open pore network with unfavorably large pores and a coarse microstructure.

A common approach to slow down the coalescence process in numerical studies is the use of a so-called disjoining potential11 or pressure12, which tends to keep bubbles apart9,13,14,15. In its generic form, this is a reasonably simple approach to mimic the effective outcome of various physical forces, such as the one arising from the agglomeration of small particles between bubbles, Marangoni-type effects, interface elasticity, or a combination of these16,17. To date, there are only a few models in the literature for studying microstructure formation in metallic foams17,18. In these models, bubbles are simplified as empty spaces (voids), thus neglecting the gas dynamics inside bubbles.

In a recent study19, we proposed a simple approach to slow down the bubble–bubble coalescence process by tuning the interface energy alone. It was shown there that the rate of coalescence could be reduced by many orders of magnitude so that bubble rearrangements could occur prior to any coalescence. A disadvantage of the method was that the Laplace pressure, which scales linearly with the interface energy, was also reduced in a dramatic way, thus making the bubbles highly deformable19. Moreover, the model did not contain free energy barriers to avoid coalescence. Thus, coalescence always occurred, albeit at a lower rate. This is in contrast to experimental observations where bubbles at contact (1) can resist to deformation unless they are tightly packed, and (2) remain stable for a finite time prior to a rapid coalescence. This finite time of stability is of crucial importance for structure formation in foams.

The present model presents a significant advancement as it allows to account for this realistic scenario without changing the bubbles’ resistance to deformation.

The paper is organized as follows. “Simulation method” section presents the new method and its important ingredients. The maturity of the proposed approach to simulate the formation of a complex foam microstructure is presented in “Results and discussion” section. A summary compiles the most important findings of this work.

Simulation method

The present simulation methodology combines ideas from multiphase flows20,21,22 with the well-established multi-phase-field method for microstructure evolution23,24,25. While the presence of fluid flow, capillarity, and wetting phenomena such as bubble–bubble coalescence and triple-phase contact angles in the formation of foams motivate the need for concepts in the field of multiphase flows, involving the multi-phase-field (MPF) method may, at least at first sight, appear less obvious. Therefore, we first introduce the MPF method and highlight the advantage of using such an approach. Dynamical equations, which dictate the time evolution of the system, are given after this subsection.

A multi-phase-field model

As mentioned above, the present approach builds upon the well-established multi-phase-field method. We use a version of this approach, which has first been proposed by Steinbach and coworkers23,24. For this purpose, we consider each individual bubble as a separate ’phase’ which occupies a certain region of space. The associated phase field function, \(\phi _\alpha ({\mathbf{x}} )\), then takes the value of 1 if the point \({\mathbf{x}}\) is completely occupied by the bubble with index \(\alpha\) (\(\alpha =1,2,\ldots ,N-1\); the index N being reserved for the surrounding liquid). Similarly, \(\phi _\alpha ({\mathbf{x}} )=0\) in the opposite case of complete absence of bubble \(\alpha\) at point \({\mathbf{x}}\). Of more interest is, of course, the situation, where the point \({\mathbf{x}}\) lies at the interface of bubble \(\alpha\) with other ones, in which case \(0<\phi _\alpha ({\mathbf{x}} )<1\) (Fig. 1). We adopt here the interpretation that \(\phi _\alpha ({\mathbf{x}} )\) is the fraction of volume element dV at \({\mathbf{x}}\) which is filled by the phase \(\alpha\). From this, it immediately follows that \(\sum _{\alpha =1}^N \phi _\alpha ({\mathbf{x}} )=1\), where the index \(\alpha =N\) accounts for the presence of ambient liquid.

Figure 1
figure 1

(a) Schematic representation of the bubbles inside a melt. Each individual bubble and also the surrounding liquid is represented by a separate phase-field variable, \(\phi _\alpha\), where \(\alpha =1,\ldots,N\). (b) The variation of phase field functions along the horizontal line drawn in (a).

While spatial distribution of bubbles is monitored by the phase field variables, physical properties of the system are accounted for in a functional integral for Helmholtz free energy, \({\mathcal {F}}\). Following the standard multi-phase-field method, one writes24,26

$$\begin{aligned} {\mathcal {F}} = \int _{\Omega }^{} {{\mathcal {L}}} \left( \{ \phi \}, \{ \nabla \phi \} \right) dV, \end{aligned}$$
(1)

where \(\Omega\) denotes the integration domain, \({{\mathcal {L}}}\) is the free energy density, \(\{ \phi \} = (\phi _{1},\phi _{2},\ldots,\phi _{N} )\) and \(\{ \nabla \phi \} = (\nabla \phi _{1},\nabla \phi _{2},\ldots, \nabla \phi _{N})\).

One of the main purposes of setting up a free energy functional in the present study is that it allows to derive, in a systematic way, an expression for the pressure tensor27. As will be seen below, the divergence of pressure tensor, \(\nabla \cdot {\mathbf {P}}\), plays a central role in updating the fluid velocity field. Exploring the translational invariance of \({\mathcal {L}}\) and accounting for the constraint that the sum of all phase fields is conserved at any point in space, one obtains (for a derivation see Supplementary Appendix-A)

$$\begin{aligned} \nabla \cdot {\mathbf {P}} = -\frac{1}{N}\sum _{\alpha =1}^{N} \sum _{\beta =1}^{N} \left\{ \frac{\delta {\mathcal {F}}}{\delta \phi _{\alpha }} - \frac{\delta {\mathcal {F}}}{\delta \phi _{\beta }} \right\} \nabla \phi _{\alpha }. \end{aligned}$$
(2)

Since all forces and thus \(\nabla \cdot {\mathbf {P}}\) vanish at equilibrium, the right hand side of Eq. (2) can be understood as the sum of forces, which arise due to deviations from equilibrium state. By considering changes of the functional integral, Eq. (1), under small deviations from thermodynamic equilibrium, one obtains,

$$\begin{aligned} \frac{\delta {\mathcal {F}}}{\delta \phi _\alpha } =\frac{\partial {{\mathcal {L}}}}{\partial \phi _\alpha } -\nabla \cdot \frac{\partial {{\mathcal {L}}}}{\partial \nabla \phi _\alpha }. \end{aligned}$$
(3)

Derivatives on the right hand side of Eq. (3) are to be understood as partial derivatives in ordinary sense. Under equilibrium conditions, the left hand side of Eq. (3) vanishes and one obtains the well-known Euler–Lagrange equation.

As the next necessary step, the free energy density, \({\mathcal {L}}\), must be specified. A standard choice here is a square-gradient model as in the Ginzburg–Landau theory of phase transitions28. When extended to the case of multiple phases, it can be written as19,24,29 (see also Supplementary Appendix-A),

$$\begin{aligned} {{\mathcal {L}}} = \sum _{\alpha = 1}^{N-1} \sum _{\beta = \alpha +1}^{N} \left( -\frac{4 \sigma _{\alpha \beta }\eta }{\pi ^2} \nabla \phi _{\alpha } \cdot \nabla \phi _{\beta } + \frac{4\sigma _{\alpha \beta }}{\eta } | \phi _{\alpha } \phi _{\beta }| -\left[ h(\phi _{\alpha }) p_{\alpha } (\rho _{\alpha }) + h(\phi _{\beta })p_{\beta }(\rho _{\beta })\right] \right), \end{aligned}$$
(4)

where \(\sigma _{\alpha \beta }\) is the interface energy between the phases \(\alpha\) and \(\beta\) and \(\eta\) denotes the width of the interface. \(|\phi _\alpha \phi _\beta |\) is known as the double obstacle (DO) potential30 and the square bracket gives the contribution to pressure arising from the pair of phases \(\alpha\) and \(\beta\), with h being an interpolation function. It can be shown that h does not affect the equilibrium state of a planar interface19. For a sphere in static equilibrium with its surrounding medium, on the other hand, the function h enters the force balance condition (see Supplementary Appendix-A.2).

It is important to note that the pressures \(p_\alpha\) and \(p_\beta\) in Eq. (4) must be evaluated via the equation of states (EOS) corresponding to the phases \(\alpha\) and \(\beta\), respectively. In the present study, the same ideal gas EOS is used for all bubbles (\(\alpha =1,2,\ldots ,N-1\)). For the surrounding liquid (\(\alpha =N\)), we use the well-known van der Waals equation of state,

$$\begin{aligned} p_\alpha ={\left\{ \begin{array}{ll} c^2_{{{\mathrm{s}}},{\mathrm{G}}} \rho _\alpha &{} \alpha <N{:} {\text { Gas phase }},\\ \dfrac{a\rho _\alpha }{b-\rho _\alpha } - c\rho _\alpha &{} \alpha =N{:} {\text { Liquid phase}}, \end{array}\right. } \end{aligned}$$
(5)

where \(c_{{{\mathrm{s}}},{\mathrm{G}}}\) is the sound speed in the gas phase and a, b, and c are the thermodynamic constants, characterizing the van der Waals liquid. It is noteworthy that a and c have the dimension of velocity square but b is a unreachable threshold density, at which fluid pressure diverges.

Density is determined via,

$$\begin{aligned} \rho _\alpha (t)=\dfrac{m_\alpha (t)}{V_\alpha (t)}=\dfrac{m_\alpha (t)}{\int _\Omega \phi _\alpha ({\mathbf{x}} ,t)dV}, \end{aligned}$$
(6)

with \(m_\alpha (t)\) being the total mass of the \(\alpha\)-th phase at time t, given by \(m_\alpha (t) = \lambda t + m_\alpha (0)\). Here, \(m_\alpha (0)\) is the initial mass within the bubble and \(\lambda\) is a constant mass release rate (see also “Results and discussion section”). The use of density from Eq. (6) in evaluating pressure is justified because we consider processes which are slow compared to the speed of sound. Spatial variations of density are thus assumed to homogenize instantaneously both within the bubbles and in the surrounding liquid. The fact that we do not need to survey the process of sound propagation allows the choice of a coarser grid and a larger discretization time step and thus provides a major enhancement of computational efficiency.

Dynamical equations

In the present model, microstructure evolution is governed by the dynamics of phase fields, \(\phi _\alpha\), with \(\alpha \in \{1,2,\ldots ,N\}\). The rule to update the \(\phi\)-fields accounts on the one hand for the dynamics of fluid and on the other hand for thermodynamic driving forces. Following31,32, one writes,

$$\begin{aligned} \frac{\partial \phi _\alpha ({\mathbf{x}} )}{\partial t} +\mathbf {u}({\mathbf{x}} ) \cdot \nabla \phi _\alpha ({\mathbf{x}} ) =-\frac{1}{\tilde{N}} \sum _{\beta =1}^{\tilde{N}} M_{\alpha \beta } \left( \frac{\delta {\mathcal {F}}}{\delta \phi _\alpha ({\mathbf{x}} )} -\frac{\delta {\mathcal {F}}}{\delta \phi _\beta ({\mathbf{x}} )} \right) , \end{aligned}$$
(7)

where \({\mathbf{u}}\) is the fluid velocity, \(\delta {\mathcal {F}} /\delta \phi _{\alpha }\) stands for functional or variational derivative as given by Eq. (3) and \(M_{\alpha \beta }\) is the interface mobility. Importantly, \(\tilde{N}\) is the number of phase fields present at the point \({\mathbf{x}}\) and must be distinguished from the total number of phase fields N.

The fluid velocity field, \({{\mathbf{u}}} ({\mathbf{x}} )\), is tracked everywhere in space by solving Navier–Stokes (NS) equations,

$$\begin{aligned} \rho ({\mathbf{x}} )\left( \frac{\partial {\mathbf{u}} }{\partial t} + {\mathbf{u}} \cdot \nabla {\mathbf{u}} \right) = -\nabla \cdot {\mathbf {P}} + \nabla \cdot \left( \mu ({\mathbf{x}} ) \left[ \nabla {\mathbf{u}} +(\nabla {\mathbf{u}} )^T \right] \right) + \mathbf{f} ^{\mathrm{ext}.}, \end{aligned}$$
(8)

where \(\mu\) is dynamic viscosity, \(\rho\) is the fluid density and \(\mathbf{f} ^{\mathrm{ext}}\) is the external force per unit volume. In regions of space where only a single phase, say \(\alpha\), is present, \(\mu =\mu _\alpha\) and \(\rho =\rho _\alpha\). In general, however, these quantities are defined via phase-averages, \(\rho ({\mathbf{x}} )=\sum ^N_{\alpha =1}\phi _\alpha ({\mathbf{x}} )\rho _\alpha\) and \(\mu ({\mathbf{x}} )=\sum ^N_{\alpha =1}\phi _\alpha ({\mathbf{x}} ) \mu _\alpha\). Even though it may not be apparent at first glance, Eq. (8) also contains interface effects on the right hand side. This information is encoded in the divergence of pressure tensor, \(\nabla \cdot \mathbf {P}\), which accounts both for the variation of hydrostatic pressure with density via the EOS and for interface forces by considering curvature terms33, see Eq. (A.14).

Non-coalescing case: the contact angle

The property that, within multi-phase-field method, one can assign a different phase index to each individual bubble provides a natural way to completely prevent the coalescence process. By doing so, each bubble can be treated as an independent entity with its physical properties. Using this feature, it is easy to consider the effect of additives at least on a qualitative level. For this purpose, we remark that when two bubbles \(\alpha\) and \(\beta\) come closer than a threshold distance, additive molecules which surround them repel each other. Here, for the sake of simplicity, we mimic this effect by a free energy penalty per unit area, \(\sigma _{\alpha \beta }\). By tuning this parameter, one can adjust the strength of additive-induced repulsion, thereby also influencing the so-called contact-angle. This is illustrated in Fig. 2 for the case of two bubbles in contact. At static equilibrium, it follows from the force balance that contact angles \(\theta _\alpha\) and \(\theta _\beta\) obey (Fig. 2a),

$$\begin{aligned} \sigma _{\alpha N}\cos (\theta _\alpha ) + \sigma _{\beta N}\cos (\theta _\beta )= \sigma _{\alpha \beta }, \end{aligned}$$
(9)
$$\begin{aligned} \sigma _{\alpha N}\sin (\theta _\alpha ) - \sigma _{\beta N}\sin (\theta _\beta )= 0. \end{aligned}$$
(10)
Figure 2
figure 2

A schematic view of two bubbles in contact, embedded in a melt pool. The presence of additives at the interface between two adjacent gas-bubbles leads to a free energy penalty per unit area, which is represented by \(\sigma _{\alpha \beta }\). (a) At equilibrium, force balance at three phase contact line (the point C in this 2D projection) must be satisfied. When projected onto the \(\sigma _{\alpha \beta }\)-line, one obtains for the relation between specific surface free energies, \(\sigma _{\alpha \beta }=\sigma _{\alpha N}\cos (\theta _\alpha )+\sigma _{\beta N}\cos (\theta _\beta )\). Balance of forces along the direction normal to the \(\alpha \beta\)-interface leads to \(\sigma _{\alpha N}\sin (\theta _\alpha )=\sigma _{\beta N}\sin (\theta _\beta )\). In panel (b), the energy penalty associated with additives vanishes (\(\sigma _{\alpha \beta }=0\)). It then follows from force balance that \(\theta _\alpha =\pi /2\) and \(\theta _\beta =\pi /2\). This means that the melt–gas and gas–gas interfaces must be perpendicular to each other. The horizontal dashed lines serves to highlight the fact that, within the multi-phase-field framework, bubbles \(\alpha\) and \(\beta\) remain distinguishable even though their interface energy vanishes. Panel (c) shows what happens if \(\sigma _{\alpha \beta }>\sigma _{\alpha N}+\sigma _{\beta N}\). In this case, bubbles go apart since the two newly formed liquid-gas interfaces have both together a lower free energy than that associated with the agglomeration of additives between two interfaces.

The idea of an interface energy penalty between two domains occupied by the same phases but having a sort of “mismatch” at the contact zone has been used in34 for the case of solid state precipitation in Ni-base superalloys. Here, we generalize and apply this idea for the first time to liquid–gas systems.

The above equations (9) and (10) for contact angle deserve some comments. First, it can be easily verified that Eq. (9) reduces to the well-known Young-equation35 for the three-phase contact angle on a flat solid. To see this, it is sufficient to identify the phase fields \(\alpha\) and \(\beta\) with vapor and solid phases, respectively, and use the fact that \(\theta _\beta =0\) for a planar substrate. It is noteworthy that, in this case, Eq. (10) is not valid since the normal projection of \(\sigma _{\alpha N}\) is not compensated by that of \(\sigma _{\beta N}\) but by elastic forces of the solid body, which resist deformation along the perpendicular direction. Second, Eq. (9) makes sense only if \(\sigma _{\alpha \beta }\le \sigma _{\alpha N}+\sigma _{\beta N}\) (recall that cosine function cannot exceed unity). This condition is always satisfied for \(\sigma _{\alpha \beta }=0\). In this case, and recalling that all interface energies are non-negative, Eq. (9) is solved by \(\theta _\alpha =\theta _\beta = \pi /2\) (Fig. 2b). However, if the free energy arising from additives at the gas–gas interface exceeds the sum of two gas–liquid interfaces energies, a melt layer forms between the bubbles, thereby reducing the total interface energy (Fig. 2c). This means that, from the perspective of bubble–bubble contact, a complete dewetting process takes place. The corresponding non-wetting condition can be expressed as

$$\begin{aligned} \sigma _{\alpha \beta }=(\sigma _{\alpha N}+\sigma _{\beta N})(1+q), \end{aligned}$$
(11)

with q being a non-negative empirical parameter. To see the physical meaning of q, let us consider that by some fluctuation an amount of liquid penetrates into the contact zone between two adjacent bubbles and separates them, thus generating two new liquid–gas interfaces (Fig. 2a–c). If \(q=0\), the total free energy will not change by this process, so that a fluctuation in the reverse direction can occur with equal probability and can restores the previous situation. A positive value of q changes this balance in favor of dewetting. As will be shown below, it ensures the existence of a dewetting-force or, equivalently, a free energy barrier against bubble–bubble coalescence.

In the following, we will assume that all the bubbles have identical liquid–gas and additive-induced gas–gas interface free energies, \(\sigma _{\alpha N}=\sigma _{\beta N}\equiv \sigma _{\mathrm{LG}}\) and \(\sigma _{\alpha \beta }\equiv \sigma _{\mathrm{SS}}\), respectively with \(\alpha , \beta \in \{1,2,\ldots ,N-1\}\). In this symmetric case, Eq. (10) leads to \(\theta _\alpha =\theta _\beta =\theta /2\) and Eq. (9) becomes,

$$\begin{aligned} \cos \left( \dfrac{\theta }{2}\right) = \dfrac{\sigma _{\mathrm{SS}}}{2\sigma _{\mathrm{LG}}}. \end{aligned}$$
(12)

Equation (12) provides a simple benchmark problem to examine the proposed approach under static equilibrium condition.

A model which completely avoids coalescence is an idealization which allows to focus on a time window and parameter range, where bubbles rearrange and change their shapes in order to accommodate with boundary conditions, while at the same time keeping their individual character as a physical entity. This way, formation of closed structures containing a disconnected set of bubbles can be investigated. Such structures do usually have good mechanical properties, while at the same time being lighter than the corresponding bulk metallic solid.

Condition for coalescence

If one is interested in a study of open structures, a model that allows for coalescence is needed. An important application of open porous structures is heterogeneous catalysis, where it is desirable that the reactants be able to enter and exit the porous body in order to come in contact with the entire catalytic surface. Other applications use open structures to reduce weight while at the same time optimizing mechanical properties.

Thanks to the flexibility of the multi-phase-field method, it is easy to include the coalescence phenomenon into the model, while at the same time having a safe control over its rate. This latter aspect is important since, as already mentioned above, the coalescence process usually proceeds quite fast, making it difficult to influence the foam structure by tuning the process parameters.

Following a similar approach, which was used in a study of superalloys34, we introduce a simple criterion, for the initiation of coalescence. The basic idea is that two bubbles will coalesce if (i) they come sufficiently close so that their distance falls below a certain threshold and (ii) if the force pushing their respective liquid–gas interfaces towards each other, \(\Delta p^{\mathrm{film}}\), is sufficiently high to overcome the free energy barriers (often referred to as disjoining pressure12), which tends to keep the bubbles apart.

A natural choice for the threshold distance for coalescence is the interface width \(\eta\). To estimate the disjoining pressure, which tries to push apart adjacent bubbles, we consider the slicing of an additive-rich gas–gas interface (which occurs at the contact zone between two adjacent bubbles) into two liquid–gas interfaces. This process can be regarded as completed when the separation distance reaches the interface thickness, \(\eta\). The change in free energy during this process is \(dF=(\sigma _{\alpha N}+\sigma _{\beta N}-\sigma _{\alpha \beta })A=-q(\sigma _{\alpha N}+\sigma _{\beta N})A\), where we used Eq. (11). A is the interface area considered in this problem. The volume created during this process is \(dV=A\eta\). The (disjoining) pressure, which is responsible for this process can now be obtained from the standard thermodynamic relation, \(\Pi _{\mathrm{disj}}=-dF/dV\). This gives,

$$\begin{aligned} \Pi _{\mathrm{disj}}=q\,\dfrac{(\sigma _{\alpha N}+\sigma _{\beta N})}{\eta }. \end{aligned}$$
(13)

It is important to note that the empirical parameter q provides the possibility to freely adjust the disjoining pressure. Of course, in order for \(\Pi _{\mathrm{disj}}\) to be effective, it must be of the same order of magnitude as the free energy densities involved in the problem. Thus, reasonable values of q will be of the order of unity.

In order to obtain a closed expression for coalescence criterion, we estimate the driving force, \(\Delta p^{\mathrm{film}}\), which pushes two neighboring gas–liquid interfaces, say \(\alpha\) and \(\beta\), towards each other. For this purpose, we first evaluate the net force per unit area on each of these interfaces. For the \(\alpha\)th bubble, this force is given by \(\Delta p_{\alpha N} = p_\alpha -(p_{N}+\kappa _\alpha \sigma _{\mathrm{LG}})\), where \(p_\alpha\) is the inner bubble pressure, \(p_N\) is that in the surrounding liquid and \(\kappa _\alpha\) is the curvature of the gas–liquid interface on the side close to the \(\alpha\)th bubble. Note that, as expected, this force vanishes at static equilibrium, where the Young–Laplace law holds. This is in line with the idea that thermodynamic equilibrium is the state of matter where all forces are in balance (resulting in zero net force) and all macroscopic variables are time-independent. Similarly, \(\Delta p_{\beta N} = p_\beta -(p_{N}+\kappa _\beta \sigma _{\mathrm{LG}})\) is the net force per unit area on the \(\beta\)th gas–liquid interface on the side facing the bubble \(\alpha\). A careful analysis now reveals that the net force, which pushes the two bubbles towards each other is given by

$$\begin{aligned} \Delta p^{\mathrm{film}}=\dfrac{\Delta p_{\alpha N}+\Delta p_{\beta N}}{2}. \end{aligned}$$
(14)

Putting all this together, coalescence takes place within the present model if

$$\begin{aligned} d<\eta \quad {\text {and}}\quad \Delta p^{\mathrm{film}}> \Pi _{\mathrm{disj}}\;\;\;\;({\text {coalescence-condition}}), \end{aligned}$$
(15)

where d is the distance between adjacent liquid–gas interfaces. If the condition (15) is satisfied, the region of space occupied by the two bubbles is identified as a single bubble. Technically, this is achieved by assigning the region of space occupied by \(\phi _\beta\) to \(\phi _\alpha\) (obviously, the reverse assignment \(\alpha \rightarrow \beta\) is equally valid). The redundant phase-field (in this example \(\phi _\beta\)) is then removed from the list of phase fields. Moreover, since the interface associated with the contact area of the phases \(\alpha\) and \(\beta\) disappears, the corresponding specific free energy, \(\sigma _{\alpha \beta }\), has no effect anymore and is thus removed from the list of parameters. Finally, depending on details of implementation, a re-indexing or other schemes can be applied to optimize memory usage.

As seen from the above description, in this work, we account for additive effects on foam stability at a qualitative level only. It would be interesting to consider in future studying additives explicitly. A force approach here would be to include additives as small solid particles. However, due to the large size difference between bubbles and particles, this would be computationally very demanding. A more computationally applicable choice would be to consider the time evolution of the concentration field associated with additive particles. This would provide access to local variations of the interface energy and would thus open the way to study a broader range of situations including Marangoni-type effects.

This completes the model section. Next, we will show that the model is indeed capable of both completely hindering or conditionally allowing the coalescence between neighboring bubbles (Fig. 4). Then, we will apply the thus developed computational tool to study evolution of microstructure in two and three dimensions.

Results and discussion

As a necessary step, we perform a number of Benchmark simulations to validate the approach proposed above. Aiming to mimic the case of an open melt pool, the density (and consequently pressure) of the melt pool is kept constant. This corresponds to the situation that liquid can leave the simulation domain upon bubble growth. Interestingly, since the sum of all phase fields at any point in space is constrained to unity (see the first paragraph in “A multi-phase-field model” section), the spatial domain occupied by \(\phi _N\) (liquid phase) reduces automatically as the total gas volume increases. The insertion of mass into the bubbles is stopped when the volume occupied by the gas phase exceeds a certain threshold.

The current model is designed to study generic trends which arise from a variation of different parameters such as gas release rate, liquid–gas density ratio, gas–liquid interface energy, and viscosity. Therefore, reduced parameters are used throughout this study. However, for liquid–gas density ratio, we chose a relatively large value of 10,000, which is close to density ratios in typical metallic foams. This already solves one of the challenging issues with regard to physical parameters, namely how to efficiently implement a high liquid–gas density ratio.

Unless otherwise stated, the grid spacing is \(\Delta x= 0.01\) and the time step is \(\Delta t=10^{-5}\). The unit of mass is set to one. All quantities given below are expressed in these reduced units. This means that to obtain the numerical value of a length, it must be multiplied with \(\Delta x\), and velocities have a non-written factor of \(\Delta x/\Delta t\). With this convention, the size of simulation domain is \(L_x=L_y=800\) in 2D and \(L_x=L_y=L_z=300\) in 3D. The numerical interface thickness is \(\eta =6\) both in 2D and 3D simulations. The speed of sound is set to \(c_{{\mathrm{s}}}=0.12\) and constants of the van der Waals fluid, Eq. (5), are set to \(a=6.4\), \(b=6000\), and \(c=0.75\times 10^{-6}\). For simplicity, we set viscosity of gas and liquid phases identical, \(\mu =\mu _{\mathrm{Gas}} = \mu _{{\mathrm{Liq}}} =1\). The initial radius of all bubble-nuclei is set to \(R(t=0)=6\) both in 2D and 3D simulations. A ’newborn’ gas bubble thus has a radius equal to the interface thickness. Gas densities within these bubbles are randomly assigned from the intervals \(\rho _{\mathrm{Gas}}(t=0) \in [2.6-2.9]\) in 2D and \(\rho _{\mathrm{Gas}}(t=0) \in [3.24-3.6]\) in 3D. As mentioned in “Simulation method” section, the amount of gas inside each bubble is then increased linearly with a constant rate of \(\lambda =0.32\times 10^{-4}\) in 2D and \(\lambda =0.16\times 10^{-4}\) in 3D. This process is stopped after bubbles grow sufficiently to come into close contact and occupy the entire simulation cell. The density of liquid phase is kept constant through the simulation, \(\rho _{{\mathrm{Liq}}}= 5200\).

As a test of physical consistency, it is instructive to use the above parameters and estimate the speed of sound in the liquid phase. Using the van der Waals EOS in Eq. (5), we obtain

$$\begin{aligned} c^2_{{\mathrm{s}},{\mathrm{Liq}}}=\dfrac{\partial p}{\partial \rho }\Big |_{\rho =\rho _{{\mathrm{Liq}}}} =\dfrac{ab}{(b-\rho _{{\mathrm{Liq}}})^2}-c=\dfrac{a}{b}\left( \dfrac{b}{b-\rho _{{\mathrm{Liq}}}}\right) ^2-c. \end{aligned}$$
(16)

Inserting the above values for \(a,\;b,\;c\) and \(\rho _{{\mathrm{Liq}}}\), one obtains \(c^2_{{\mathrm{s}},{\mathrm{Liq}}}\approx 0.06\) and thus \(c_{{\mathrm{s}},{\mathrm{Liq}}} \approx 0.245\), which is roughly twice the speed of sound in the gas phase. It is also noteworthy that the parameter c has essentially no effect on the value obtained for \(c_{{\mathrm{s}},{\mathrm{Liq}}}\). This is a consequence of the fact that the last term in Eq. (5) becomes important only at moderate densities relevant for condensation processes and has hardly an effect for phase behavior of a dense melt pool considered in the present study.

The liquid–gas surface free energy is set to \(\sigma _{\mathrm{LG}}=20.5\) in 2D and 10.25 in 3D. For bubble–bubble interface energy, we use \(\sigma _{\mathrm{SS}}=2\sigma _{\mathrm{LG}}(1+q)\), which is a special case of Eq. (11). It must be emphasized here that the q-parameter influences the nucleation of coalescence in our model via two closely related mechanisms. On the one hand, a larger q leads to a higher coalescence barrier via disjoining pressure, Eq. (13). On the other hand, it increases \(\sigma _{\mathrm{SS}}\) and thus makes the approaching motion of two bubbles towards each other energetically unfavorable.

Benchmark tests

The first benchmark test deals with the static equilibrium between two non-coalescing bubbles. As discussed above, in such a situation, the contact angle satisfies Eq. (12). A validation of this relation is provided in Fig. 3a, where simulation results for contact angle are plotted versus \(\sigma _{\mathrm{SS}}/2\sigma _{\mathrm{LG}}\). For each ratio of \(\sigma _{\mathrm{SS}}/2\sigma _{\mathrm{LG}}\), two sets of simulations are performed using different bubble sizes. It is visible from this plot that larger bubbles reproduce the analytic result more closely. This is related to the fact that determination of angle between curved lines is more accurate if the radius of curvature is larger. In the opposite limit, one would have a systematic bias towards larger angles as curves go more quickly apart with distance from the crossing point. In agreement with this interpretation, it is seen from Fig. 3a that angles obtained for smaller bubbles lie systematically above those for larger R. In Fig. 3b–d, the equilibrium configurations of three different contact angles (\(\theta /2=30\), 45, and \(60^\circ\)) for larger radius \(R=45\) are shown.

When two bubbles come into close contact, depending on forces which act upon them, they may undergo coalescence or remain separate. In the present model, the possibility for this bifurcation in dynamic behavior, which plays a key role in structure evolution in multi-bubble systems, is controlled via inequality (15). This issue is addressed in Fig. 4, where two bubbles grow with time until they meet. In the first case shown (panel (a)), the non-wetting condition, Eq. (11) is used with \(q=1\). Apparently, the system minimizes its free energy by keeping the bubbles apart. Starting with the same configuration as in panel (a), simulations are repeated using the coalescence condition, inequality (15). Two very similar cases that differ only in the initial gas density are considered. In one of these cases, the two bubbles merge and form a bigger one (Fig. 4b). In the other case, which started with a lower gas density, bubbles remain separated during the entire simulation time (Fig. 4c). This different behavior can be rationalized by a survey of the force, \(\Delta p^{\mathrm{film}}\), which drives the coalescence process. As seen in Fig. 4d, in the coalescing case, there is a time where \(\Delta p^{\mathrm{film}}\) exceeds the disjoining pressure. In the setup corresponding to Fig. 4c, however, the initial gas density inside bubbles is low and the driving force for coalescence remains below the threshold during the whole simulation.

In the instant of coalescence in Fig. 4b, one of the two phase-fields is deleted and the entire gas domain is assigned to the other one. This is shown in Fig. 5a, where the green lines represent the phase-field profiles of the bubbles at time \(t=0\) and the black line corresponds to the final state of the single bubble, which is the product of coalescence. All the profiles are plotted along the horizontal line passing through the center of coalescing bubbles. Density profiles before and after coalescence are also shown in Fig. 5b.

Figure 3
figure 3

(a) Equilibrium contact angle, \(\theta/2\), between two non-coalescing bubbles versus the ratio of surface energies, \(\sigma _{\mathrm{SS}}/2\sigma _{\mathrm{LG}}\). Symbols show simulations results for initial bubble radii of \(R=30\) and \(R=45\), and the solid line gives Eq. (12). For the larger bubble radius, simulations are closer to the theoretical predictions. This is expected because, as R grows, the numerical evaluation of tangent lines at the triple junction becomes less biased by the interface curvature. (bd) Equilibrium snapshots for small, intermediate and large values of \(\theta/2\) for \(R=45\).

Figure 4
figure 4

Test of the coalescence condition, inequality (15). In panel (a) bubbles remain separated throughout the entire process of growth and deformation because, in addition to choosing a high \(\sigma _{\mathrm{SS}}\), the phase fields representing the two bubbles are not allowed to merge into a single one. In (b) and (c), however, this possibility is introduced via the coalescence condition, inequality (15). The only difference between (b) and (c) is the use of different initial bubble-densities. Otherwise, identical simulation parameters are employed. In (b) coalescence condition is satisfied at a time of \(t\approx 225\Delta t\) and the bubbles merge into a single one (see also panel d). In (c), the initial densities within the bubbles are lower than in (b) so that driving forces always remain below the coalescence-threshold. (d) Variation of the \(\Delta p^{\mathrm{film}}\) with time for the two cases (b) and (c). The horizontal lines marks the threshold pressure, \(\Pi _{\mathrm{disj}}\) which must be overcome for initiation of coalescence. In all the cases shown, the initial bubble radius is \(R(t=0)=30\,=5\eta\).

Figure 5
figure 5

(a) The phase-field and (b) density profiles corresponding to the system of bubbles in Fig. 4b. These profiles are plotted along the horizontal line passing through the center of the bubbles in Fig. 4b. The phase-field profiles of the bubbles are shown in dark and light green for the initial time step, \(t=0\), and in black for final time step, \(t=t_f\), in (a). Similarly, the green and black lines in (b) correspond to the density profile at time \(t=0\) and \(t=t_f\).

The results discussed above clearly show that the present model has the capability to adequately account for static equilibrium and dynamic behavior of bubbles. Most importantly, it provides a physically motivated model to study structure formation in foams by completely preventing bubble-coalescence. At the same time, the model also contains a barrier-controlled criterion for coalescence, which can be used to tune the rate of coalescence and the resulting microstructure. Next, we show the results of many-bubble simulations both in two and three dimensions which underline the maturity of our model in dealing with complex structures.

Many-bubble simulations

We employ the model to simulate formation of foam microstructures for different disjoining pressures. This is achieved by changing the value of q in Eqs. (11) and (13). Since disjoining pressure determines the coalescence barrier, Eq. (15), the number of bubbles which merge will vary with q. This, in turn, will affect the number of pores and their size distribution, leading to variable foam structures. Here, we performed a set of simulations using three different values of q, \(q_1=0.25\), \(q_2=0.24\), and \(q_3=0.23\). Except for the value of q, all the other parameters and conditions were identical in the three simulations reported below. In all the cases shown, bubble nuclei grow due to the increase of mass until they come into contact, deform and rearrange, Fig. 6a–c. The process continues until the system is filled with bubbles separated by the liquid films (see the last row in Fig. 6a–c). For the case of \(q=0.25\), coalescence is hindered most effectively and the final structure contains a homogeneous distribution of pores, Fig. 6a. For the smaller value of \(q=0.24\) (Fig. 6b), coalescence is less suppressed and, consequently, the number of pores is decreased. In this case, distribution of bubble size is broadened since larger pores are produced due to coalescence. This results in a less homogeneous foam structure, as compared to the case of larger disjoining pressure (cf. panels a and b in Fig. 6). For even lower \(\Pi _{\mathrm{disj}}\) (\(q=0.23\)), still more bubbles merge into each other and this creates a foam including pores with a very large range of size, Fig. 6c. These results suggest that homogeneity of pore structure is deteriorated by lowering the coalescence barrier. Moreover, as highlighted in Fig. 7, this loss of homogeneity is accompanied by a broader bubble size distribution.

It is noteworthy that foam structures obtained in our simulations (last row in Fig. 6) are qualitatively similar to the experimental results for the aluminum foam (see Fig. 7 of18). Moreover, simulations reproduce characteristic foam structures such as a homogeneous distribution of polygonal bubbles (Fig. 6a) and a non-homogeneous round bubbles with different sizes and curvy liquid films (Fig. 6c).

Figure 6
figure 6

Time evolution (from top to bottom) of a system containing many bubbles for different surface free energies and disjoining pressures, controlled by tuning the q parameter in Eqs. (11) and (13). (a) \(q=0.25\), (b) \(q=0.24\), (c) \(q=0.23\). The color code represents the density field, dark blue for the liquid phase and light blue for the gas phase. From top to bottom, each row corresponds to \(t=0\), \(t=0.9\times 10^4\Delta t\), \(t=1.5\times 10^4\Delta t\), and \(t=10^5\Delta t\), respectively. The system size is \(800\times 800\) in the units of grid spacing, the interface width is set to \(\eta =6\,\Delta x\), and \(\rho _{{\mathrm{Liq}}}/\rho _{\mathrm{Gas}}\approx 10,000\).

Figure 7
figure 7

Histogram of bubbles volume distribution at time step \(t=10^5 \Delta t\) for foam structure using \(q=0.23\) (green) and 0.25 (blue). The bubble size is more uniformly distributed for the case of \(q=0.25\).

As the last example, we provide results on a 3D foam-microstructure simulated with the present model. To obtain a homogeneous structure and based on the knowledge gained from the above 2D simulations, we choose a very high free energy barrier for coalescence by setting \(q=1\) in Eqs. (11) and (13). The result of this simulation is shown in Fig. 8. The left column corresponds to bubbles/pores which evolve as a result of mass addition until they fill the simulation box. During the growth process, as the distance between two adjacent bubbles falls below \(\eta\), the energy barrier prevents their coalescence. Thus, bubbles deform by growing further until the structure reaches a semi-stable configuration (last row in Fig. 8).

Figure 8
figure 8

Result of 3D simulation for microstructure evolution of a foam representing bubbles in (a) and the liquid film around them in (b). Each raw, beginning from the top, corresponds to \(t=0\), \(1.5\times 10^4\), and \(5\times 10^4\Delta t\). The system size is \(300\times 300\times 300\) in the units of numerical resolution. The interface width is set to \(\eta =6\,\Delta x\). The initial density of each bubble is assigned from the range of \(\rho _\alpha (t=0) = 3.24-3.6\) and the density of the liquid is constant throughout the simulation, \(\rho _{\mathrm{l}}\). Thus, the density ratio is around \(\rho _{\mathrm{l}}/\rho _{\mathrm{g}} \approx 10,000\).

Conclusion

In this paper, we represent a 3D multi-phase-field model for simulation of microstructure evolution in metallic foams. First, a formulation of the model is presented which allows to completely avoid coalescence between bubbles. The model is then extended by a rule to allow for coalescence if (i) the liquid film between the bubble becomes thinner than a threshold and (ii) the force, which pushes the bubbles towards each other, surpasses the disjoining pressure. This approach is validated through benchmark tests and is shown to reproduce the analytically expected results. The thus established model is used to study structure evolution in two and three-dimensional cases. The present model is designed such that it allows to study the effects arising from a variation of the effective materials parameters (e.g., liquid–gas interface energy, equation of state in the gas phase) and process conditions (e.g., gas increase rate, the total released gas) on the overall structure of the foam as it evolves with time. It also allows for a study of the effects arising from different nucleation mechanisms on the evolution of foam microstructure. The model can be also easily extended to investigate dynamic evolution of the additive field and its effect of the local interface properties. This way, Marangoni-type effects will become accessible to the model.