This section presents the methods applied for discretization and numerical solution of fluid–solid and contact interaction problems including thermo-mechanical coupling and reversible phase transitions. The presented parallel computational framework is implemented in the in-house parallel multiphysics research code BACI (Bavarian Advanced Computational Initiative) [38] using the Message Passing Interface (MPI) for distributed-memory parallel programming.

### Spatial discretization via smoothed particle hydrodynamics

For the spatial discretization smoothed particle hydrodynamics (SPH) is used, allowing for a straightforward particle-based evaluation of fluid–solid coupling conditions. In the following, the basics of this method are recapitulated briefly.

#### Approximation of field quantities applying a smoothing kernel

The fundamental concept of SPH is based on the approximation of a field quantity *f* via a smoothing operation and on the discretization of the domain \(\Omega \) with discretization points, so-called particles *j*, each occupying a volume \(V_{j}\). Introducing a smoothing kernel \(W(r,h)\) that fulfills certain consistency properties [36, 39], cf. Remark 5, leads to an approximation of the field quantity *f* based on summation of contributions from all particles *j* in the domain \(\Omega \)

$$\begin{aligned} f(\mathbf {r}) \approx \int _{\Omega } f(\mathbf {r}') W(| \mathbf {r} - \mathbf {r}' |, h) \mathrm{d}{\mathbf {r}'} \approx \sum _{j} V_{j} f(\mathbf {r}_{j}) W(| \mathbf {r} - \mathbf {r}_{j} |, h) \end{aligned}$$

(11)

which includes a smoothing error and a discretization error [40].

### Remark 5

The smoothing kernel \(W(r,h)\) is a monotonically decreasing, smooth function that depends on a distance *r* and a smoothing length *h*. The smoothing length *h* together with a scaling factor \(\kappa \) define the support radius \(r_{c} = \kappa h\) of the smoothing kernel. Compact support, i.e., \(W(r, h) = 0\) for \(r > r_{c}\), as well as positivity, i.e., \(W(r, h) \ge 0\) for \(r \le r_{c}\), are typical properties of standard smoothing kernels \(W(r,h)\). In addition, the normalization property requires that \(\int _{\Omega } W(| \mathbf {r} - \mathbf {r}' |, h) \mathrm{d}{\mathbf {r}'} = 1\). The Dirac delta function property \(\lim _{h \rightarrow 0}{ W(r, h) } = \delta (r)\) ensures an exact representation of a field quantity *f* in the limit \(h \rightarrow 0\).

A straightforward approach in SPH to determine the gradient of a quantity *f* follows directly by differentiation of (11) resulting in

$$\begin{aligned} {\varvec{\nabla }}{f(\mathbf {r})} \approx \int _{\Omega } f(\mathbf {r}') {\varvec{\nabla }}{W(| \mathbf {r} - \mathbf {r}_{j} |, h)}\,\mathrm{d}{\mathbf {r}'} \approx \sum _{j} V_{j} f(\mathbf {r}_{j}) {\varvec{\nabla }}{W(| \mathbf {r} - \mathbf {r}_{j} |, h)} \, . \end{aligned}$$

(12)

Note that this (simple) gradient approximation shows some particular disadvantages. Hence, more advanced approximations for gradients are given in the literature [36] and will also be applied in the following. In sum, the concept of SPH allows to reduce partial differential equations to a system of coupled ordinary differential equations (with as many equations as particles) that is solved in the domain \(\Omega \). Thereby, all field quantities are evaluated at and associated with particle positions, meaning each particle carries its corresponding field quantities. Finally, in a post-processing step a continuous field quantity *f* is recovered from the discrete quantities \(f(\mathbf {r}_{j})\) of particles *j* in the domain \(\Omega \) using the approximation (11) and the commonly known Shepard filter

$$\begin{aligned} \hat{f}(\mathbf {r}) \approx \frac{ \sum _{j} V_{j} f(\mathbf {r}_{j}) W(| \mathbf {r} - \mathbf {r}_{j} |, h) }{ \sum _{j} V_{j} W(| \mathbf {r} - \mathbf {r}_{j} |, h) } \, . \end{aligned}$$

(13)

Note that the denominator typically takes on values close to one inside the fluid domain and is mainly relevant for boundary regions with reduced support due to a lack of neighboring particles.

### Remark 6

In the following, a quantity *f* evaluated for particle *i* at position \(\mathbf {r}_{i}\) is written as \(f_{i} = f(\mathbf {r}_{i})\). The short notation \(W_{ij} = W(r_{ij}, h)\) denotes the smoothing kernel *W* evaluated for particle *i* at position \(\mathbf {r}_{i}\) with neighboring particle *j* at position \(\mathbf {r}_{j}\), where \(r_{ij} = |\mathbf {r}_{ij}| = |\mathbf {r}_{i} - \mathbf {r}_{j}|\) is the absolute distance between particles *i* and *j*. The derivative of the smoothing kernel *W* with respect to the absolute distance \(r_{ij}\) is denoted by \(\partial {W}/\partial {r_{ij}} = \partial {W(r_{ij}, h)}/\partial {r_{ij}}\).

### Remark 7

Herein, a quintic spline smoothing kernel \(W(r, h)\) as defined in [21] with smoothing length *h* and compact support of the smoothing kernel with support radius \(r_{c} = \kappa h\) and scaling factor \(\kappa = 3\) is used.

#### Initial particle spacing

Within this contribution, the domain \(\Omega \) is initially filled with particles located on a regular grid with particle spacing \(\Delta {}x\), thus in the *d*-dimensional space each particle initially occupies an effective volume \(V_{eff}=(\Delta {}x)^{d}\). A particle in the fluid domain \(\Omega ^{f}\) is called a fluid particle *i*, whereas a particle in the solid domain \(\Omega ^{s}_{k}\) of a rigid body *k* is called a rigid particle *r*. It follows, that each rigid body is fully resolved being spatially discretized as clusters of particles. Naturally, the choice of the particle spacing \(\Delta {}x\) influences the accuracy of the interface representation between fluid and solid domain. The mass of a particle is initially assigned using the reference density of the respective phase, i.e., \(\rho ^{f}_{0}\) for the fluid phase and \(\rho ^{s}_{0}\) for the solid phase, and the effective volume \(V_{eff}\).

### Remark 8

Within this work, the smoothing length *h* of the smoothing kernel \(W(r, h)\), cf. Remark 7, is set equal to the initial particle spacing \(\Delta {}x\). Consequently, in a convergence analysis with decreasing particle spacing \(\Delta {}x\) the ratio \({\Delta {}x}/{h}\) remains constant [40].

### Parallelization via spatial decomposition of the domain

For the problems studied herein, an efficient parallel computational framework capable of handling systems constituted of a large number of particles is required. This requires addressing in particular two aspects, namely, an efficient particle neighbor pair detection, and a parallel load distribution strategy while keeping the communication overhead at an acceptable level. In the literature, several approaches for parallel computational frameworks utilizing particle-based methods have been proposed, e.g., [41,42,43,44,45,46,47]. In the present work, a spatial decomposition approach with neighbor pair detection utilizing a combination of cell-linked lists and Verlet-lists based on [42] is applied. The general idea of the spatial decomposition approach is briefly explained in the following, however, for detailed information, the interested reader is referred to the original publication [42]. In addition, the concept is extended herein to consider the motion of rigid bodies spatially discretized as clusters of particles.

The evaluation of particle interactions in SPH requires knowledge of neighboring particles within a geometrically limited interaction distance, i.e., within the support radius \(r_{c}\) of the smoothing kernel. Thus, the computational domain is divided into several cubic cells forming a uniform lattice, while each particle is uniquely assigned to one of those cells according to its current spatial position, cf. Fig. 2. The size of the cells is chosen such that neighboring particles are either located in the same cell or in adjacent cells, i.e., the size of the cells is at least equal to the support radius \(r_{c}\) of the smoothing kernel.

Following a spatial decomposition approach, the cells together with assigned particles are distributed over all involved processors, i.e., forming so-called processor domains. To keep the computational load balanced between all processors and to minimize the communication overhead, cubic processor domains are defined such that each contains (nearly) the same number of particles. The cells occupied by each processor are called owned cells. On each processor the position of particles located in its processor domain, i.e., the position of so-called owned particles, is evolved. This requires the evaluation of interactions of owned particles with their neighboring particles. However, the correct evaluation of particle interactions close to processor domain boundaries requires that each processor has information not only about its owned particles but also about particles in cells adjacent to its processor domain. To this end, each processor is provided full information not only about its own domain but additionally about a layer of ghosted cells (with ghosted particles) around its own domain. Keeping the information about ghosted cells and particles continuously updated requires communication between processors.

### Remark 9

To exemplify the cost of communication overhead, consider a perfectly cubic processor domain occupying \(n_{o}\) owned cells. Consequently, assuming one layer of ghosted cells surrounding the processor domain, a total of \(n_{g} = ( \root 3 \of {n_{o}} + 2 )^{3} - n_{o}\) cells are ghosted. That is, the communication overhead scales with the ratio \({n_{g}}/{n_{o}}\) of ghosted cells \(n_{g}\) to owned cells \(n_{o}\). Furthermore, the (average) number of particles per cell, and, consequently, also the communication overhead, scale with the ratio \({r_{c}}/{\Delta {}x}\) of the support radius \(r_{c}\) and the initial particle spacing \(\Delta {}x\).

As a consequence of the spatial decomposition approach, the affiliated rigid particles *r* of a rigid body *k* might be distributed over several processors, cf. Fig. 2. However, note that the balance of linear and angular momentum, cf. Eqs. (6)–(7), describing the motion of a rigid body *k* are given with respect to the center of mass position \(\mathbf {r}^{s}_{k}\). Thus, the evaluation of mass quantities, i.e., mass \(m_k\), center of mass position \(\mathbf {r}^{s}_{k}\), and mass moment of inertia \(\mathbf {I}_{k}\), as well as the evaluation of resultant force \(\mathbf {f}_{k}\) and torque \(\mathbf {m}_{k}\) acting on a rigid body *k*, requires special communication between all processors hosting rigid particles *r* belonging to rigid body *k* and the single processor owning rigid body *k*.

### Modeling fluid flow using weakly compressible SPH

For modeling fluid flow using SPH, several different formulations each with its own characteristics and benefits can be derived. Here, the instationary Navier–Stokes equations (1) and (2) are discretized by a weakly compressible approach [36, 39, 48]. This section gives a brief overview of this formulation applied already in [18, 49]. For ease of notation, in the following the index \((\cdot )^{f}\) denoting fluid quantities is dropped.

#### Density summation

The density of a particle *i* is determined via summation of the respective smoothing kernel contributions of all neighboring particles *j* within the support radius \(r_{c}\)

$$\begin{aligned} \rho _{i} = m_{i} \sum _{j} W_{ij} \end{aligned}$$

(14)

with mass \(m_{i}\) of particle *i*. This approach is typically denoted as density summation and results in an exact conservation of mass in the fluid domain, which can be shown in a straightforward manner considering the commonly applied normalization of the smoothing kernel to unity. It shall be noted that the density field may alternatively be obtained by discretization and integration of the mass continuity equation (1) [39].

#### Momentum equation

The momentum equation (2) is discretized following [23, 50] including a transport velocity formulation to suppress the problem of tensile instability. It will be briefly recapitulated in the following. The transport velocity formulation relies on a constant background pressure \(p_{b}\) that is applied to all particles and results in a contribution to the particle accelerations for in general disordered particle distributions. However, these additional acceleration contributions vanish for particle distributions fulfilling the partition of unity of the smoothing kernel, thus fostering these desirable configurations. For the sake of brevity, the definition of the modified advection velocity and the additional terms in the momentum equation from the aforementioned transport velocity formulation are not discussed in the following and the reader is referred to the original publication [50]. Altogether, the acceleration \(\mathbf {a}_{i} = \mathrm{d}{\mathbf {u}_{i}}/\mathrm{d}{t}\) of a particle *i* results from summation of all acceleration contributions due to interaction with neighboring particles *j* and a body force as

$$\begin{aligned} \mathbf {a}_{i} = \frac{1}{m_{i}} \sum _{j} (V_{i}^{2}+V_{j}^{2}) \left[ - \tilde{p}_{ij} \frac{{\partial }W}{{\partial }r_{ij}} \mathbf {e}_{ij} + \tilde{\eta }_{ij} \frac{\mathbf {u}_{ij}}{r_{ij}} \frac{{\partial }W}{{\partial }r_{ij}} \right] + \mathbf {b}_{i} \, , \end{aligned}$$

(15)

with volume \(V_{i} = m_{i}/\rho _{i}\) of particle *i*, unit vector \(\mathbf {e}_{ij} = {\mathbf {r}_{i} - \mathbf {r}_{j}}/{|\mathbf {r}_{i} - \mathbf {r}_{j}|} = {\mathbf {r}_{ij}}/{r_{ij}}\), relative velocity \(\mathbf {u}_{ij} = \mathbf {u}_{i}-\mathbf {u}_{j}\), and density-weighted inter-particle averaged pressure and inter-particle averaged viscosity

$$\begin{aligned} \tilde{p}_{ij} = \frac{\rho _{j}p_{i}+\rho _{i}p_{j}}{\rho _{i} + \rho _{j}} {{\quad }\text {and}\quad }\tilde{\eta }_{ij} = \frac{2\eta _{i}\eta _{j}}{\eta _{i}+\eta _{j}} \, . \end{aligned}$$

(16)

In the following, the acceleration contribution of a neighboring particle *j* to particle *i* is, for ease of notation, denoted as \(\mathbf {a}_{ij}\), where \(\mathbf {a}_{i} = \sum _{j} \mathbf {a}_{ij} + \mathbf {b}_{i}\). The above given momentum equation (15) exactly conserves linear momentum due to pairwise anti-symmetric particle forces

$$\begin{aligned} m_{i} \mathbf {a}_{ij} = - m_{j} \mathbf {a}_{ji} \, , \end{aligned}$$

(17)

which follows from the property \(\partial {W}/\partial {r_{ij}} = \partial {W}/\partial {r_{ji}}\) of the smoothing kernel.

#### Equation of state

Following a weakly compressible approach, the density \(\rho _{i}\) and pressure \(p_{i}\) of a particle *i* are linked via the equation of state

$$\begin{aligned} p_{i}(\rho _{i}) = c^{2} (\rho _{i} - \rho _{0}) = p_{0} \left( \frac{\rho _{i}}{\rho _{0}} - 1\right) \end{aligned}$$

(18)

with reference density \(\rho _{0}\), reference pressure \(p_{0} = \rho _{0} c^{2}\) and artificial speed of sound *c*. Note that this commonly applied approach can only capture deviations from the reference pressure, i.e., \(p_{i}(\rho _{0}) = 0\), and not the total pressure. To limit density fluctuations to an acceptable level, while still avoiding too severe time step restrictions, cf. Eq. (41), strategies are discussed in [21] how to choose a reasonable value for the artificial speed of sound *c*. Accordingly, in this work the artificial speed of sound *c* is set allowing an average density variation of approximately \(1\%\).

#### Boundary and coupling conditions

Herein, both rigid wall boundary conditions as well as rigid body coupling conditions, are modeled following [23]. In the former case, at least \(q = \mathrm {floor}({r_{c}}/{\Delta {}x})\) layers of boundary particles *b* are placed parallel to the fluid boundary \(\Gamma ^{f}_{D}\) with a distance of \({\Delta {}x}/{2}\) outside of the fluid domain \(\Omega ^{f}\) in order to maintain full support of the smoothing kernel. In the latter case, rigid particles *r* of rigid bodies *k* are considered, while naturally describing the fluid–solid interface \(\Gamma ^{fs}\). In both cases, a boundary particle *b* or a rigid particle *r* contribute to the density summation (14) and to the momentum equation (15) evaluated for a fluid particle *i* considered as neighboring particle *j*. The respective quantities of boundary particles *b* respectively rigid particles *r* are extrapolated from the fluid field based on a local force balance as described in [23]. Consequently, striving for conservation of linear momentum, cf. Eq. (17), the force acting on a rigid particle *r* stemming from interaction with fluid particle *i*, cf. Eq. (15), is given as

$$\begin{aligned} \mathbf {f}_{ri} = - m_{i} \mathbf {a}_{ir} \, . \end{aligned}$$

(19)

### Remark 10

The \(\mathrm {floor}\) operator is defined by \(\mathrm {floor}(x) := \max \, \{ k \in \mathbb {Z} \mid k \le x\}\) and returns the largest integer that is less than or equal to its argument *x*.

### Modeling the motion of rigid bodies discretized by particles

Within this formulation, each rigid body *k* is composed of several rigid particles *r* that are fixed relative to a rigid body frame, i.e., there is no relative motion among rigid particles of a rigid body. Thus, the rigid particles of a rigid body are not evolved in time individually, but follow the motion of the rigid body described by the balance of linear and angular momentum, cf. Eqs. (6)–(7). As a consequence of the spatial decomposition approach, special communication between all processors hosting rigid particles *r* of a rigid body *k* in terms of the evaluation of mass quantities, or resultant forces and torques, is required. For ease of notation, in the following the index \((\cdot )^{s}\) denoting solid quantities is dropped.

#### Orientation of rigid bodies

The orientation \(\varvec{\psi }_{k}\) of a rigid body *k*, described by one respectively three degrees of freedom in two- and three-dimensional space, is previously introduced without explicitly defining a specific parameterization of the underlying rotation, e.g., via Euler angles or Rodriguez parameters. Moreover, as stated in Remark 2, explicit evolution of the orientation \(\varvec{\psi }_{k}\) requires special Lie group time integrators. A straightforward approach to overcome aforementioned issues is to describe the orientation of a rigid body via quaternion algebra, cf. Remark 12. Consequently, in the following it is assumed that at all times the orientation \(\varvec{\psi }_{k}\) of a rigid body *k* can be uniquely described by a unit quaternion \(\mathbf {q}_{k}\), cf. Fig. 3. Once a local rigid body frame is defined, this allows to transform the relative position of rigid particles \(\mathbf {r}_{rk}\), cf. Remark 11, from that rigid body frame to the reference frame, e.g., a global cartesian system.

### Remark 11

Note that the relative position of rigid particles \(\mathbf {r}_{rk}\) expressed in the rigid body frame is, in general, a known (and constant) quantity, that only needs to be updated in case the center of mass position \(\mathbf {r}_{k}\) changes, i.e., due to phase transitions.

### Remark 12

For the sake of brevity, the principals of quaternion algebra are not delineated herein. It remains the definition of operator \(\circ \) denoting quaternion multiplication as used in the following.

#### Parallel evaluation of mass-related quantities

In a first step, on each processor *p* the processor-wise mass \({}_{p}{m}_{k}\) and center of mass position \({}_{p}{\mathbf {r}}_{k}\) of a rigid body *k* are computed as

$$\begin{aligned} {}_{p}{m}_{k} = \sum _{r} m_{r} {{\quad }\text {and}\quad }{}_{p}{\mathbf {r}}_{k} = \frac{\sum _{r} m_{r} \mathbf {r}_{r}}{\sum _{r} m_{r}} \end{aligned}$$

(20)

considering the mass \(m_{r}\) and position \(\mathbf {r}_{r}\) of all affiliated rigid particles *r* being located in the computational domain of processor *p*, cf. Fig. 4 for an illustration. Accordingly, the processor-wise mass moment of inertia \({}_{p}{\mathbf {I}}_{k}\) of a rigid body *k* follows componentwise (in index notation) as

$$\begin{aligned} {}_{p}{I}_{k,ij} = \sum _{r} \left[ I_{r} \, \delta _{ij} + \left[ \sum _{q} ( {}_{p}{r}_{k,q} - r_{r,q} )^{2} \delta _{ij} - ( {}_{p}{r}_{k,i} - r_{r,i} ) ( {}_{p}{r}_{k,j} - r_{r,j} ) \right] m_{r} \right] \end{aligned}$$

(21)

with mass \(m_{r}\) and mass moment of inertia \(I_{r}\) of a rigid particle *r*, cf. Remark 13, and Kronecker delta \(\delta _{ij}\), cf. Remark 14. The computed processor-wise quantities, i.e., mass \({}_{p}{m}_{k}\), center of mass position \({}_{p}{\mathbf {r}}_{k}\), and mass moment of inertia \({}_{p}{\mathbf {I}}_{k}\), are communicated to the owning processor of rigid body *k*. In a second step, on the owning processor the total mass \(m_{k}\) and center of mass position \(\mathbf {r}_{k}\) of rigid body *k* are computed over all processors *p* as

$$\begin{aligned} m_{k} = \sum _{p} {}_{p}{m}_{k} {{\quad }\text {and}\quad }\mathbf {r}_{k} = \frac{\sum _{p} {}_{p}{m}_{k} {}_{p}{\mathbf {r}}_{k}}{\sum _{p} {}_{p}{m}_{k}} \end{aligned}$$

(22)

making use of the received processor-wise quantities. Similar to (21) the mass moment of inertia \(\mathbf {I}_{k}\) of rigid body *k* follows componentwise (in index notation) as

$$\begin{aligned} I_{k,ij} = \sum _{p} \left[ {}_{p}{I}_{k,ij} + \left[ \sum _{q} ( r_{k,q} - {}_{p}{r}_{k,q} )^{2} \delta _{ij} - ( r_{k,i} - {}_{p}{r}_{k,i} ) ( r_{k,j} - {}_{p}{r}_{k,j} ) \right] {}_{p}{m}_{k} \right] \end{aligned}$$

(23)

again considering the received processor-wise quantities. Finally, the determined global quantities, i.e., mass \(m_{k}\), center of mass position \(\mathbf {r}_{k}\), and mass moment of inertia \(\mathbf {I}_{k}\), are communicated from the owning processor to all hosting processors of rigid body *k*.

### Remark 13

The mass moment of inertia \(I_{r}\) of a rigid particle *r* with mass \(m_{r}\) is computed based on the effective volume \(V_{eff}=(\Delta {}x)^{d}\) with initial particle spacing \(\Delta {}x\). In two-dimensional space (\(d=2\)) assuming circular disk-shaped particles results in \(I_{r} = 0.5 m_{r} r_{eff}\) with effective radius \(r_{eff} = {\Delta {}x}/{\sqrt{\pi }}\). Accordingly, in three-dimensional space (\(d=3\)) assuming spherical-shaped particles results in \(I_{r} = 0.4 m_{r} r_{eff}\) with effective radius \(r_{eff} = \root 3 \of {{0.75}/{\pi }} \Delta {}x\).

### Remark 14

The Kronecker delta \(\delta _{ij}\) used in Eqs. (21) and (23) to compute the mass moments of inertia is defined by \(\delta _{ij} = {{\left\{ \begin{array}{ll} 1 \quad \text {if}\quad i=j \, , \\ 0 \quad \text {otherwise.}\quad \end{array}\right. }}\)

### Remark 15

The computation of the mass moment of inertia, cf. Eqs. (21) respectively (23), is based on the Huygens-Steiner theorem, also called parallel axis theorem.

#### Parallel evaluation of resultant force and torque

To begin with, the resultant coupling and contact force acting on a rigid particle *r* of rigid body *k* is given as

$$\begin{aligned} \mathbf {f}_{r} = \sum _{i} \mathbf {f}_{ri} + \sum _{\hat{k}} \sum _{\hat{r}} \mathbf {f}_{r\hat{r}} \end{aligned}$$

(24)

with coupling forces \(\mathbf {f}_{ri}\) stemming from interaction with neighboring fluid particles *i*, cf. Eq. (19), and contact forces \(\mathbf {f}_{r\hat{r}}\) stemming from interaction with rigid particles \(\hat{r}\) of contacting rigid bodies \(\hat{k}\), cf. Eq. (27). Similar to the computation of mass-related quantities as described previously, the resultant force \(\mathbf {f}_{k}\) and torque \(\mathbf {m}_{k}\) acting on a rigid body *k* are determined considering the parallel distribution of the affiliated rigid particles *r* on hosting processors *p*, cf. Fig. 4. Thus, in a first step the processor-wise resultant force \({}_{p}{\mathbf {f}}_{k}\) and torque \({}_{p}{\mathbf {m}}_{k}\) acting on rigid body *k* are computed as

$$\begin{aligned} {}_{p}{\mathbf {f}}_{k} = \sum _{r} \mathbf {f}_{r} {{\quad }\text {and}\quad }{}_{p}{\mathbf {m}}_{k} = \sum _{r} \mathbf {r}_{rk} \times \mathbf {f}_{r} \end{aligned}$$

(25)

with \(\mathbf {r}_{rk} = \mathbf {r}_{r} - \mathbf {r}_{k}\) while considering the resultant forces \(\mathbf {f}_{r}\) acting on all rigid particles *r* being located in the computational domain of processor *p*. For correct computation of the processor-wise resultant torque \({}_{p}{\mathbf {m}}_{k}\) the knowledge of the global center of mass position \(\mathbf {r}_{k}\) is required on all processors. Finally, the computed processor-wise forces \({}_{p}{\mathbf {f}}_{k}\) and torques \({}_{p}{\mathbf {m}}_{k}\) are communicated to the owning processor of rigid body *k* and summed up to the global resultant force and torque acting on rigid body *k*

$$\begin{aligned} \mathbf {f}_{k} = \sum _{p} {}_{p}{\mathbf {f}}_{k} {{\quad }\text {and}\quad }\mathbf {m}_{k} = \sum _{p} {}_{p}{\mathbf {m}}_{k} \, . \end{aligned}$$

(26)

### Remark 16

In the case of a computation on a single processor, the evaluation of mass \(m_{k}\), center of mass position \(\mathbf {r}_{k}\), and mass moment of inertia \(\mathbf {I}_{k}\) of a rigid body *k* follow directly from Eqs. (20) and (21), while the resultant force \(\mathbf {f}_{k}\) and torque \(\mathbf {m}_{k}\) directly follow from Eq. (25), in each case without the need for special communication.

#### Contact evaluation between neighboring rigid bodies

For the modeling of frictionless contact between neighboring rigid bodies *k* and \(\hat{k}\), a contact normal force law based on a spring-dashpot model, similar to [29], is employed. The contact force is acting between pairs of neighboring rigid particles *r* and \(\hat{r}\) of contacting rigid bodies, i.e., for distances \(r_{r\hat{r}} < \Delta {}x\) with \(r_{r\hat{r}} = |\mathbf {r}_{r\hat{r}}| = |\mathbf {r}_{r} - \mathbf {r}_{\hat{r}}|\). Accordingly, the contact force acting on a particle *r* of rigid body *k* due to contact with a particle \(\hat{r}\) of neighboring rigid body \(\hat{k}\) is given as

$$\begin{aligned} \mathbf {f}_{r\hat{r}} = {\left\{ \begin{array}{ll} - \Big [ \min \Big (0, k_{c} ( r_{r\hat{r}} - \Delta {}x ) + d_{c} ( \mathbf {e}_{r\hat{r}} \cdot \mathbf {u}_{r\hat{r}} ) \Big ) \Big ] \, \mathbf {e}_{r\hat{r}} &{} \quad \text {if}\quad r_{r\hat{r}} < \Delta {}x \, , \\ 0 &{} \quad \text {otherwise,}\quad \end{array}\right. } \end{aligned}$$

(27)

with unit vector \(\mathbf {e}_{r\hat{r}} = {\mathbf {r}_{r\hat{r}}}/{r_{r\hat{r}}}\), stiffness constant \(k_{c}\), and damping constant \(d_{c}\). The \(\min \) operator in Eq. (27) ensures that only repulsive forces between the rigid particles are considered, also known as tension cut-off.

### Remark 17

Contact between a rigid body *k* and a rigid wall is modeled similar to Eq. (27) considering rigid particles *r* of a rigid body *k* and boundary particles *b* of a discretized rigid wall.

### Remark 18

The applied contact evaluation between rigid bodies is for simplicity based on a contact normal force law evaluated between rigid particles while neglecting frictional effects. Generally, following a macroscopic approach of contact mechanics with non-penetration constraint, the normal distance between the contacting bodies, typically determined via closest point projections, is the contact-relevant kinematic quantity. Accordingly, the concept applied in this work, can be interpreted as a microscale approach based on a repulsive/steric interaction potential [51] defined between pairs of rigid particles of contacting rigid bodies. In the current work, this approach has been chosen for reasons of simplicity and numerical robustness. An extension to a macroscale approach, i.e., a normal distance-based contact interaction [12, 52, 53], is possible in a straightforward manner. In addition, also a momentum-based energy tracking method [54] was recently applied for collision modeling of fully resolved rigid bodies [55, 56].

### Discretization of the heat equation using SPH

Thermal conduction in the combined fluid and solid domain governed by the heat equation (8) is discretized using smoothed particle hydrodynamics following a formulation proposed by Cleary and Monaghan [57]

$$\begin{aligned} c_{p,a} \frac{\mathrm{d}T_{a}}{\mathrm{d}t} = \frac{1}{\rho _{a}} \sum _{b} V_{b} \frac{4\kappa _{a} \kappa _{b}}{\kappa _{a} + \kappa _{b}} \frac{T_{ab}}{r_{ab}} \frac{{\partial }W}{{\partial }r_{ab}} \end{aligned}$$

(28)

with volume \(V_{b} = {m_{b}}/{\rho _{b}}\) of particle *b* and temperature difference \(T_{ab} = T_{a} - T_{b}\) between particle *a* and particle *b*. The discretization of the conductive term is especially suited for problems involving a different thermal conductivity among the fields [57]. In the equation above, the index \((\cdot )^{\phi }\) with \(\phi \in \{f,s\}\) for fluid and solid field is dropped for ease of notation. Accordingly, the particles *a* and *b* may denote fluid particles *i* as well as rigid particles *r*, respectively.

### Modeling thermally driven reversible phase transitions

Due to the Lagrangian nature of SPH, each (material) particle carries its phase information. This allows for direct evaluation of the discretized heat equation (28) for fluid and rigid particles with corresponding phase-specific parameters of the particle *a* itself and of neighboring particles *b*. Phase transitions in the form of melting of a rigid body occurs, in case the temperature \(T_{r}\) of a rigid particle *r* exceeds the transition temperature \(T_{t}\). The former rigid particle *r* changes phase to become a fluid particle *i*. Conversely, phase transitions in form of solidification occurs, in case the temperature \(T_{i}\) of a fluid particle *i* falls below the transition temperature \(T_{t}\) and the former fluid particle *i* becomes a rigid particle *r*.

Consequently, each time a rigid body *k* is subject to phase transition, its mass \(m_{k}\), center of mass position \(\mathbf {r}_{k}\), and mass moment of inertia \(\mathbf {I}_{k}\) are updated. In addition, the velocity \(\mathbf {u}_{k}\) after phase transition is determined based on quantities prior to phase transition indicated by index \((\cdot )^{\prime }\) as

$$\begin{aligned} \mathbf {u}_{k} = \mathbf {u}_{k}^{\prime } + \varvec{\omega }_{k} \times ( \mathbf {r}_{rk} - \mathbf {r}_{rk}^{\prime }) \end{aligned}$$

(29)

following rigid body motion with (unchanged) angular velocity \(\varvec{\omega }_{k}\).

### Time integration following a velocity-Verlet scheme

The discretized fluid and solid field are both integrated in time applying an explicit velocity-Verlet time integration scheme in kick-drift-kick form, also denoted as leapfrog scheme, that is of second order accuracy and reversible in time when dissipative effects are absent [36]. Again, for ease of notation, in the following the indices \((\cdot )^{f}\) and \((\cdot )^{s}\) denoting fluid respectively solid quantities are dropped. Altogether, for the fluid field the positions \(\mathbf {r}_{i}\) of fluid particles *i* are evolved in time, while for the solid field the center of mass positions \(\mathbf {r}_{k}\) and the orientations \(\varvec{\psi }_{k}\) of all rigid bodies *k* are evolved in time. However, the positions \(\mathbf {r}_{r}\) of rigid particles *r* are not evolved in time but directly follow the motion of corresponding affiliated rigid bodies *k*.

In a first kick-step, the accelerations \(\mathbf {a}_{i}^{n} = (\mathrm{d}{\mathbf {u}_{i}}/\mathrm{d}{t})^{n}\), as determined in the previous time step *n*, are used to compute the intermediate velocities

$$\begin{aligned} \mathbf {u}_{i}^{n+1/2} = \mathbf {u}_{i}^{n} + \frac{\Delta {}t}{2} \, \mathbf {a}_{i}^{n} \end{aligned}$$

(30)

of fluid particles *i*, where \(\Delta {}t\) is the time step size. Similar, for rigid bodies *k* the linear and angular accelerations \(\mathbf {a}_{k}^{n} = (\mathrm{d}^{2}{\mathbf {r}_{k}}/\mathrm{d}{t}^{2})^{n}\) respectively \(\varvec{\alpha }_{k}^{n} = (\mathrm{d}{\varvec{\omega }_{k}}/\mathrm{d}{t})^{n}\) are used to compute the intermediate linear and angular velocities

$$\begin{aligned} \mathbf {u}_{k}^{n+1/2} = \mathbf {u}_{k}^{n} + \frac{\Delta {}t}{2} \, \mathbf {a}_{k}^{n} {{\quad }\text {and}\quad }\varvec{\omega }_{k}^{n+1/2} = \varvec{\omega }_{k}^{n} + \frac{\Delta {}t}{2} \, \varvec{\alpha }_{k}^{n} \, . \end{aligned}$$

(31)

In a drift-step, the positions (and orientations) of fluid particles *i* and rigid bodies *k* are updated to time step \(n+1\) using the intermediate velocities. Accordingly, the positions of fluid particles *i* follow as

$$\begin{aligned} \mathbf {r}_{i}^{n+1} = \mathbf {r}_{i}^{n} + \Delta {}t \, \mathbf {u}_{i}^{n+1/2} \end{aligned}$$

(32)

and the center of mass positions of rigid bodies *k* as

$$\begin{aligned} \mathbf {r}_{k}^{n+1} = \mathbf {r}_{k}^{n} + \Delta {}t \, \mathbf {u}_{k}^{n+1/2} \, . \end{aligned}$$

(33)

The orientations of rigid bodies *k* are updated making use of quaternion algebra. First, the angular orientation increments from time step *n* to time step \(n+1\) are determined using the intermediate angular velocities of rigid bodies *k* following

$$\begin{aligned} \varvec{\phi }_{k}^{n,n+1} = \Delta {}t \, \varvec{\omega }_{k}^{n+1/2} \, . \end{aligned}$$

(34)

Next, the angular orientation increments are described by so-called transition quaternions \(\mathbf {q}_{k}^{n,n+1}\). Finally, quaternion multiplication, cf. Remark 12, gives the updated orientations of rigid bodies *k* at time step \(n+1\)

$$\begin{aligned} \mathbf {q}_{k}^{n+1} = \mathbf {q}_{k}^{n,n+1} \circ \mathbf {q}_{k}^{n} \, . \end{aligned}$$

(35)

Once the updated orientations (and thus also the updated rigid body frames) are known, the relative positions of rigid particles \(\mathbf {r}_{rk}^{n+1}\) can be transformed from the rigid body frame to the reference frame. The velocities and the positions of rigid particles *r* are updated, considering the underlying rigid body motion of the corresponding rigid bodies *k*, in consistency with the applied time integration scheme following

$$\begin{aligned} \mathbf {u}_{r}^{n+1/2} = \mathbf {u}_{k}^{n+1/2} + \varvec{\omega }_{k}^{n+1/2} \times \mathbf {r}_{rk}^{n+1} {{\quad }\text {and}\quad }\mathbf {r}_{r}^{n+1} = \mathbf {r}_{k}^{n+1} + \mathbf {r}_{rk}^{n+1} \, . \end{aligned}$$

(36)

Using the positions \(\mathbf {r}_{a}^{n+1}\) and the intermediate velocities \(\mathbf {u}_{a}^{n+1/2}\) of fluid and rigid particles \(a \in \{i,r\}\), the densities \(\rho _{i}^{n+1}\) of fluid particles *i* are computed via Eq. (14). The densities \(\rho _{r}\) of rigid particles *r* are not evolved and remain constant. The temperature rates \((\mathrm{d}{T_{a}}/\mathrm{d}{t})^{n+1}\) of fluid and rigid particles *a* are then updated on the basis of Eq. (28) with the temperatures \(T_{a}^{n}\) as well as the positions \(\mathbf {r}_{a}^{n+1}\) and densities \(\rho _{a}^{n+1}\). Finally, the temperatures of fluid and rigid particles *a* are computed as

$$\begin{aligned} T_{a}^{n+1} = T_{a}^{n} + \Delta {}t \left( \frac{\mathrm{d}T_{a}}{\mathrm{d}t}\right) ^{n+1} \, . \end{aligned}$$

(37)

The accelerations \(\mathbf {a}_{i}^{n+1}\) of fluid particles *i*, cf. Eq. (15), and the forces \(\mathbf {f}_{r}^{n+1}\) acting on rigid particles *r*, cf. Eq. (24), are concurrently computed using the positions \(\mathbf {r}_{a}^{n+1}\), the intermediate velocities \(\mathbf {u}_{a}^{n+1/2}\), and the densities \(\rho _{a}^{n+1}\) of fluid and rigid particles *a*. Consequently, the resultant forces \(\mathbf {f}_{k}^{n+1}\) and torques \(\mathbf {m}_{k}^{n+1}\) acting on rigid bodies *k* together with mass-related quantities give the linear and angular accelerations \(\mathbf {a}_{k}^{n+1}\) respectively \({\varvec{\alpha }}_{k}^{n+1}\), cf. Eqs. (6) and (7). In a final kick-step, the velocities of fluid particles *i* at time step \(n+1\) are computed as

$$\begin{aligned} \mathbf {u}_{i}^{n+1} = \mathbf {u}_{i}^{n+1/2} + \frac{\Delta {}t}{2} \, \mathbf {a}_{i}^{n+1} \, , \end{aligned}$$

(38)

while the linear and angular velocities of rigid bodies *k* are

$$\begin{aligned} \mathbf {u}_{k}^{n+1} = \mathbf {u}_{k}^{n+1/2} + \frac{\Delta {}t}{2} \, \mathbf {a}_{k}^{n+1} {{\quad }\text {and}\quad }\varvec{\omega }_{k}^{n+1} = \varvec{\omega }_{k}^{n+1/2} + \frac{\Delta {}t}{2} \, \varvec{\alpha }_{k}^{n+1} \, . \end{aligned}$$

(39)

Accordingly, the velocities of rigid particles *r* are determined following the motion of the corresponding rigid bodies *k* to

$$\begin{aligned} \mathbf {u}_{r}^{n+1} = \mathbf {u}_{k}^{n+1} + \varvec{\omega }_{k}^{n+1} \times \mathbf {r}_{rk}^{n+1} \, . \end{aligned}$$

(40)

To maintain stability of the time integration scheme, the time step size \(\Delta {}t\) is restricted by the Courant–Friedrichs–Lewy (CFL) condition, the viscous condition, the body force condition, the contact condition, and the conductivity condition, refer to [21, 50, 58, 59] for more details,

$$\begin{aligned} \Delta {}t \le \min \left\{ 0.25\frac{h}{c+|\mathbf {u}_{max}|}, 0.125\frac{h^{2}}{\nu }, 0.25\sqrt{\frac{h}{|\mathbf {b}_{max}|}}, 0.22 \sqrt{\frac{m_{r}}{k_{c}}}, 0.1\frac{\rho c_{p} h^{2}}{\kappa } \right\} \, , \end{aligned}$$

(41)

with maximum fluid velocity \(\mathbf {u}_{max}\) and maximum body force \(\mathbf {b}_{max}\).