## 4 Numerical Solution to the Viscous Free Interface Model
### Discretization by Moving the Interface  
The first numerical method involves rewriting (3), (4), (5) for a normalized coordinate \(0\leq Y\leq 1\). We perform the change of coordinates  
\[t=\tau,\qquad Z=b(\tau)+(h-b(\tau))Y, \tag{19}\]  
that leads to the differential relations \(\partial_{\tau}=\partial_{t}+\dot{b}(\tau)(1-Y)\partial_{Z}\) and \(\partial_{Y}=(h-b(\tau))\partial_{Z}\). Here, \(\partial_{t}\) and \(\partial_{\tau}\) denote the differentiation with respect to time at constant \(Z\) and \(Y\), respectively. The change of coordinates (19), and hence the discretization method presented in this subsection, is appropriate as long as there is a flowing layer so that \(h-b(\tau)>0\). Another discretization method dealing with the stopping phase when \(b(t)\) reaches the total height \(h\) is presented in Section 4.2. The discretization method considered in this subsection has the advantage of tracking explicitly the position of the static/flowing interface, whereas the method of Section 4.2 requires post-processing to evaluate the interface position. Using the change of coordinates (19), Equation (3) becomes  
\[\partial_{\tau}U-b\frac{1-Y}{h-b}\partial_{Y}U+S-\frac{1}{(h-b)^{2}}\partial_ {Y}(v\partial_{Y}U)=0\quad\text{ for all }Y\in(0,1), \tag{20}\]  
and the boundary conditions (4) become  
\[U=0\quad\text{ at }Y=0, \tag{21a}\] \[v\partial_{Y}U=0\quad\text{ at }Y=0,\] (21b) \[v\partial_{Y}U=0\quad\text{ at }Y=1. \tag{21c}\]  
We split the space domain \((0,1)\) into \(n_{Y}\) cells of length \(\Delta Y\) with \(n_{Y}\Delta Y=1\) and denote the center of the cells by \(Y_{j}=(j-1/2)\Delta Y\), for all \(j=1\ldots n_{Y}\). For \(n\geq 0\), the discrete times \(t^{n}\) are related by \(t^{n+1}=t^{n}+\Delta t^{n}\), where \(\Delta t^{n}\) is the time step (chosen according to the CFL condition (25) below) and \(t^{0}=0\). We write a finite difference scheme for the discrete unknowns \(U_{j}^{n}\simeq U(t^{n},Y_{j})\) and \(b^{n}\simeq b(t^{n})\), for all \(j=1\ldots n_{Y}\) and all \(n\geq 1\), using the initial conditions \(U^{0}\) (and \(b^{0}\)) to initialize the scheme. For all \(n\geq 0\), given \((U_{j}^{n})_{1\leq j\leq n_{Y}}\) and \(b^{n}\), the equations to compute \((U_{j}^{n+1})_{1\leq j\leq n_{Y}}\) and \(b^{n+1}\) are  
\[\frac{U_{j}^{n+1}-U_{j}^{n}}{\Delta t^{n}}-\frac{(1-Y_{j})}{h-b^{n}}a_{j}^{n+ \frac{1}{2}}+S(t^{n},Y_{j})-\frac{v_{j+1/2}^{n}(U_{j+1}^{n+1}-U_{j}^{n+1})-v_{ j-1/2}^{n}(U_{j}^{n+1}-U_{j-1}^{n+1})}{(h-b^{n})^{2}\Delta Y^{2}}=0, \tag{22}\]  
for all \(j=1\ldots n_{Y}\), with  
\[a_{j}^{n+\frac{1}{2}}= \begin{cases}b^{n+\frac{1}{2}}\frac{U_{j}^{n}-U_{j-1}^{ n}}{\Delta Y}&\text{ if }b^{n+\frac{1}{2}}\leq 0,\\ \dot{b}^{n+\frac{1}{2}}\frac{U_{j+1}^{n}-U_{j}^{n}}{\Delta Y}&\text{ if }\dot{b}^{n+\frac{1}{2}}\geq 0, \end{cases} \quad\text{ with }\dot{b}^{n+\frac{1}{2}}=\frac{b^{n+1}-b^{n}}{\Delta t^{n}}, \tag{23}\]together with the boundary conditions  
\[U_{0}^{n+1} =-U_{1}^{n+1}, \tag{24a}\] \[U_{0}^{n+1} =U_{1}^{n+1},\] (24b) \[U_{n_{Y}+1}^{n+1} =U_{n_{Y}}^{n+1}. \tag{24c}\]  
In Equation (22), the values \(v_{j+1/2}^{n}\) are assumed to be known, and they are computed as interface values from a given variable viscosity \(\
u(t,Z)\). Equations (24a) and (24c) are used to provide the ghost values \(U_{0}^{n+1}\) and \(U_{n_{Y}+1}^{n+1}\) needed in Equation (22) for \(j=1\) and \(j=n_{Y}\), respectively, whereas Equation (24b) is used to determine \(b^{n+1}\) as described below. We observe that in Equation (22), the diffusive term is treated implicitly in time, and the first-order derivative of \(U\) is treated explicitly using upwinding. As a result, we impose the CFL condition  
\[\frac{\Delta t^{n}|b^{n+\frac{1}{2}}|}{h-b^{n}}\leq\Delta Y. \tag{25}\]  
This CFL condition is evaluated approximately using the value \(b^{n-\frac{1}{2}}\) from the previous time step, since \(b^{n+\frac{1}{2}}\) is unknown at the beginning of the time step; for \(n=0\), the value \(0\) is used (hence, no CFL condition is initially enforced, but the time step is taken small enough).