Consider a 2D surface embedded in 3D space, labelled X. We introduce a second surface, S, a non-negative distance away from X. Figure 1 shows a cross-section of such a scenario, where surfaces S and X represent phase boundaries between phases α, β, and γ. In this schematic, where S is apart from X, the surface S demarks the boundary between α and β and X demarks the boundary between β and γ. Where S coincides with X, the surfaces represent the same boundary between the α and γ phases.

The volume enclosed between S and X represents an included phase on X, as shown in Fig. 2. The intent is to calculate the evolution of the parameterised surface S on the computational domain X, thereby capturing the 3D interface between the three phase boundaries on a single surface. The surface S can be represented as a parametrisation on the surface X. This is accomplished by transforming S onto X following a projection vector, \( \overrightarrow{r} \), as depicted in Fig. 3. This projection vector is required to be smoothly varying everywhere on X, including any sharp edges and vertices and should be close to the local normal as discussed below.

In order to generate such a vector field for a closed surface, a suitable “focal point”, \( \overrightarrow{f} \), is selected towards which \( \overrightarrow{r} \) is directed. The point \( \overrightarrow{f} \) is usually, but is not necessarily required to be, selected as the centre of curvature of X. The selection of the point \( \overrightarrow{f} \) does impose some limitations on the model which are discussed at the end of this section. Representing the current point on X as \( \overrightarrow{x} \), the vector field is defined

$$ \overrightarrow{r}=\overrightarrow{f}-\overrightarrow{x}= r\widehat{r}, $$

(1)

where \( \hat{r} \) is the unit direction vector of \( \overrightarrow{r} \) and *r* is the magnitude of the \( \overrightarrow{r} \) vector. The corresponding point on S, \( \overrightarrow{s} \), is defined by the equation

$$ \overrightarrow{s}=\overrightarrow{x}+ h\widehat{r}, $$

(2)

in which *h* is the unknown scalar variable calculated on X, which is the distance from surface X to surface S along the vector \( \overrightarrow{r} \).

It should be noted that *h* may be positive or negative, representing surfaces above or below the surface of X relative to \( \overrightarrow{f} \). In principle, it is possible to represent separate surfaces above and below surface X simultaneously leading to two values of *h*. However, in this work, a single surface S is considered that can be mirrored assuming symmetry above and below X.

The total interfacial energy of the system, *E*, is calculated as the integral of the interfacial energy density, *σ*, between phases (labelled by subscripts) and a possible triple junction energy,

$$ \begin{array}{l} E={\displaystyle \underset{S}{\int }{\sigma}_{\alpha \beta} dS+{\displaystyle \underset{X}{\int }{\sigma}_{\beta \gamma} dX\kern1.5em \mathrm{where}\kern0.5em \mathrm{S}\ne \mathrm{X}}}\\ {}+{\displaystyle \underset{X}{\int }{\sigma}_{\alpha \gamma} dX\kern1em \mathrm{where}\ \mathrm{S}=\mathrm{X}}\\ {}+{\displaystyle \underset{L}{\int }{\sigma}_{\alpha \beta \gamma} dL}\end{array} $$

(3)

where *dS* is an infinitesimal area of surface S and *dX* is an infinitesimal area of surface X, and *dL* is an infinitesimal line segment between S and X corresponding to the triple junction. In general, externally imposed forces, such as gravity and aerodynamic drag, may be introduced in Eq. 3 as additional system potentials; however, these are neglected from the current derivation for the sake of simplicity.

Since the surface S is defined parametrically in terms of the computational domain, the relation between the area elements of S and X is

$$ d S=\left|\overrightarrow{s_1}\times \overrightarrow{s_2}\right| d X, $$

(4)

where the vectors \( \overrightarrow{s_1} \) and \( \overrightarrow{s_2} \) are the gradients of surface S on X corresponding to the unit surface tangent vectors \( {\widehat{\tau}}_1 \) and \( {\widehat{\tau}}_2 \) at point \( \overrightarrow{x} \), as shown in Fig. 3. The figure shows orthogonal tangent vectors, although the following derivation does not require such. Denoting the spatial derivatives in the local coordinates along these vectors with the subscripts *τ*
_{1} and *τ*
_{2}, \( \overrightarrow{s_1} \) and \( \overrightarrow{s_2} \) may be calculated and expressed as,

$$ \overrightarrow{s_1}=\left({\widehat{\tau}}_1\cdot \nabla \right)\overrightarrow{s}={\widehat{\tau}}_1+{h}_{\tau_1}\widehat{r}+ h{\widehat{r}}_{\tau_1}, $$

(5)

$$ \overrightarrow{s_2}=\left({\widehat{\tau}}_2\cdot \nabla \right)\overrightarrow{s}={\widehat{\tau}}_2+{h}_{\tau_2}\widehat{r}+ h{\widehat{r}}_{\tau_2}. $$

(6)

In order to perform the integral over the whole domain while distinguishing between “S ≠ X” and “S = X”, a phase function, *p*(*h*), is defined that varies between 0 and 1, corresponding to where S is in contact with X, as determined by the local value of *h*. This scheme is illustrated in Fig. 4 which shows the range of *h* in which *p* varies from 1 to 0, and the resulting diffuse interface of width *d*. This interface is treated as being spatially diffuse, similar to standard phase-field models that demonstrate robustness and versatility of handling complex interface morphology (Cahn and Hilliard 1958). Due to the spatial variation of *h* as the dependant variable, this implies *p*(*h*) be diffuse in *h*, between *h* = 0, representing the coincidence of S and X, and *h* > *h*′, representing the separation of S and X. The value of *h*′ is user-defined transition size and linked to the choice of the form of *p*(*h*). The region 0 > *h* >*h*′ therefore denotes the diffuse triple junction interface between the three phases.

It should be noted that the model of the included phase is sharp across the surface S which has no associated thickness. The diffuse interface occurs where S meets X, over a user-defined transition size in *h* and therefore an interval in space. This region also defines the α − β − γ triple junction which is therefore partially diffuse. Since it is here that the contact angle is defined, the user-defined transition size impacts the contact angle observed in the model. In the “Stationary point” section, we demonstrate that in the limit of zero transition size, the sharp interface contact angle is recovered. In the “Contact angle” section, we further demonstrate that the results of the numerical model converge towards the sharp interface when the transition size is decreased.

The form of *p*(*h*) is flexible as long as the following conditions are respected:

$$ p\left( h=0\right)=0, $$

(7)

$$ p\left( h = h\hbox{'}\right)=1, $$

(8)

$$ \frac{\partial p}{\partial h}\left( h=0\right)=\frac{\partial p}{\partial h}\left( h= h\hbox{'}\right)=0, $$

(9)

such that both phases at equilibrium are locally stable with respect to variations in *h*. A particular example of *p*(*h*) is shown in the “Numerical behaviour” section, but the properties of the model can be derived regardless of this choice.

Triple junction energy can be added to the model, which only occurs within the diffuse interface. A function *g*(*p*) is introduced, with the requirement that *g*(*p* = 0) = *g*(*p* = 1) = 0 and \( \frac{\partial g}{\partial p}\left( p=0\right)=\frac{\partial g}{\partial p}\left( p=1\right)=0 \). Once more, the form of this function is flexible, but a standard double well potential, *g* ∝ *p*
^{2}(1 − *p*)^{2}, may be used.

Utilising the phase function and the interface energy densities with subscripts according to the phases, the energy functional becomes

$$ E={\displaystyle \underset{X}{\int}\left( p\left[{\sigma}_{\alpha \beta}\left|\overrightarrow{s_1}\times \overrightarrow{s_2}\right|+{\sigma}_{\beta \gamma}\right]+{\sigma}_{\alpha \gamma}\left[1- p\right]+{\sigma}_{\alpha \beta \gamma} g(p)\right) dX,} $$

(10)

which describes the energy of the system in terms of the areas of the three interfaces. Suppose now that the volume enclosed between S and X represents the precipitated (*β*) phase, consisting of a mobile species with concentration *c*. Assuming constant density *ρ*, the concentration of the species is related to the volume by *c* = *ρV*. The chemical potential of this species, *μ*, is defined as the functional derivative with respect to the concentration

$$ \mu =\frac{\delta E}{\delta c}=\frac{1}{\rho}\frac{\delta E}{\delta h}\frac{\delta h}{\delta V}. $$

(11)

which necessitates calculating the variational derivative of volume enclosed by *h*.

Consider the area elements as the bases of pyramids with apex \( \overrightarrow{f} \), as shown in Fig. 3. The volume is calculated as one third the base times the perpendicular height, which is the projection of the normal vector of X, \( \widehat{n}, \) onto \( \overrightarrow{r} \). The enclosed volume is therefore the difference between pyramids defined by *X* and *S*, and the volume is

$$ V={\displaystyle \underset{X}{\int}\frac{r}{3}}\left(\left[\widehat{n}-\left(\overrightarrow{s_1}\times \overrightarrow{s_2}\right)\left(1-\frac{h}{r}\right)\right]\cdot \widehat{r}\right) d X. $$

(12)

The functional derivative of Eq. 12 is evaluated by the Euler-Lagrange equation

$$ \frac{\delta V}{\delta h}=\left(\frac{\mathit{\partial}}{\mathit{\partial} h}-\frac{\mathit{\partial}}{\mathit{\partial}{\widehat{\tau}}_1}\frac{\mathit{\partial}}{\mathit{\partial}{h}_{\uptau_1}}-\frac{\mathit{\partial}}{\mathit{\partial}{\widehat{\tau}}_2}\frac{\mathit{\partial}}{\mathit{\partial}{h}_{\uptau_2}}\right)\left(\frac{dV}{dA}\right). $$

(13)

The last two terms in the first parenthesis on the right-hand side consist of the derivatives with respect to the gradient in *h*. They are found to be zero utilising \( \overrightarrow{s_1} \) and \( \overrightarrow{s_2} \) defined by Eq. 5 and 6, respectively, and noting that the triple product \( \left(\overrightarrow{a}\times \overrightarrow{b}\right)\cdot \overrightarrow{a}=0 \) is for all \( \overrightarrow{a} \) and \( \overrightarrow{b} \). Additionally, it can be shown that for pyramids, the area of any cross-section scales according to the square of the fractional height, and therefore (Harris and Stöcker 1998),

$$ \overrightarrow{s_i}\left( h,\nabla h\right)=\left(1-\frac{h}{r}\right)\overrightarrow{s_i}\left( h=0,\nabla h\right), $$

(14)

Therefore, one can write

$$ \frac{\mathit{\partial}}{\mathit{\partial}{h}_{\uptau_1}}\left(\left(\overrightarrow{s_2}\times \overrightarrow{s_2}\right)\cdot \overrightarrow{r}\right)=\left(\widehat{r}\times \overrightarrow{s_2}\right)\cdot \overrightarrow{r}=0, $$

(15)

$$ \frac{\mathit{\partial}}{\mathit{\partial}{h}_{\uptau_2}}\left(\left(\overrightarrow{s_1}\times \overrightarrow{s_2}\right)\cdot \overrightarrow{r}\right)=\left(\overrightarrow{s_1}\times \widehat{r}\right)\cdot \overrightarrow{r}=0, $$

(16)

$$ \frac{\mathit{\partial}\left(\overrightarrow{s_1}\times \overrightarrow{s_2}\right)}{\mathit{\partial} h}=-\frac{2}{r}{\left(1-\frac{h}{r}\right)}^{-1}\left(\overrightarrow{s_1}\times \overrightarrow{s_2}\right), $$

(17)

which, when simplified, yields the intuitive answer for Eq. 13,

$$ \frac{\delta V}{\delta h}=\left(\overrightarrow{s_1}\times \overrightarrow{s_2}\right)\cdot \widehat{r}. $$

(18)

The variational derivative of the energy functional with respect to the variable *h* must also be evaluated using the Euler-Lagrange equation. Noting that in general, the phase function depends only on *h*, while \( \overrightarrow{s_1} \) and \( \overrightarrow{s_2} \) depends on both *h* and ∇*h*, \( \frac{\delta E}{\delta h} \) becomes

$$ \frac{\delta E}{\delta h}=\left({\sigma}_{\alpha \beta}\left|\overrightarrow{s_1}\times \overrightarrow{s_2}\right|+{\sigma}_{\beta \gamma}-{\sigma}_{\alpha \gamma}+{\sigma}_{\alpha \beta \gamma}\frac{\mathit{\partial} g}{\mathit{\partial} p}\right)\frac{\mathit{\partial} p}{\mathit{\partial} h}+ p{\sigma}_{\alpha \beta}\frac{\mathit{\partial}\left|\overrightarrow{s_1}\times \overrightarrow{s_2}\right|}{\mathit{\partial} h}-{\sigma}_{\alpha \beta}\left(\frac{\mathit{\partial}}{\mathit{\partial}{\widehat{\tau}}_1}, p,\frac{\mathit{\partial}\left|\overrightarrow{s_1}\times \overrightarrow{s_2}\right|}{\mathit{\partial}{h}_{\uptau_1}},+,\frac{\mathit{\partial}}{\mathit{\partial}{\widehat{\tau}}_2}, p,\frac{\mathit{\partial}\left|\overrightarrow{s_1}\times \overrightarrow{s_2}\right|}{\mathit{\partial}{h}_{\uptau_2}}\right), $$

(19)

which can be further simplified utilising Eqs. 5, 6, and 17 to obtain a form suitable for implementation in computer codes

$$ \begin{array}{l}\frac{\delta E}{\delta h}=\left({\sigma}_{a\beta}\overrightarrow{\left|{s}_1\right|}\times \overrightarrow{\left|{s}_2\right|}+{\sigma}_{\beta y}-{\sigma}_{a y}+{\sigma}_{a\beta y}\frac{\partial \fontfamily{Utsaah}{g}}{\partial p}\right)\frac{\partial \fontfamily{Utsaah}{p}}{\partial h}- p{\sigma}_{a\beta}\frac{2}{r}{\left(1-\frac{h}{r}\right)}^{-1}\overrightarrow{\left|{s}_1\right|}\times \overrightarrow{\left|{s}_2\right|}\\ {}-{\sigma}_{a\beta}\left(\frac{\partial }{\partial {\widehat{\tau}}_1} p\frac{\overrightarrow{s_1}\times \overrightarrow{s_2}}{\left|\overrightarrow{s_1}\times \overrightarrow{s_2}\right|}\cdot \widehat{r}\times \overrightarrow{s_2}+\frac{\partial }{\partial {\widehat{\tau}}_2} p\frac{\overrightarrow{s_1}\times \overrightarrow{s_2}}{\left|\overrightarrow{s_1}\times \overrightarrow{s_2}\right|}\cdot \overrightarrow{s_1}\times \widehat{r}\right).\end{array} $$

(20)

This can be used to evaluate the chemical potential of the included phase by Eq. 11. Note that the term \( \frac{\overrightarrow{s_1}\times \overrightarrow{s_2}}{\left|\overrightarrow{s_1}\times \overrightarrow{s_2}\right|}={\widehat{n}}_S, \) the unit normal to the interface.

The gradient in the chemical potential is the driving force for the mass flux, *J*. The mass flux may apply to a layer along the interface *S*, in the case of surface diffusion or as an approximation to bulk diffusion, or the enclosed volume, such as vapour phase transport. In general, surface, bulk, and volume diffusion occur, but one of them usually dominates for any specific situation (Welland 2012).

In order for this to be a reasonable approximation for volume diffusion, the gradient of *μ* along \( \widehat{r} \) must be small relative to the gradient along surface tangent vectors \( \overrightarrow{\tau_1} \) and \( \widehat{\tau_2} \), such as when the thickness of the included phase is small compared to the characteristic length scale along *X* (i.e. when *h* ≪ *r*). Using the notation \( {\nabla}_{\tau}=\frac{\partial }{\partial {\tau}_1},\frac{\partial }{\partial {\tau}_2} \), the net flux acting on the volume, *J*
_{
V
}, is

$$ {J}_V=\rho V{M}_V\left[-{\nabla}_{\tau}\mu +\overrightarrow{F_V}\right], $$

(21)

where \( \overrightarrow{F_V} \) is a generic external force and *M*
_{
V
} is the mobility through the volume, related to the diffusion coefficient, *D*, by \( {M}_V=\frac{D}{RT} \) for an ideal solution where *RT* is the ideal gas constant times the absolute temperature (Welland et al. 2014). Similarly, the net mass flux from surface phenomena, *J*
_{
S
}, represented on X is

$$ {J}_S=\rho \left|\overrightarrow{s_1}\times \overrightarrow{s_2}\right|{T}_{int}{M}_S\left[-{\nabla}_S\mu +\overrightarrow{F_S}\right]. $$

(22)

Here, the volume is replaced with the surface area, \( \left|\overrightarrow{s_1}\times \overrightarrow{s_2}\right| \), times the effective thickness of the interface, *T*
_{int}. *M*
_{
S
} is the surface mobility, which for practical purposes can be combined with the thickness into a single effective material property, \( \frac{D_{S eff}}{RT}={T}_{int}{M}_S \). The variable \( \overrightarrow{F_S} \) accounts for surface forces, which may be present, such as drag or friction. The gradient along the surface, ∇_{
S
}, can be expressed in terms of ∇_{
τ
}, using the transformation matrix [*T*] that accounts for the change in path length along each coordinate akin to the arbitrary Lagrangian-Eulerian method (Donea et al. 2004),

$$ {\nabla}_S=\left[\boldsymbol{T}\right]{\nabla}_{\tau}. $$

(23)

The overall mass conservation equation for concentration of the beta phase, assuming constant density as in Eq. 11, including both surface and volume fluxes, as well as a source term, *Q*, becomes

$$ \frac{\partial c}{\partial t}=\rho \frac{\delta V}{\delta h}\frac{\partial h}{\partial t}=-{\nabla}_{\tau}\cdot {J}_V+-{\nabla}_S\cdot {J}_S+ Q. $$

(24)

The model therefore requires the solution of the partial differential equation for Eq. 24 with the chemical potential from Eq. 11, the variation of volume with *h* from Eq. 18, and the variation in total energy with *h* from Eq. 20. When combined, this is a fourth order non-linear partial differential equation for *h*, defined on the 2D surface X. Alternately, Eq. 11 may be solved simultaneously with Eq. 24 for *μ* and *h* as two coupled second order equations on X. This allows it to be solved using the standard *C*
_{0} continuous Lagrange elements available in most finite-element method codes. Note that although the equations are in terms of the distances between surfaces *h*, the conserved quantity is still the concentration of the *β* phase *c*. This is also equivalent to conservation of the volume of the *β* phase since density has been assumed constant in this version of the model.

The suitability criteria for the vector field \( \overrightarrow{r} \) and the selection of the focal point \( \overrightarrow{f} \) can now specified. Considering Fig. 3, it is clear that in order for S to be uniquely defined, there must be a one-to-one mapping from X to S. Specifically, \( {\widehat{n}}_S\cdot \widehat{r}\ne 0 \), for *all* points on X. From this requirement, the contact angle of the included phase with respect to surface X must be less than the minimum value of \( { \sin}^{-1}\left({\widehat{n}}_X\cdot \widehat{r}\right) \) over the domain. This is the reason that contact angles equal to or greater than 90° are not representable in this work in the ideal case where \( \widehat{r}={\widehat{n}}_X \). For practical geometries where \( {\widehat{n}}_X\cdot \widehat{r}<1 \), such as along edges between facets, this limits the contact angle to less than half the internal angle. By careful definition of \( \widehat{r} \), the limitations imposed by this requirement can be minimised. Note that this does not preclude concave surfaces nor does it preclude complex 2D manifolds.

### Thin interface approximation

In the case where \( \overrightarrow{f} \) may be far enough from X such that *r* ≫ *h*, the spatial variation of \( \widehat{r} \) can be neglected. Under this approximation, Eqs. 5 and 6 become

$$ \overrightarrow{s_1}=\widehat{\tau_1}+{h}_{\tau_1}\widehat{r}, $$

(25)

$$ \overrightarrow{s_2}=\widehat{\tau_2}+{h}_{\tau_2}\widehat{r}. $$

(26)

One can also simplify Eq. *12* to read

$$ V={\displaystyle \underset{X}{\int}\widehat{n}}\cdot h\widehat{r} d X, $$

(27)

and therefore,

$$ \frac{\delta V}{\delta h}=\widehat{n}\cdot \widehat{r}, $$

(28)

which avoids the multiple calculations of the cross product, \( \overrightarrow{s_1}\times \overrightarrow{s_2} \), and their derivatives, leading to significant computational savings.

### Special case of flat interfaces

A further simplification is possible when \( \widehat{r}\approx \widehat{n} \) (e.g. a planer or spherical geometry), such that Eqs. 5 and 6 become

$$ \overrightarrow{s_1}=\widehat{\tau_1}+{h}_{\tau_1}\widehat{n}, $$

(29)

$$ \overrightarrow{s_2}=\widehat{\tau_2}+{h}_{\tau_2}\widehat{n}. $$

(30)

and leads to a simplified form for the cross-products, in the tangent system,

$$ \overrightarrow{s_1}\times \overrightarrow{s_2}=\left\langle -{h}_{\tau_1},-{h}_{\tau_2},1\right\rangle, $$

(31)

$$ \left|\overrightarrow{s_1}\times \overrightarrow{s_2}\right| = \sqrt{1+{h}_{\tau_1}^2+{h}_{\tau_2}^2}. $$

(32)

Additionally, for the planar case, one simplifies Eq. *28* to

$$ \frac{\delta V}{\delta h}=1. $$

(33)

The mass balance in Eq. 24 therefore becomes

$$ \rho \frac{\partial h}{\partial t}=-{\nabla}_{\tau}\cdot {J}_V+-{\nabla}_S\cdot {J}_S+ Q, $$

(34)

and the chemical potential becomes

$$ \mu =\frac{1}{\rho}\frac{\delta E}{\delta h}=\frac{1}{\rho}\left({\sigma}_{\alpha \beta}\sqrt{1+{h}_{\tau_1}^2+{h}_{\tau_2}^2}+{\sigma}_{\beta \gamma}-{\sigma}_{\alpha \gamma}+{\sigma}_{\alpha \beta \gamma}\frac{\partial g}{\partial p}\right)\frac{\partial p}{\partial h}-\frac{1}{\rho}{\nabla}_{\tau}\cdot \frac{p{\sigma}_{\alpha \beta}{\nabla}_{\tau} h}{\sqrt{1+{h}_{\tau_1}^2+{h}_{\tau_2}^2}}. $$

(35)

The mass-flux equations remain largely unchanged except for the simplified volume in Eq. 21.