# A Backwards-Tracking Lagrangian-Eulerian Method for Viscoelastic Two-Fluid Flows
## 3 Numerical Method
The gradient of \(\hat{\phi}\) follows from (10) and (11), as  
\[\frac{\partial\hat{\phi}}{\partial x}=\sum_{i=0}^{1}\sum_{j=0}^{1}\sum_{k=0}^{ 1}\left(\frac{\partial c_{x}^{i}}{\partial x}\right)c_{y}^{j}c_{z}^{k}\phi_{ ijk}, \tag{12}\]  
\[\frac{\partial\hat{\phi}}{\partial y}=\sum_{i=0}^{1}\sum_{j=0}^{1}\sum_{k=0}^{ 1}c_{x}^{i}\left(\frac{\partial c_{y}^{j}}{\partial y}\right)c_{z}^{k}\phi_{ ijk}, \tag{13}\]  
Figure 2: Schematic description of the steps that are involved in the backwards-tracking algorithm. \[\frac{\partial\hat{\phi}}{\partial z}=\sum_{i=0}^{1}\sum_{j=0}^{1}\sum_{k=0}^{1}c _{x}^{i}c_{y}^{j}\left(\frac{\partial c_{x}^{k}}{\partial z}\right)\phi_{ijk}, \tag{14}\]  
where the derivatives of the coefficients read  
\[\frac{\partial c_{l}^{i}}{\partial x_{l}}=\mp\frac{1}{\Delta x_{l}},\quad i=0, 1,\quad l=x,y,z. \tag{15}\]  
The corresponding formulas for bilinear interpolation in two dimensions are obtained by letting the coefficient \(c_{z}^{k}=1\) and, thus, \(\partial c_{z}^{k}/\partial z=0\), and skipping the summation over \(k\). When interpolating to a Lagrangian node near fluid grid refinements the smallest local cell size is used in order to form the interpolation box. Furthermore, not all corners of the interpolation box coincide with a cell center. The velocities at such corners are obtained through least squares interpolation, by fitting a first order polynomial from the centers of the cells that intersect the interpolation box. The interpolation box is visualized in Figure 3.  
The volume of fluid (VOF) method is used to model the presence of a viscoelastic fluid phase and a Newtonian phase. A color function \(\xi\), is then defined, such that  
\[\xi=\left\{ \begin{matrix}1&\text{In the viscoelastic phase}\\ 0&\text{In the Newtonian phase}\end{matrix} \right\}. \tag{16}\]  
The discrete counterpart of \(\xi\) is the fluid volume fraction \(\alpha\in[0,1]\), which is the local volume average of \(\xi\) in an Eulerian cell. The transport of \(\alpha\) is described by the convection equation [34]  
\[\frac{\partial\alpha}{\partial t}+\mathbf{u}\cdot\
abla\alpha=0. \tag{17}\]  
By definition, \(\alpha\) is the local volume fraction of the viscoelastic phase in a control volume. Hence, if \(\alpha=1\), the control volume is filled with the viscoelastic fluid and if \(\alpha=0\) with the Newtonian fluid. If \(\alpha\in(0,1)\), this is interpreted as that the control volume intersects the interface between the fluid phases. The transport Equation (17) is discretized with the finite volume method on the Eulerian octree grid. In order to minimize the numerical diffusion of \(\alpha\) and, thus, avoid smearing the fluid interface, the convection term in (17) is discretized with the compact CICSAM scheme [35]. A single set of the Equations (1)-(3) is solved for the whole computational domain. Fluid properties are locally averaged as  
\[\phi=\alpha\phi_{1}+(1-\alpha)\phi_{2}, \tag{18}\]  
where \(\phi_{v}\) and \(\phi_{N}\) are the properties of the viscoelastic and the Newtonian phase, respectively. The averaging is applied for \(\rho\), \(\mu\), \(\eta\), and \(\lambda\), as well as for \(\tau\) when calculating the  
Figure 3: Basis for interpolating properties stored at the fluid grid to Lagrangian nodes in areas with uniform grid spacing (**a**) and near refinements (**b**). contribution to the momentum equation. When \(\alpha\) is needed at a Lagrangian node, it is interpolated with the same method as used for velocity. Special care for the viscoelastic stress in the interface region \(\alpha\in(0,1)\) is necessary due to the non-sharp interface nature of the VOF method. A brief motivation for this follows. In many examples of viscoelastic free surface flow, the viscosity of the Newtonian fluid may very well be on the order of \(10^{-5}\) of that of the viscoelastic phase. Hence, the average velocity gradient in the Newtonian phase may be much larger than in the viscoelastic phase.