Multilayer Saint-Venant system with mass exchanges

The Saint-Venant system is extended to multiple layers following Audusse et al, 2011 as th+xl=0nl1hlul=0 with hl=layerlh with layerl the relative thickness of the layers satisfying layerl>=0,l=0nl1layerl=1. The momentum equation in each layer is thus t(hul)+(hulul+gh22I)=ghzb+1layerl[ul+1/2Gl+1/2ul1/2Gl1/2+ν(ul+1ulhl+1/2ulul1hl1/2)] where Gl+1/2 is the relative vertical transport velocity between layers and the second term corresponds to viscous friction between layers.

These last two terms are the only difference with the one layer system.

The horizontal velocity in each layer is stored in ul and the vertical velocity between layers in wl.

vector * ul = NULL;
scalar * wl = NULL;
double * layer;

Viscous friction between layers

Boundary conditions on the top and bottom layers need to be added to close the system for the viscous stresses. We chose to impose a Neumann condition on the top boundary i.e. zut=u̇t and a Navier slip condition on the bottom i.e. ub=ub+λbzub By default the viscosity is zero and we impose free-slip on the top boundary and no-slip on the bottom boundary i.e. u̇t=0, λb=0, ub=0.

double ν = 0.;
(const) scalar lambda_b = zeroc, dut = zeroc, u_b = zeroc;

For stability, we discretise the viscous friction term implicitly as (hul)n+1(hul)Δt=νlayerl(ul+1ulhl+1/2ulul1hl1/2)n+1 which can be expressed as the linear system Mun+1=rhs where M is a tridiagonal matrix. The lower, principal and upper diagonals are a, b and c respectively.

void vertical_viscosity (Point point, double h, vector * ul, double dt)
  if (ν == 0.)
  double a[nl], b[nl], c[nl], rhs[nl];

  foreach_dimension() {

The rhs of the tridiagonal system is hlul=hlayerlul.

    int l = 0;
    for (vector u in ul)
      rhs[l] = h*layer[l]*u.x[], l++;

The lower, principal and upper diagonals a, b and c are given by al>0=(νΔthl1/2)n+1 cl<nl1=(νΔthl+1/2)n+1 b0<l<nl1=layerlhn+1alcl

    for (l = 1; l < nl - 1; l++) {
      a[l] = - 2.*ν*dt/(h*(layer[l-1] + layer[l]));
      c[l] = - 2.*ν*dt/(h*(layer[l] + layer[l+1]));
      b[l] = layer[l]*h - a[l] - c[l];

For the top layer the boundary conditions give the (ghost) boundary value unl=unl1+u̇thnl1, which gives the diagonal coefficient and right-hand-side bnl1=layernl1hn+1anl1 rhsnl1=layernl1(hunl1)+νΔtu̇t

    a[nl-1] = - 2.*ν*dt/(h*(layer[nl-2] + layer[nl-1]));
    b[nl-1] = layer[nl-1]*h - a[nl-1];
    rhs[nl-1] += ν*dt*dut[];

For the bottom layer, the boundary conditions give the (ghost) boundary value u1 u1=2h02λb+h0ub+2λbh02λb+h0u0, which gives the diagonal coefficient and right-hand-side b0=layer0hn+1c0+2νΔt2λb+h0 rhs0=layer0(hu0)+2νΔt2λb+h0ub

    c[0] = - 2.*dt*ν/(h*(layer[0] + layer[1]));
    b[0] = layer[0]*h - c[0] + 2.*ν*dt/(2.*lambda_b[] + h*layer[0]);
    rhs[0] += 2.*ν*dt/(2.*lambda_b[] + h*layer[0])*u_b[];

We can now solve the tridiagonal system using the Thomas algorithm.

    for (l = 1; l < nl; l++) {
      b[l] -= a[l]*c[l-1]/b[l-1];
      rhs[l] -= a[l]*rhs[l-1]/b[l-1];
    vector u = ul[nl-1];
    u.x[] = a[nl-1] = rhs[nl-1]/b[nl-1];
    for (l = nl - 2; l >= 0; l--) {
      u = ul[l];
      u.x[] = a[l] = (rhs[l] - c[l]*a[l+1])/b[l];

Fluxes between layers

The relative vertical velocity between layers l and l+1 is defined as (eq. (2.22) of Audusse et al, 2011) Gl+1/2=j=0l(divj+layerjdh) with divl=(hlul) dh=l=0nl1divl

void vertical_fluxes (vector * evolving, vector * updates,
		      scalar * divl, scalar dh)
  foreach() {
    double Gi = 0., sumjl = 0.;
    for (int l = 0; l < nl - 1; l++) {
      scalar div = divl[l];
      Gi += div[] + layer[l]*dh[];
      sumjl += layer[l];
      scalar w = div;
      w[] = dh[]*sumjl - Gi;
      foreach_dimension() {

To compute the vertical advection term, we need an estimate of the velocity at l+1/2. This is obtained using simple upwinding according to the sign of the interface velocity Gi=Gl+1/2 and the values of the velocity in the l and l+1 layers. Note that the inequality of upwinding is consistent with equs. (5.110) of Audusse et al, 2011 and (77) of Audusse et al, 2011b but not with eq. (2.23) of Audusse et al, 2011.

	scalar ub = evolving[l].x, ut = evolving[l + 1].x;
	double ui = Gi < 0. ? ub[] : ut[];

The flux at l+1/2 is then added to the updates of the bottom layer and substracted from the updates of the top layer.

	double flux = Gi*ui;
	scalar du_b = updates[l].x, du_t = updates[l + 1].x;
	du_b[] += flux/layer[l];
	du_t[] -= flux/layer[l + 1];

To compute the vertical velocity we use the definition of the mass flux term (eq. 2.13 of Audusse et al, 2011): w(x,zl+1/2)=tzl+1/2Gl+1/2+ul+1/2zl+1/2 We can write the vertical position of the interface as: zl+1/2=zb+j=0lhj so that the vertical velocity is: w(x,zl+1/2)=dhj=0llayerjGl+1/2+ul+1/2[zb+hj=0llayerj]

	w[] += ui*((zb[1] - zb[-1]) + (h[1] - h[-1])*sumjl)/(2.*Δ);