# Adaptive wavelet simulation of global ocean dynamics using a new Brinkman volume penalization

N. K. -R. Kevlahan, T. Dubos, M. Aechtner

► To cite this version:

N. K. -R. Kevlahan, T. Dubos, M. Aechtner. Adaptive wavelet simulation of global ocean dynamics using a new Brinkman volume penalization. Geoscientific Model Development, 2015, 8, pp.3891-3909. 10.5194/gmd-8-3891-2015 . hal-04114666

HAL Id: hal-04114666

https://hal.science/hal-04114666

Submitted on 5 Jun 2023

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>
<figure><img src="image_2.png" /></figure>

# Adaptive wavelet simulation of global ocean dynamics using a new Brinkman volume penalization

N. K.-R. Kevlahan¹, T. Dubos², and M. Aechtner¹

¹Department of Mathematics and Statistics, McMaster University, Hamilton ON, Canada

²Laboratoire de Météorologie Dynamique/IPSL, École Polytechnique, Palaiseau, France

*Correspondence to:* N. K.-R. Kevlahan (kevlahan@mcmaster.ca)

Received: 15 May 2015 – Published in Geosci. Model Dev. Discuss.: 7 July 2015

Revised: 25 November 2015 – Accepted: 27 November 2015 – Published: 9 December 2015

**Abstract.** In order to easily enforce solid-wall boundary conditions in the presence of complex coastlines, we propose a new mass and energy conserving Brinkman penalization for the rotating shallow water equations. This penalization does not lead to higher wave speeds in the solid region. The error estimates for the penalization are derived analytically and verified numerically for linearized one-dimensional equations. The penalization is implemented in a conservative dynamically adaptive wavelet method for the rotating shallow water equations on the sphere with bathymetry and coastline data from NOAA's ETOPO1 database. This code could form the dynamical core for a future global ocean model. The potential of the dynamically adaptive ocean model is illustrated by using it to simulate the 2004 Indonesian tsunami and wind-driven gyres.

## 1 Introduction

Properly handling coastlines is crucial for realistic two-dimensional or three-dimensional ocean models. Two-dimensional, one-layer models focus on the propagation of barotropic waves and coastal effects. When modelling tsunami-induced flooding the position of the coastline itself may be an unknown to be predicted by the model. In that case wetting and drying at the shoreline must be properly handled (Audusse et al., 2004; Popinet, 2011). Properly predicting inundation of urban areas also requires extremely detailed topography data, typically to $O(10m)$ accuracy. Three-dimensional global ocean models usually treat coastlines as fixed, rigid boundaries. This is a simpler setting for which numerous methods have been designed in the

broader context of computational fluid dynamics (e.g. Almgren et al., 1997; Angot et al., 1999; Popinet and Rickard, 2007). For operational ocean models, improvements over the crude representation of coastlines as vertical walls limiting the horizontal extent of each model layer have been introduced (e.g. Adcroft et al., 1997). Another option is to use a static variable resolution unstructured mesh adapted to coastline geometry (Harig et al., 2008). When the horizontal grid is not fitted to the shape of coastlines, care must be taken that boundary conditions are enforced accurately (Adcroft and Marshall, 1998; Popinet and Rickard, 2007).

When it is desirable to capture non-stationary small-scale flow features, using a dynamically adaptive computational mesh may be considered. Whether this strategy is advantageous is strongly problem dependent. For tsunami simulations a properly implemented adaptive strategy has been shown to provide strong efficiency gains. Popinet and Rickard (2007) use a quadtree approach to provide dynamic adaptivity on an A grid discretization of the shallow water equations. Berger et al. (2011) apply their adaptive mesh refinement (AMR) code GeoClaw to model a synthetic tsunami test case in flat geometry. GeoClaw automatically handles wetting/drying and can be extended to the sphere on longitude–latitude or other logically rectangular grids (Berger et al., 2009). The approach of Popinet (2011) is perhaps the most comprehensive dynamically adaptive method for calculating tsunami propagation: it allows for wetting and drying and uses a highly efficient database system for multi-level terrain reconstruction. For statistically homogeneous shallow water turbulence, we have obtained encouraging results by combining wavelet-based dynamic adaptivity with local refinement criteria based on truncation-
error estimates (Dubos and Kevlahan, 2013; Aechtner et al., 2014).

Wavelet-based adaptive solvers for the incompressible Navier-Stokes equations can be combined easily with a treatment of complex three-dimensional, rigid boundaries based on Brinkman penalization (Kevlahan et al., 2000; Schneider and Farge, 2002; Vasilyev and Kevlahan, 2002; Kevlahan and Vasilyev, 2005). In this paper, a similar approach for handling fixed coastlines without wetting/drying is explored. A novel Brinkman penalization of the rotating shallow water equations is implemented in our dynamically adaptive wavelet model on the sphere (Dubos and Kevlahan, 2013; Aechtner et al., 2014) to simulate oceanic flows with realistic coastlines and bathymetry over scales ranging from sub-kilometric to global.

Brinkman penalization methods for the numerical solution of the Navier-Stokes equations with solid boundaries were originally introduced by Angot et al. (1999) following the pioneering work of Arquis and Caltagirone (1984). Like all penalization methods, their goal was to avoid having to adapt the discretization scheme to account for complex solid boundaries by instead modifying the dynamical equations such that as a control parameter tends to zero the solution of the modified equations with simple boundary conditions (e.g. periodic) tends to the solution of the original equations with the desired boundary conditions. The physical analogy is that the regular fluid is replaced by a porous medium where the porosity and permeability tend to zero in the solid portion of the computational domain and the porosity is one (i.e. a regular fluid) in the fluid part of the domain. Angot et al. (1999) proved that the method converges and gave (non-sharp) estimates of the error in terms of the control parameter. Because it is a volume penalization, Brinkman penalization methods are easy to implement since the geometry of the boundary need not be known. It is sufficient to know the indicator function (or mask) defining points as belonging to either in the solid or fluid parts of the computational domain. Notice that Brinkman penalization enforces the boundary conditions only with first-order accuracy while other methods reach second- or higher-order accuracy (Popinet and Rickard, 2007). A family of higher-order Brinkman penalization methods has been recently proposed by Shirokoff and Nave (2015).

Since its introduction, Brinkman penalization has been applied to a wide range of fluid flow problems and numerical schemes, including spectral methods (Kevlahan and Ghidaglia, 2001), moving boundaries (Kevlahan and Wadsley, 2005; Kolomenskiy and Schneider, 2009), the wave equation (Paccou et al., 2005), the compressible Euler equations (Liu and Vasilyev, 2007), and the shallow water equations (Perret et al., 2003; Reckinger et al., 2012). The shallow water penalization method we propose is a modification of the one proposed by Reckinger et al. (2012) to ensure that mass and energy are conserved and that the wave speed is the same in both the solid and fluid parts of the domain. We

also modify the velocity penalization (i.e. permeability) term to ensure better control of the overall error using the porosity parameter alone.

Penalization methods are particularly well suited to dynamically adaptive methods since these methods automatically refine the computational grid in the boundary layers and can use very coarse grids in the solid part of the computational domain where the solution is irrelevant (Kevlahan et al., 2000; Schneider and Farge, 2002; Vasilyev and Kevlahan, 2002; Kevlahan and Vasilyev, 2005). In addition, because penalization methods enforce the boundary conditions to only first-order accuracy, adaptive methods can provide the required level of accuracy by local grid adaptation (i.e. h refinement).

Previous volume penalization methods for the shallow water equations are reviewed in Sect. 2. The new penalization is derived from the porous shallow water equations in Sect. 3. The new penalization is verified for the linearized one-dimensional equations in Sect. 4. Finally, we illustrate the potential of the new method by applying it to two global ocean flows: tsunami propagation and wind-driven gyres. These simulations have realistic bathymetry and coastlines from the 1 arcmin NOAA ETOPO1 global relief database (Amante and Eakins, 2009). The two examples show how the Brinkman penalization of the shallow water equations works with a dynamically adaptive wavelet method for both fast (tsunami) and slow (global ocean circulation) dynamics and in the inertia-gravity (tsunami) and quasi-geostrophic (global ocean circulation) regimes. We intend to extend the methods presented here to build a full dynamically adaptive global ocean circulation model.

## 2 Previous penalization methods for the shallow water equations

In vector-invariant form, Reckinger et al. (2012) proposed the following set of penalized shallow water equations with a flat bottom:

$$ \frac{\partial h}{\partial t} + \frac{1}{\phi(\mathbf{x})} \mathrm{div} h \mathbf{u} = 0, \quad (1) $$

$$ \frac{\partial \mathbf{u}}{\partial t} + \frac{\mathrm{curl}(\mathbf{u})}{h} \times h\mathbf{u} + \mathrm{grad} \left( gh + \frac{1}{2} |\mathbf{u}|^2 \right) = -\sigma(\mathbf{x})\mathbf{u}, \quad (2) $$

where h is the height of the fluid column, u is the vertically averaged horizontal velocity and g is gravity. In this section, as well as in Sects. 3 and 4, the Coriolis force is omitted for simplicity. It will be reintroduced in the numerical experiments of Sect. 5. The corresponding momentum equation is

$$ \frac{\partial \mathbf{m}}{\partial t} + \mathrm{div}(\mathbf{m} \otimes \mathbf{u}) + \phi \mathrm{grad} \left( \frac{1}{2} g h^2 \right) = -\sigma(\mathbf{x}) \mathbf{u}, \quad (3) $$

where momentum $\mathbf{m} = h\mathbf{u}$ coincides with the mass flux. $\phi(\mathbf{x})$ and $\sigma(\mathbf{x})$ are respectively the variable porosity and linear friction terms characterizing the porous medium. In order
to model a fluid with solid boundaries these terms have the following discontinuous forms:

$$ (\phi(\mathbf{x}), \sigma(\mathbf{x})) = \begin{cases} (\alpha, 1/\epsilon) & \text{in the penalized region,} \\ (1, 0) & \text{in the fluid,} \end{cases} \qquad (4) $$

where the parameters $\alpha$ and $\epsilon$ control the accuracy of the boundary condition approximation. (For stable numerical implementation of the penalization, the discontinuities in $\phi$ and $\sigma$ are smoothed over a few grid points.) Physically, a large jump in porosity leads to a large jump in impedance that causes inertia-gravity waves to be almost perfectly reflected at the solid boundary, while a strong linear friction term rapidly damps velocity fluctuations approximating a no-slip velocity boundary condition.

Equations (1-3) are derived from the Liu and Vasilyev (2007) similar penalized equations for the compressible Euler equations. Both penalizations have the property that mass and momentum do not move at the same speed, so it is impossible to conserve mass or to define an energy equation.

The lack of mass conservation is easy to see from the mass equation (Eq. 1), which can be rewritten as

$$ \frac{\partial \phi(\mathbf{x}) h}{\partial t} + \mathrm{div} \mathbf{m} = 0, \qquad (5) $$

where $\mathbf{m} = h\mathbf{u}$ is the height (i.e. mass) flux. In order to conserve mass, the mass flux should actually be $\mathbf{m} = \phi(\mathbf{x})\mathbf{u}$ to take into account the changing volume fraction of the fluid in the porous medium. The penalized momentum equation (Eq. 3) also uses a non-porous mass flux (i.e. $h\mathbf{u}$ instead of $\phi h \mathbf{u}$). Therefore, it is impossible to derive an energy budget from Eqs. (1) and (3).

The Reckinger et al. (2012) penalization also has the property that inertia-gravity wave speeds are $1/\sqrt{\alpha}$ times faster in the porous medium. This introduces a stiffness in time associated with the small porosity $\alpha$ that enforces an artificially small time step.

The earlier shallow water equation penalization used by Perret et al. (2003) is even simpler in that only the velocity field is penalized using the friction term $-\sigma(\mathbf{x})\mathbf{u}$. Therefore, only the no-slip velocity boundary condition is approximated and not the perfect reflection of inertia-gravity waves at the boundary. This penalization can therefore be approximately valid in the quasi-geostrophic regime where wave motion is insignificant compared to vortical motion.

In the following section we derive the shallow water equations for a porous medium using the Euler-Poincaré theory and then use these physical equations to propose a new Brinkman penalization for the shallow water equations in complex geometries. The final equations differ only slightly from those proposed by Reckinger et al. (2012), but they conserve both mass and energy and the wave speed is the same in both the fluid and penalized parts of the domain. Although our penalization is better justified on physical grounds, it is not yet clear whether it has any computational advantages

apart from eliminating the stiffness constraint associated with the small porosity $\alpha$.

# 3 New volume penalization for the shallow water equations

## 3.1 Derivation of porous shallow water equations

The Euler-Poincaré theory (Holm et al., 2002) states that Hamilton's least action principle applied to the action

$$ \mathcal{L} = \int L(h, \mathbf{u}, \mathbf{x}) dxdydt $$

generates momentum equations for a particular choice of Lagrangian density, i.e. $L(h, u), (x) = T - V$. The Lagrangian density is the difference in kinetic and potential energy density and is assumed to depend on a scalar $h$, velocity vector field $\mathbf{u}(\mathbf{x})$ and position vector $\mathbf{x} \in \mathbb{R}^2$. If the conservation equation for the scalar $h$ is

$$ \frac{\partial h}{\partial t} + \mathrm{div}(h\mathbf{u}) = 0, $$

then locally conservative vector-invariant equation for momentum $\mathbf{m}$ is

$$ \frac{\partial \mathbf{m}}{\partial t} + \mathrm{div}(\mathbf{m} \otimes \mathbf{u}) + \mathrm{grad}(p) = \frac{\partial L}{\partial \mathbf{x}}, \qquad (6) $$

and the vector-invariant equation of motion is

$$ \frac{\partial \mathbf{v}}{\partial t} + \frac{\nabla \times \mathbf{v}}{h} \times h\mathbf{u} + \nabla B = 0, \qquad (7) $$

where

$$ \mathbf{m} = \frac{\partial L}{\partial \mathbf{u}} = h\mathbf{v}, \quad B = \mathbf{u} \cdot \mathbf{v} - \frac{\partial L}{\partial h}, \quad p = L - h \frac{\partial L}{\partial h}, \quad \mathbf{v} = \mathbf{u}. $$

The total energy

$$ E = \iint (\mathbf{m} \cdot \mathbf{u} - L) dxdy $$

is conserved.

We now use the Euler-Poincaré theory to derive standard and modified shallow water equations. The fluid has free surface perturbations $\eta(\mathbf{x})$ from the mean free surface $\eta = 0$ and the depth of the fluid is given by $b(\mathbf{x}) > 0$ so the total depth is $h(\mathbf{x}) = \eta(\mathbf{x}) + b(\mathbf{x})$ as shown in Fig. 1. (In ocean modelling $b$ is called the bathymetry, and $b = 0$ corresponds to coastlines.) The shallow water approximation assumes that $\eta$ is small compared to depth $b$ and that the wavelength of surface waves is much longer than the depth $b$. Note that $h$ is proportional to the total mass density of the fluid column.

The standard shallow water equations are obtained using the Lagrangian density for the shallow water system:

$$ L(h, \mathbf{u}) = \frac{1}{2} h (|\mathbf{u}|^2 - g(\eta - b)), $$
<figure><img src="image_3.png" /><figcaption>**Figure 1.** Shallow water geometry. The perturbation of the sea surface from equilibrium sea surface $z = 0$ is $\eta(\mathbf{x})$ and the sea depth is given by the bathymetry $b(\mathbf{x}) \ge 0$, which is the depth of the seafloor below the equilibrium sea surface. The total height of the fluid is then $h(\mathbf{x}) = \eta(\mathbf{x}) + b(\mathbf{x})$. In the shallow water approximation the wavelength of the perturbations of the sea surface is much greater than the depth, and the amplitude of the perturbations is much less than the depth.</figcaption></figure>

from which one derives

$$m = hu,$$

$$B = g\eta + \frac{1}{2}|u|^2, \quad p = \frac{1}{2}gh^2,$$

$$E = \frac{1}{2} \iint h \left( \mathbf{u}^2 + g(\eta - b) \right) dxdy.$$

Thus, the shallow water equation of motion is the equation of motion:

$$\frac{\partial \mathbf{u}}{\partial t} + \frac{\mathrm{curl}(\mathbf{u})}{h} \times h\mathbf{u} + \mathrm{grad}\left(g\eta + \frac{1}{2}|\mathbf{u}|^2\right) = 0. \quad (8)$$

We now assume a porous medium with volume fluid fraction given by the variable porosity $\phi(\mathbf{x})$. We define a new variable $\tilde{h} = \phi h$ satisfying the conservation law

$$\frac{\partial \tilde{h}}{\partial t} + \mathrm{div}(\tilde{h}\mathbf{u}) = 0, \quad (9)$$

and the action

$$\mathcal{L} = \iint \int \frac{1}{2} h \left( |\mathbf{u}|^2 - g(h - 2b) \right) \phi dxdydt. \quad (10)$$

The Lagrangian density for the new variable $\tilde{h}$ is then

$$L(\tilde{h}, \mathbf{u}, \mathbf{x}) = \frac{\tilde{h}}{2} \left( |\mathbf{u}|^2 - g \frac{\tilde{h}}{\phi} + 2gb \right), \quad (11)$$

from which

$$\mathbf{m} = \tilde{h}\mathbf{u}, \quad \mathbf{v} = \mathbf{u}, \quad B = g\eta + \frac{1}{2}\mathbf{u}^2,$$

$$p = \frac{1}{2}\phi g h^2, \quad \frac{\partial L}{\partial x} = \frac{1}{2}gh^2 \mathrm{grad}(\phi) + gh\phi \mathrm{grad}(b).$$

The momentum equation for the porous shallow water system is

$$\frac{\partial \mathbf{m}}{\partial t} + \mathrm{div}(\mathbf{m} \otimes \mathbf{u}) + \phi \mathrm{grad}\left(\frac{1}{2}gh^2\right) - gh\phi \mathrm{grad}(b) = 0.$$

However, surprisingly, the vector-invariant form of the equations of motion for the shallow water system are identical to the usual shallow water equation (Eq. 8); only the mass budget has changed to (Eq. 9). States of rest correspond to constant $h$ and inertia–gravity waves travel at speed $\sqrt{gh}$ if the porosity $\phi$ is constant, independent of the actual value of $\phi$.

The non-dissipative equations of motion derived above do not fully model flow in porous media since they do not include the friction force per unit volume that resists flow through the medium. Including the friction force, the full vector-invariant equation of motion for the porous shallow water system is

$$\frac{\partial \mathbf{u}}{\partial t} + \frac{\mathrm{curl}(\mathbf{u})}{h} \times h\mathbf{u} + \mathrm{grad}\left(g\eta + \frac{1}{2}|\mathbf{u}|^2\right) = -\frac{\mu\phi(\mathbf{x})}{K(\mathbf{u}, h, \mathbf{x})}\mathbf{u}, \quad (12)$$

where $\mu$ is the fluid viscosity and $K(\mathbf{u}, h)$ is the effective permeability of the medium due to various friction terms. However, for the purposes of this paper we will assume the simple linear friction term of the form

$$-\frac{\phi(\mathbf{x})}{K}\mathbf{u}, \quad (13)$$

with constant permeability $K$ which, like $\epsilon$, has the dimensions of a time.

If the porosity is not small, it is better to use an empirical nonlinear friction law that includes both bottom and wall shear stresses (Guinot and Soares-Frazao, 2006). For example, the Strickler law approximates the friction term as

$$-\frac{g\tilde{h}|\mathbf{u}|}{k^2h^{4/3}}\mathbf{u}, \quad (14)$$

where $k$ is the so-called Strickler coefficient that depends empirically on the bottom roughness $k_s$, e.g. Ramette’s formula gives $k = 8.2\sqrt{g}/k_s^{1/6}$ (Hervouet, 2007). Strickler’s law is used by Guinot and Soares-Frazao (2006) in their porous shallow water model for large-scale flooding of urban areas.

## 3.2 Volume penalization of the shallow water equations

Our goal in this paper is to derive a volume penalization for solid boundaries in the shallow water model (e.g. coastlines or islands in an ocean model). As in all penalization methods, the idea is to implement boundary conditions implicitly by modifying the equations in a suitable way. In the limit as certain control parameters tend to zero the solution of the modified equations tends to the solution of the original equations with the desired boundary conditions. Such penalization techniques are particularly well suited to adaptive numerical methods since, although the solid region is technically part of the computational domain, it can be resolved very coarsely except near the boundary.
We propose modelling the solid parts (e.g. continents and islands) of the computational domain as a porous medium with vanishingly small porosity $\phi$ and permeability $K$. The fluid part of the computational domain remains a regular fluid. The jump in porosity causes inertia–gravity waves to be reflected physically at the coastline and the small permeability approximates a no-slip boundary condition for velocity, i.e. $\mathbf{u} = \mathbf{0}$.

The vector-invariant penalized shallow equations based on (Eq. 12) are

$$ 
\begin{aligned}
\frac{\partial \tilde{h}}{\partial t} + \operatorname{div}(\tilde{h}\mathbf{u}) &= 0, \\
\frac{\partial \mathbf{u}}{\partial t} + \frac{\operatorname{curl}(\mathbf{u})}{\tilde{h}} \times \tilde{h}\mathbf{u} + \operatorname{grad}\left(\frac{g\tilde{\eta}}{\phi(\mathbf{x})} + \frac{1}{2}|\mathbf{u}|^2\right) &= -\sigma(\mathbf{x})\mathbf{u},
\end{aligned}
\quad (15) $$

where $\tilde{\eta} = \phi(\mathbf{x})\eta$. The porosity $\phi(\mathbf{x})$ and porous friction coefficient $\sigma(\mathbf{x})$ are discontinuous such that the fluid portion of the domain is unaffected and the solid portion is penalized as a very impermeable medium:

$$ (\phi(\mathbf{x}), \sigma(\mathbf{x})) = \begin{cases} (\alpha, \alpha/K) & \text{in the penalized region,} \\ (1, 0) & \text{in the fluid,} \end{cases} \quad (16) $$

with $K \ll \alpha \ll 1$. The solid regions are defined by the indicator function $\chi(\mathbf{x})$:

$$ \chi(\mathbf{x}) = \begin{cases} 1 & \text{in the solid,} \\ 0 & \text{in the fluid.} \end{cases} \quad (17) $$

When implemented numerically the indicator function $\chi(\mathbf{x})$ is smoothed over a few grid points, as discussed in Reckinger et al. (2012). The porosity $\phi(\mathbf{x})$ and friction coefficient $\sigma(\mathbf{x})$ are then defined based on $\chi(\mathbf{x})$ and the control parameters $\alpha \ll 1$ and $K \ll \alpha \ll 1$ as

$$ \phi(\mathbf{x}) = 1 + \chi(\mathbf{x})(\alpha - 1), \quad (18) $$

$$ \sigma(\mathbf{x}) = \frac{\alpha}{K} \chi(\mathbf{x}). \quad (19) $$

Note that the prognostic variables for the penalized shallow water equations (Eq. 15) are $\tilde{h}$ and $\mathbf{u}$ and that $\tilde{h} = h$ in the non-penalized (i.e. non-porous) region.

Equation (19) shows that the velocity penalization friction term $\sigma(\mathbf{x})$ depends explicitly on both the porosity $\alpha$ and the permeability $K$. In contrast, in Reckinger et al. (2012) the velocity friction parameter $\epsilon$ is formally independent of porosity. Although for a porous medium the velocity friction parameter depends on porosity, when these equations are used for penalization there is $\epsilon$ and $\alpha$ can be varied independently.

The flux form of the equations is

$$ 
\begin{aligned}
\frac{\partial \tilde{h}}{\partial t} + \operatorname{div}(\mathbf{m}) &= 0, \\
\frac{\partial \mathbf{m}}{\partial t} + \operatorname{div}\left(\frac{\mathbf{m} \otimes \mathbf{m}}{\tilde{h}}\right) + \phi \operatorname{grad}\left(\frac{g\tilde{h}^2}{2\phi^2}\right) - g\tilde{h} \operatorname{grad}(b) &= -\sigma \mathbf{m},
\end{aligned}
 $$

where the mass flux $\mathbf{m} = \phi \mathbf{h} \mathbf{u}$. This shows clearly that both mass and momentum move at the same speed $\mathbf{u}$.

Although this penalization scheme is similar to that proposed by Reckinger et al. (2012), it does have some important physical and numerical differences that could prove advantageous. In addition, we fully characterize the error and convergence properties of penalization by deriving analytical estimates for the exact solution of the linearized one-dimensional wave propagation problem.

### 3.3 Properties of the penalization

We now summarize the main numerical properties of the volume penalization of the rotating shallow water equations introduced in the previous section.

The impedance mismatch at the solid boundary means that inertia–gravity waves are reflected with reflection coefficient

$$ \mathcal{R} = \frac{\alpha^{-1} - 1}{\alpha^{-1} + 1} = 1 - 2\alpha + O(\alpha^2), $$

whereas the exact behaviour at the boundary is perfect reflection, $\mathcal{R} = 1$. Therefore, some height amplitude will be lost since part of the wave is transmitted and the size of the error is $O(\alpha)$.

There are two main differences compared with the method proposed in Reckinger et al. (2012). First, mass and energy both move at the same speed $\mathbf{u}$, so energy is conserved. In particular, total energy decreases as

$$ \frac{d}{dt} \frac{1}{2} \iint \tilde{h} \left( g(\eta - b) + |\mathbf{u}|^2 \right) \phi(\mathbf{x}) \mathrm{d}\mathbf{x}\mathrm{d}\mathbf{y} = - \iint \sigma(\mathbf{x}) \tilde{h} |\mathbf{u}|^2 \phi(\mathbf{x}) \mathrm{d}\mathbf{x}\mathrm{d}\mathbf{y}, $$

which implies that the penalization is stable. Secondly, ignoring friction, the linear wave speed is the same in both the fluid and porous regions,

$$ c = u \pm \sqrt{\frac{g\tilde{h}}{\phi(\mathbf{x})}} = u \pm \sqrt{gH}, $$

where $\tilde{h} = h\phi(\mathbf{x}) = (H + O(\eta))\phi(\mathbf{x})$, with $\eta \ll 1$, independent of $\alpha$. This means that, unlike the method of Reckinger et al. (2012), the height penalization does not affect the time step or stability properties of the numerical method.

The velocity penalization term is stiff in time, and limits the time step to $\Delta t = O(\epsilon)$ for explicit methods. Avoiding
the stiffness is straightforward by implementing the penalization term implicitly; however, the time step still needs to be small enough to accurately resolve the numerical boundary layer in the solid generated by the penalization. The height penalization parameter $\alpha$ does not place any additional constraints on the spatial resolution $\Delta x$ or the time step $\Delta t$.

Because height and velocity are governed by diffusion (and not wave) equations in the penalized solid region, a wave will not be emitted from the boundary if there is no incoming wave. Therefore, the penalization is stable according to GKS (Gustafsson-Kreiss-Sundström) stability theory for numerical stability of hyperbolic problems (Gustafsson et al., 1972).

The error and convergence properties of this method are derived analytically and verified numerically for a simple, linear one-dimensional example in following section.

# 4 Analysis of linearized 1-D equations and guidelines for use

## 4.1 Exact solution and error analysis

We consider the one-dimensional penalized shallow water equations linearized about the state of rest with depth $H$ and speed $u = 0$:

$$ 
\begin{aligned}
\frac{\partial \tilde{h}}{\partial t} &= -H \frac{\partial}{\partial x} (\phi(x)u), \\
\frac{\partial u}{\partial t} &= -g \frac{\partial}{\partial x} \left( \frac{\tilde{h}}{\phi(x)} \right) - \sigma(x)u,
\end{aligned}
\quad (20) $$

where the penalization functions $\phi(x)$ and $\sigma(x)$ are as given in (Eq. 4). The geometry of the domain is defined by the indicator function $\chi(x) = H(x)$, where $H(x)$ is the Heaviside function. This means that $x < 0$ is fluid and $x \ge 0$ is solid. (Note that in a numerical implementation the indicator function is smoothed over a few grid points to avoid numerical oscillations.) The initial conditions are $u(x, 0) = 0$ and

$$ h(x, 0) = \begin{cases} H_w, & x < -L - 1, \\ -\frac{H_w}{L}(x+1), & -L - 1 \le x \le -1, \\ 0, & x > -1, \end{cases} \quad (21) $$

i.e. a linear ramp wave front with (non-dimensional) width $L$ and amplitude $H_w$.

Following Kevlahan and Ghidaglia (2001) we solve the problem by taking separate Laplace transforms in time for the regions $x < 0$ and $x \ge 0$ and solving the resulting ordinary differential equations in $x$. The resulting four constants are determined by the requirement of finite solutions as $x \to \pm\infty$ and from the jump conditions at $x = 0$,

$$ \tilde{h}(x_{-}) = \tilde{h}(x_{+})/\alpha, \quad u(x_{-}) = u(x_{+})\alpha. \quad (22) $$

These jump conditions are found by integrating equations (Eq. 20) across the fluid-solid boundary $x = 0$.

The exact Laplace transforms of penalized height and velocity in the fluid-solid regions are

$$ 
\begin{aligned}
\tilde{h}_{\text{fluid}}(x, s) &= \tilde{h}_1(x, s) + \frac{cH_w}{2Ls^2} e^{sx/c} \left( e^{-s/c} - e^{-s(1+L)/c} \right) \\
&\quad \frac{(1+\alpha^2)\epsilon s + 1 - 2\alpha\sqrt{\epsilon s(\epsilon s + 1)}}{(1-\alpha^2)\epsilon s + 1}, \\
u_{\text{fluid}}(x, s) &= u_1(x, s) - \frac{c^2 H_w}{2HLs^2} e^{sx/c} \left( e^{-s/c} - e^{-s(1+L)/c} \right) \\
&\quad \frac{(1+\alpha^2)\epsilon s + 1 - 2\alpha\sqrt{\epsilon s(\epsilon s + 1)}}{(1-\alpha^2)\epsilon s + 1}, \\
\tilde{h}_{\text{solid}}(x, s) &= -\frac{\alpha c H_w \epsilon s + 1 - \alpha \sqrt{\epsilon s(\epsilon s + 1)}}{Ls^2 (1-\alpha^2)\epsilon s + 1} e^{-\frac{x}{\sqrt{ec}}\sqrt{s}\sqrt{\epsilon s+1}} \\
&\quad \left( e^{-s/c} - e^{-s/c(1+L)} \right), \\
u_{\text{solid}}(x, s) &= \frac{gH_w \sqrt{\epsilon s+1} - \alpha\sqrt{\epsilon s}}{Ls^{3/2} (1-\alpha^2)\epsilon s + 1} e^{-\frac{x}{\sqrt{ec}}\sqrt{s}\sqrt{\epsilon s+1}} \\
&\quad \left( e^{-s/c} - e^{-s(1+L)/c} \right),
\end{aligned}
\quad (23) $$

where the wave speed $c = \sqrt{gH}$, and $\tilde{h}_1(x, s)$ and $u_1(x, s)$ do not depend on the penalization. Now, taking the leading-order series expansions in $\alpha \ll 1$ we have the following approximate expressions for the Laplace transforms of the penalized solutions:

$$ 
\begin{aligned}
\tilde{h}_{\text{fluid}}(x, s) &= \tilde{h}_{\text{exact}}(x, s) \\
&\quad - \frac{\alpha \epsilon^{1/2} c H_w}{L} \frac{e^{sx/c} (e^{-s/c} - e^{-s(1+L)/c})}{s^{3/2} \sqrt{\epsilon s + 1}} + O(\alpha^2), \\
u_{\text{fluid}}(x, s) &= u_{\text{exact}}(x, s) \\
&\quad + \frac{\alpha \epsilon^{1/2} c^2 H_w}{HL} \frac{e^{sx/c} (e^{-s/c} - e^{-s(1+L)/c})}{s^{3/2} \sqrt{\epsilon s + 1}} + O(\alpha^2), \\
\tilde{h}_{\text{solid}}(x, s) &= \frac{\alpha c H_w}{Ls^2} e^{-\frac{x}{\sqrt{ec}}\sqrt{s}\sqrt{\epsilon s+1}} (e^{-s/c} - e^{-s(1+L)/c}) \\
&\quad + O(\alpha^2), \\
u_{\text{solid}}(x, s) &= \frac{gH_w}{Ls^{3/2}} \frac{e^{-\frac{x}{\sqrt{ec}}\sqrt{s}\sqrt{\epsilon s+1}}}{\sqrt{\epsilon s+1}} (e^{-s/c} - e^{-s(1+L)/c}) \\
&\quad + O(\alpha),
\end{aligned}
\quad (24) $$

where we recall that the exact solution in the solid region is zero.

Taking the inverse Laplace transform of Eq. (24) gives the following results for the penalizations errors in the fluid part of the domain:

$$ 
\begin{aligned}
\tilde{h}_{\text{fluid}}(x, t) - \tilde{h}_{\text{exact}}(x, t) &= \frac{\alpha H_w}{L} [f_1(x + ct - (1 + L)) - f_1(x + ct - 1)], \\
u_{\text{fluid}}(x, t) - u_{\text{exact}}(x, t) &= -\frac{c}{H} (\tilde{h}_{\text{fluid}}(x, t) - \tilde{h}_{\text{exact}}(x, t)),
\end{aligned}
\quad (25) $$

where

$$ f_1(x) = H(x)xM\left(\frac{1}{2}, 2, -\frac{x}{c\epsilon}\right), $$
and $M(1/2, 2, -z)$ is a hypergeometric function with leading-order asymptotic expansion for large argument $z$:

$$M(1/2, 2, -z) \sim \frac{2}{\sqrt{\pi}} z^{-1/2}.$$

Note that the error is exactly zero until the wave reflects from the boundary. After reflection the error is zero at the leading edge of the wave $x = 1 - ct$ and maximal at the trailing edge $x = 1 + L - ct$. The maximum relative penalization errors are therefore

$$ \begin{aligned} \frac{||\tilde{h}_{\text{fluid}} - \tilde{h}_{\text{exact}}||_{\infty}}{H_w} &= \alpha M \left(\frac{1}{2}, 2, -\frac{L}{c\epsilon}\right) \sim 2\sqrt{\frac{c}{L}}\alpha\epsilon^{1/2}, \\ \frac{||u_{\text{fluid}} - u_{\text{exact}}||_{\infty}}{c} &= \alpha \frac{H_w}{H} M \left(\frac{1}{2}, 2, -\frac{L}{c\epsilon}\right) \sim 2\frac{H_w}{H}\sqrt{\frac{c}{L}}\alpha\epsilon^{1/2}, \end{aligned} \quad (26) $$

where we have assumed that $\epsilon \ll L/c$.

The asymptotic estimates (Eq. 26) show that the penalization converges as $\epsilon \to 0$ and $\alpha \to 0$ and that the relative errors of the penalized equations are $O(\alpha\epsilon^{1/2}\sqrt{c/L})$ for height and $O(\alpha\epsilon^{1/2}\sqrt{c/L}H_w/H)$ for velocity. As expected, the error is exactly zero until the wave reaches the solid boundary at $t = 1$.

Now, taking the inverse Laplace transform in the solid region we find that

$$ \begin{aligned} \tilde{h}_{\text{solid}}(x,t) &= \frac{\alpha c H_w}{L} \left[ \int_{x/c}^{t-1/c} e^{-\tau/2\epsilon} I_0 \left( \frac{1}{2\epsilon} \sqrt{\tau^2 - \left(\frac{x}{c}\right)^2} \right) \right. \\ & \qquad \left. e^{-\frac{t-1/c-\tau}{\epsilon}} M \left( \frac{3}{2}, 1, \frac{t-1/c-\tau}{\epsilon} \right) d\tau \right. \\ & \qquad \left. - \int_{x/c}^{t-(1+L)/c} e^{-\tau/2\epsilon} I_0 \left( \frac{1}{2\epsilon} \sqrt{\tau^2 - \left(\frac{x}{c}\right)^2} \right) \right. \\ & \qquad \left. e^{-\frac{t-(1+L)/c-\tau}{\epsilon}} M \left( \frac{3}{2}, 1, \frac{t-(1+L)/c-\tau}{\epsilon} \right) d\tau \right] \\ u_{\text{solid}}(x,t) &= \frac{g H_w}{L} \int_{t-(1+L)/c}^{t-1/c} e^{-\tau/2\epsilon} I_0 \left( \frac{1}{2\epsilon} \sqrt{\tau^2 - \left(\frac{x}{c}\right)^2} \right) d\tau. \end{aligned} \quad (27) $$

If we now assume that $\epsilon \ll t - (L+1)/c$ to approximate $I_0(z) \sim e^z/\sqrt{2\pi z}$ for $z \gg 1$, $x \ll ct - (L+1)$ to approximate $\sqrt{\tau^2 - (x/c)^2} = \tau(1 - 1/2(x/c\tau)^2) + O(x/c\tau)^4$, and $\epsilon \ll x/c$ to approximate $M(3/2, 1, -z) \sim 2z^{1/2}/\sqrt{\pi}$, the above

Laplace transform integrals become

$$ \begin{aligned} \tilde{h}_{\text{solid}}(x,t) &= \frac{2\alpha c H_w}{\pi L} \left[ \int_{x/c}^{t-1/c} \left( \frac{t-1/c}{\tau} - 1 \right)^{1/2} \exp\left(-\frac{x^2}{4c^2\epsilon\tau}\right) d\tau \right. \\ & \qquad \left. - \int_{x/c}^{t-(1+L)/c} \left( \frac{t-(1+L)/c}{\tau} - 1 \right)^{1/2} \exp\left(-\frac{x^2}{4c^2\epsilon\tau}\right) d\tau \right], \\ \tilde{u}_{\text{solid}}(x,t) &= \frac{g H_w}{L} \sqrt{\frac{\epsilon}{\pi}} \int_{t-(1+L)/c}^{t-1/c} \tau^{-1/2} \exp\left(-\frac{x^2}{4c^2\epsilon\tau}\right) d\tau. \end{aligned} \quad (28) $$

Again, assuming $\epsilon \ll x/c$, the integrand in the first equation decays exponentially as $\tau \to x/c$ and we can approximate the lower integration limit $x/c$ by zero. Evaluating the integrals in Eq. (28) gives the final results:

$$ \begin{aligned} \frac{\tilde{h}_{\text{solid}}(x,t)}{H_w} &\sim \frac{\alpha c}{L} [f_2(x, t-1/c) - f_2(x, t-(L+1)/c)], \\ \frac{u_{\text{solid}}(x,t)}{c} &\sim \frac{g H_w}{Lc} [f_3(x, t-1/c) - f_3(x, t-(L+1)/c)], \end{aligned} \quad (29) $$

where

$$ \begin{aligned} f_2(x,t) &= H(t) \left[ \left( 1 + \frac{x^2}{2c^2\epsilon t} \right) \text{erfc} \left( \frac{x}{c\sqrt{\epsilon t}} \right) \right. \\ & \qquad \left. - \frac{x}{2c\sqrt{\pi\epsilon t}} \exp \left( -\frac{x^2}{4c^2\epsilon t} \right) \right], \\ f_3(x,t) &= H(t) \left[ \frac{x}{c} \text{erf} \left( \frac{x}{2c\sqrt{\epsilon t}} \right) + 2\sqrt{\frac{t\epsilon}{\pi}} \exp \left( -\frac{x^2}{4c^2\epsilon t} \right) \right]. \end{aligned} \quad (30) $$

Assuming an interaction time $t \approx L/c$, the results (Eqs. 29, 30) show that the penalized solution penetrates a distance $O(\sqrt{cL\epsilon})$ into the solid region. This numerical boundary layer must be resolved, so we require a local grid size near the boundary $\Delta x \le \sqrt{cL\epsilon}/2$ or, equivalently, $\epsilon \ge 4\Delta x^2/cL$ for a given grid size $\Delta x$. If the wavefront is well resolved, i.e. $L$ is much larger than the grid size $\Delta x$, then the penalization is first-order accurate in space with a relative height error $O(\alpha\Delta x/L)$. However, if the wavefront is only marginally resolved, i.e. $L \approx \Delta x$, then the relative error is $O(\alpha)$, independent of the grid resolution. In this case a sufficiently small error can be achieved for any grid by choosing $\alpha$ appropriately.

In summary, we have found that the penalized solution converges to the exact solution in the fluid domain with the rates $O(\sqrt{c/L\alpha\epsilon^{1/2}})$ for height and $O(H_w/H\sqrt{c/L\alpha\epsilon^{1/2}})$ for velocity, where $c$ is the wave speed, $L$ is the length scale of the wave, and $H_w/H$ is the ratio of wave height to mean depth. The numerical solution penetrates a distance $\sqrt{cL\epsilon}$ into the solid region and this numerical boundary layer must be resolved.
<figure><img src="image_4.png" /><figcaption>Figure 2. Initial height conditions for the wave packet and Gaussian test cases and porosity $\phi(x)$ with $\alpha = 0.1$. The velocity is initially zero. Note the smoothing of the indicator function over about four grid points at the left and right solid boundaries with $\Delta = \Delta x$.</figcaption></figure>

## 4.2 Numerical verification on linearized 1-D wave propagation

The error estimate $O(\alpha\epsilon^{1/2}) = O(\sqrt{\alpha K})$ for height and velocity derived in the previous section is verified here for one-dimensional linear wave propagation with reflection. The computational domain is $x \in [0, L_x]$ with periodic numerical boundary conditions. The penalized (i.e. solid) region is $x \le x_1$ and $x \ge x_2$ defined by indicator functions:

$$\chi(x) = \frac{1}{2} \left( \tan h \left( \frac{x - x_2}{\Delta/4} \right) - \tan h \left( \frac{x - x_1}{\Delta/4} \right) \right),$$

$$\phi(x) = 1 + \chi(x)(\alpha - 1),$$

$$\sigma(x) = \frac{1}{\epsilon}(H(-(x - x_1)) + H(x - x_2)).$$

A smoothed porosity is used since $\phi(x)$ must be differentiated. However, the permeability $\sigma(x)$ is not smoothed since otherwise the penalization error begins to grow for a sufficiently small $\epsilon$ (depending inversely on $\alpha$). (If $\epsilon = K/\alpha$, a smoothed $\sigma(x)$ may be used.) When $\epsilon = K/\alpha$ we choose $K = (4\Delta x)^2$. A good choice for the smoothing parameter is the smallest value that ensures stable solutions and linear error convergence with $\alpha$. Since we use a low-order (second-order) method in space, it is often possible to obtain stable solutions with no smoothing. However, to ensure the solution is always stable we choose $\Delta = 4\Delta x$, which smooths the indicator function over about four grid points as shown in Fig. 2. We use these choices for the $K$ and $\Delta$ in the remainder of this section. Smoothing is also useful to produce more accurate coastline profiles from masks as in the examples in the following section.

The initial condition is a Gaussian wave for height and zero velocity:

$$\begin{aligned} h_0(x) &= \exp \left[ - \left( \frac{x - L_x/2}{L} \right)^2 \right], \\ u_0(x) &= 0, \end{aligned} \qquad (31)$$

with wave width $L = 1/24 = 4.1667 \times 10^{-2}$. The initial conditions and porosity are shown in Fig. 2. The computational domain is [0, 0.6] (i.e. $L_x = 0.6$), with the fluid part of the domain [0.05, 0.55] (i.e. $x_1 = 0.05$ and $x_2 = 0.55$) with length of 0.5 and the left and right solid boundaries are penalized regions, each of 0.05 width.

The exact solution with initial conditions (Eq. 31) and solid boundary conditions $u = 0$ and $\partial h/\partial x = 0$ is

$$\begin{aligned} h(x,t) &= \frac{1}{2}(h_0^p(x-t) + h_0^p(x+t)) \\ &\quad + \frac{1}{2}(u_0^p(x-t) - u_0^p(x+t)), \end{aligned}$$

$$\begin{aligned} u(x,t) &= \frac{1}{2}(u_0^p(x-t) + u_0^p(x+t)) \\ &\quad + \frac{1}{2}(h_0^p(x-t) - h_0^p(x+t)), \end{aligned}$$

where $h_0^p(x)$ and $u_0^p(x)$ are the odd periodic extension of the initial conditions outside the fluid interval $[x_1, x_2]$.

The linearized one-dimensional equation (Eq. 20) is solved using a standard second-order finite volume/finite difference scheme with third-order Runge-Kutta integration in time on a uniform grid with $N = 2400$ grid points (except where noted). The time step, based on stability, is $\Delta t = \min(4\epsilon, 0.4\Delta x/c)$. The wave speed $c = 1$, wave height $H_w = 1$, and water depth $H = 1$ are fixed. The wave width $L = 1/24$ is fixed except in the smoothing study. The factor $\sqrt{c/L} \approx 5$ in the expressions (Eq. 26) for the error convergence and we expect $\epsilon \ll 4.1 \times 10^{-2}$ to observe the asymptotic convergence rate.

A typical penalized solution is shown at time $t = 0.22$ in Fig. 3, when the wave is strongly interacting with the walls. This figure confirms the expected behaviour of the penalized solution near the walls: the velocity boundary condition has an error and internal boundary layer of size $O(\epsilon^{1/2})$, while the height perturbation does not penetrate into the solid.

In order to measure the effect of the penalization on the error of the global solution after reflection we measure the $L^\infty$ error at $t = 0.5$ when the exact solution should precisely reproduce the initial conditions. The prediction that the error should scale proportional to the porosity $\alpha$ if $\alpha$ and $\epsilon$ are independent and like $\alpha^{1/2}$ if $\epsilon = K/\alpha$ (as in a porous medium) is verified in Fig. 4. Note that the error at small $\alpha < 10^{-4}$ is effectively limited by the error of the underlying finite volume/finite difference numerical scheme, which is about $6 \times 10^{-5}$ for the exact boundary conditions at the resolution $N = 2400$.
<figure><img src="image_5.png" /></figure>

**Figure 3.** Solution at $t = 0.26$ just after the reflection when the wave is still interacting strongly with the wall (circles) compared with the exact solution (line). Parameter $\alpha = 10^{-3}$ and $K = 4 \times 10^{-6}$. The resolution $N = 300$ is low to clearly illustrate the internal boundary layer and the differences between the exact and penalized solution near the boundaries. Note the boundary layer in the penalized solid region for the velocity and the fact the height drops slightly inside the fluid due the smoothing of the porosity $\phi(x)$. The error in the velocity boundary condition is $0.03 \approx \epsilon^{1/2}$, as expected.

<figure><img src="image_6.png" /></figure>

**Figure 4.** Control of $L^\infty$ height penalization error by the porosity parameter $\alpha$ for the Gaussian wave test case compared with predicted scaling $\alpha$ (straight line) when $\epsilon = 10^{-3}$ is fixed, and with scaling $\alpha^{1/2}$ when $\epsilon = K/\alpha$ as in the porous medium equations. The permeability is fixed at $K = (4\Delta x)^2$ and the resolution is $N = 2400$. Note that at this resolution the error of the second-order finite volume method saturates at $7.7 \times 10^{-5}$. (The velocity results have exactly the same error as the height results.)

Figure 5 (left) confirms that the error scales like $K^{1/2}$ when $\epsilon = K/\alpha$. Finally, Fig. 5 (right) confirms that the error for this penalization scheme, with permeability $K = \Delta x^2$, is first-order accurate. Since we implement this penalization in a dynamically adaptive simulation, sufficient accuracy is achieved by refining the grid at the boundary (i.e. by $h$ refinement) and choosing $\alpha$ appropriately as explained in Sect. 4.3.

As mentioned in Sect. 3.2, Reckinger et al. (2012) assume that $\alpha$ and $\epsilon$ are formally independent. However, in practice they advise that $\epsilon$ should be smaller than $\alpha$, and choose $\epsilon/\alpha = 10^{-2}$ for their simulations. This restriction is not necessary in our case since the error is $O(\alpha \epsilon^{1/2})$. This means that $\alpha$ can be chosen smaller than $\epsilon$, as shown in Fig. 4. In fact, to ensure scaling of the error like $O(\epsilon^{1/2})$ when $\alpha$ is fixed, it is necessary to choose $\epsilon\alpha = K$ (constant) when the indicator function defining the solid region is smoothed. Although Reckinger et al. (2012) interpret Fig. 8 for $\alpha = \epsilon$ as

<figure><img src="image_7.png" /></figure>

**Figure 5.** Left: control of $L^\infty$ height penalization error by the permeability parameter $\epsilon$ for the Gaussian wave test case compared with predicted scaling $\epsilon^{1/2}$ (straight line). Right: convergence of $L^\infty$ error with grid size $\Delta x$ for the Gaussian wave test case compared with predicted first-order scaling (straight line). The porosity is fixed at $\alpha = 10^{-2}$. The resolution is $N = 2400$ for both results.

<figure><img src="image_8.png" /></figure>

**Figure 6.** Left: dependence of error on smoothing width for four different resolutions for a wave of size $L = 1/24$. Right: change in error compared to non-smoothed case as a function of the ratio of wave size $L$ to smoothing width $\Delta$.

showing a weaker error convergence $O(\alpha^{1/2})$, it actually appears to show the expected scaling $O(\alpha)$ but over a small range of $\alpha$ of about 1 decade.

Finally, we consider the effect of smoothing width $\Delta$ on the accuracy of the results. As explained above, to guarantee stability of the penalized solution it is often necessary to smooth the porosity $\phi(x)$ at the fluid-solid boundary in order to ensure stable results. Since this is a purely numerical problem it is best to choose the smallest width sufficient for stable solutions. Figure 6 (left) shows the error as a function of the number of grid points of smoothing for four different grid resolutions. The results are only weakly dependent on the smoothing width $\Delta$ for $\Delta < 6\Delta x$ and $\Delta = 2\Delta x$ is the minimum smoothing to ensure stability. Figure 6 (right) shows how the error depends on the ratio $L/\Delta$ (wave width to smoothing width). As expected, the error decreases roughly proportional to this ratio. We can therefore conclude that two to four points of smoothing should be optimal and that the penalization gives good results for well-resolved waves where $L/\Delta x \gg 1$.

## 4.3 Guidelines for choosing penalization parameters

The parameters $\epsilon$, $\alpha$, and $\Delta$ determining the penalization are chosen as follows.

The permeability parameter $\epsilon$ is set first, based on the spatial resolution of the simulation $\Delta x$ near the coastlines. As
explained in Sect. 4.1, the smallest permissible value for $\epsilon$ is $4\Delta x^2/cL$. However, the velocity penalization term is stiff, restricting the time step to $\Delta t \le C_1\epsilon$ (with $C_1$ an order one constant) for an explicit method. It is therefore often preferable to choose a larger $\epsilon$ so the penalization does not enforce an artificially small time step. For example, set $\epsilon = \Delta t = C_2\Delta x/c$ according to the Courant–Friedrichs–Lewy (CFL) stability condition for hyperbolic equations. Note that this is also the smallest permissible $\epsilon$ when the smallest wavefronts are only marginally resolved so $L \sim \Delta x$, where $\epsilon \ge 4\Delta x/c$. Using this choice of $\epsilon$, and in the least favourable case where the smallest wavefronts are only marginally resolved, the relative error in height is $O(\alpha)$ and the relative error in velocity is $O(\alpha H_w/H)$ independent of $\epsilon$ and $\Delta x$.

Now, since $\epsilon$ has been determined by the resolution of the simulation, the desired accuracy is controlled by setting the porosity $\alpha$. Recall that the choice of $\alpha$ does not affect the numerical stability of the simulation. Typically, $\alpha = O(10^{-3})$ is appropriate for a second-order accurate simulation. In a dynamically adaptive method like the one used here, $\alpha$ should be set about 10 times smaller than the tolerance $\epsilon$. Recall that the parameter $\epsilon$ also enforces the no-slip (i.e. tangential) velocity condition to a relative accuracy of $O(\epsilon^{1/2}\sqrt{u/l})$, where $u$ and $l$ are the velocity and length scales of the flow tangential to the boundary (Kevlahan and Ghidaglia, 2001).

The smoothing scale $\Delta$ of the indicator function $\chi(x)$ is set to smooth over a few grid points (e.g. two to four). The smoothing scaling should be much smaller than the scale $L$ of the smallest waves and also smaller than $\sqrt{Lc\epsilon}$.

These choices ensure the penalization is well resolved, produces sufficiently accurate results, and is consistent. When implemented in the adaptive wavelet method we must also ensure $\alpha$ is not too small, i.e. $\alpha > 7.5 \times 10^{-4}$, in order to avoid negative heights near the boundary due to the linear interpolation used in the wavelet transform.

In the following section we verify the results of the penalization analysis numerically using a dynamically adaptive second-order finite difference/finite volume scheme (Dubos and Kevlahan, 2013; Aechtner et al., 2014) on the sphere based on the TRiSK scheme (Ringler et al., 2010).

# 5 Applications to ocean simulation

The Coriolis force, which is omitted in the previous sections, is now included by adding the Coriolis parameter $f$ to the relative vorticity curl ($u$) in the curl-form equations of motion (Eq. 15).

## 5.1 Sensitivity of penalized solutions to piecewise-constant boundary approximation

In our penalized model of no-slip boundary conditions, coastline geometry is approximated as piecewise constant on the hexagonal–triangular C grid via the mask $\chi(x)$. Adcroft

and Marshall (1998) proposed a test to identify any spurious effects due to piecewise-constant boundary approximations. They calculated wind-driven $\beta$-plane flow in a square domain where the physical domain was rotated at various angles with respect to the Cartesian computational grid, with both no-slip and free-slip boundary conditions. The solution has the form of an intense western boundary current, a strong sub-gyre in the northwest corner and a standing Rossby wave along the northern boundary (see Fig. 7).

Adcroft and Marshall (1998) found that piecewise-constant boundary approximations exert a spurious form stress on the boundary currents, leading to significantly different results. The differences were greatest for free-slip boundary conditions, but still evident for no-slip boundary conditions (see their Fig. 4). The main differences at large angles of rotation ($\theta = 45^\circ$) are that the western boundary current separates earlier from the western boundary and the recirculating sub-gyre in the northwestern corner of the domain is much stronger.

In our case, although the boundary is defined via a mask function, the actual boundary condition is not strictly piecewise constant since the boundary is smoothed slightly due to both the exponential form of the penalization and the fact that the mask itself is smoothed over a few points. In addition, the hexagonal–triangular C grid is more symmetric than the Cartesian grid used in Adcroft and Marshall (1998). Nevertheless, it is interesting to see how large the effect of the boundary mask is on the solution.

We implement exactly the test case proposed in Adcroft and Marshall (1998): wind-driven flow on a $\beta$-plane in a square domain. The model parameters are basin size $L = 2000$ km, $f_0 = 0.7 \times 10^{-4} \text{s}^{-1}$, $\beta = 2 \times 10^{-11} \text{m}^{-1} \text{s}^{-1}$, kinematic viscosity $\nu = 500 \text{m}^2 \text{s}^{-1}$, linear friction coefficient $r = 10^{-7} \text{s}^{-1}$, density $\rho_0 = 10^3 \text{kg m}^{-3}$, reduced gravity $g' = 0.02 \text{m s}^{-2}$, and wind-stress $\tau_0 = 0.2 \text{N m}^{-2}$. The equilibrium layer thickness is $H = 500$ m. The wind-stress ($\tau(\tilde{y}) = -\tau_0 \cos(\pi \tilde{y}/L) \hat{i}$) and the Coriolis parameter ($f(\tilde{y}) = f_0 + \beta \tilde{y}$ where $(\tilde{x}, \tilde{y})$) are the physical coordinates which are rotated by an angle $\theta$ with respect to the computational model coordinates $(x, y)$. No-slip solid boundaries are located at $\tilde{x} = 0, L$ and $\tilde{y} = 0, L$.

The wind-driven flow is computed using the Matlab code described in Dubos and Kevlahan (2013), which solves the adaptive wavelet method on the plane for the TRiSK second-order finite volume/finite difference discretization of the shallow water equations Ringler et al. (2010). We set the grid adaptation tolerance $\epsilon = 0$, so the computation is non-adaptive with a uniform triangular grid size of 25.14 km. To allow for rotation of the physical domain the lozange-shaped computational domain has sides with length of 3420 km (Dubos and Kevlahan, 2013). The equations are non-dimensionalized with respect to $L$, $\rho_0$, and the Sverdrup velocity $U_{Sv} = \tau_0/(\rho_0\beta HL) = 0.01 \text{ m s}^{-1}$. In this non-dimensionalization the penalization parameters chosen are
<figure><img src="image_9.png" /><figcaption>Figure 7. Grid geometry sensitivity study of the penalized no-slip boundary for wind-driven ocean circulation in a square basin (Adcroft and Marshall, 1998). The four images show instantaneous layer depth after 10 years for four simulations where the physical domain is at various angles with respect to the discrete hexagonal-triangular computational grid.</figcaption></figure>

$\alpha = 10^{-2}$ and $\eta = 10^{-4}$. The mask $\chi(x)$ is smoothed over two grid points.

The equations are integrated from rest for 10 years using a third-order strong stability preserving Runge-Kutta method with a CFL number of 0.8 (Spiteri and Ruuth, 2002). Note that Adcroft and Marshall (1998) deliberately specify a grid resolution such that the Munk layer is barely resolved (only $\delta_M = 1.16\Delta x$) to emphasize any spurious effects of the boundary conditions.

Figure 7 shows the instantaneous layer thickness after 10 years where the physical flow and domain is at the angles $\theta = 0, 10, 30$, and $45^\circ$ with respect to the computational hexagonal-triangular C-grid. All four figures are very similar qualitatively and quantitatively. There are some slight qualitative differences discernible in the internal structure of the standing Rossby wave southeast of the intense sub-gyre. There is also very small variation in the maximum height of the layer: $h_{max} = 724.8$ m at $\theta = 0^\circ$, $h_{max} = 723.4$ m at $\theta = 10^\circ$, $h_{max} = 722.1$ m at $\theta = 30^\circ$, and $h_{max} = 728.7$ m at $\theta = 45^\circ$. The biggest variation in maximum height is 1.7% of the perturbation in layer depth (or 0.78% of the total layer depth), which is negligible given the long integration time and second-order discretization. These qualitative and quantitative differences are insignificant compared with those observed in Adcroft and Marshall (1998), where the sub-gyre was clearly displaced to the southeast and the maximum height was at least 160 m higher at $\theta = 45^\circ$ than at $\theta = 0^\circ$.

We therefore conclude that our Brinkman penalization method is not sensitive to the orientation of solid boundaries with respect to the computational hexagonal-triangular C grids of interest on the sphere.

## 5.2 Implementation of penalization in an adaptive wavelet solver on the sphere

Penalization techniques are especially well suited to dynamically adaptive numerical simulations, where the local resolution changes in time to resolve the solution. In particular, in ocean flows we expect the resolution to be finer near coastlines in order to resolve boundary currents (e.g. wind-driven gyres in the quasi-geostrophic regime) or wave interaction with the coast (e.g. tsunami propagation in the inertia gravity wave regime). Ocean flow is well suited to variable resolution adaptive numerical methods since about 25% of the surface of the Earth is land (which thus requires no resolution) and the ocean flows are highly inhomogeneous and variable in both time and space.

An explicit definition of the coastline is difficult to implement in adaptive simulations because the precise location of the coastline changes as the grid refines and coarsens. On the other hand, it is computationally inefficient to resolve the coastline to the finest resolution at all locations and at all times. Defining the coastline as a mask means that the coastline is defined implicitly and automatically becomes more detailed as the grid is refined to follow the local flow dynamics. In addition, smoothing the profile of the coastline over a few grid points arguably produces a better physical model than a sharp boundary (since coastlines are in fact porous). The multiscale and staggered structure of the adaptive wavelet scheme also causes problems for an explicit definition of the coastline since the hexagonal cells containing the height are shifted between adjacent scales of resolution (see Dubos and Kevlahan, 2013; Aechtner et al., 2014).

Finally, as mentioned in the previous section, grid refinement near the coastlines increases the local accuracy of the penalization through $h$ refinement compensating for its relatively low order of accuracy.

The penalization defined by the variables porosity (Eq. 18) and friction (Eq. 19) is easily integrated into the dynamically adaptive second-order finite difference/finite volume scheme on the sphere presented in Dubos and Kevlahan (2013) and Aechtner et al. (2014) since it requires only straightforward modifications of the shallow water equations. The bathymetry and topographic data are from the 1 arcmin NOAA ETOPO1 global relief database (Amante and Eakins, 2009).

The raw bathymetry data from the ETOPO1 database naturally tends to zero depth near the coast. Because we have not implemented wetting and drying in our shallow water model, we impose a minimum depth $H_{min}$ near the coastlines:

$$b = \begin{cases} b_r & b_r \le -H_{min}, \\ -H_{min} & -H_{min} < b_r < 0, \\ 0 & \text{otherwise.} \end{cases} \quad (32)$$

In practice, $H_{min} > 2$ m is usually sufficient.

The mask $\chi(x)$ defining the solid and fluid regions is found by setting locations with negative bathymetry to zero and re-
gions with positive (or zero) bathymetry to one,

$$ \chi = \begin{cases} 0, & b_r < 0, \\ 1, & \text{otherwise.} \end{cases} \qquad (33) $$

This generates a mask on the regular 1 arcmin latitude–longitude ETOPO 1 grid, which does not correspond to the non-uniform dual hexagonal–triangular grids used in the adaptive scheme. The value of the mask at required points on the hexagonal–triangular grid are found by using a simple exponential radial basis function (RBF) with weights $f(x; a) = \exp(-(ar)^2)$ where r is the arc distance between the ETOPO 1 mask and the location of the required grid point. The parameter a is chosen to smooth over an area equivalent to two to four hexagonal cells. This RBF procedure both interpolates from the latitude–longitude grid to the adaptive grid nodes and smooths the resulting mask. The RBF procedure can also be used to smooth the bathymetry data in the fluid part of the domain, although this is not usually necessary. Currently, all points are smoothed although the method could be optimized by smoothing only those points in a small neighbourhood of a coastline.

During grid refinement the bathymetry is computed at the new grid-points using the RBF interpolation described above. The adaptive wavelet method exactly conserves the mass of the perturbed free surface with respect to the mean sea level. However, the RBF procedure for interpolating bathymetry on a locally refined grid does not conserve the total mass of mean sea level since the newly interpolated points could modify the mean sea level over the refined cell. However, this mass defect is extremely small (approximately roundoff error). The mass defect caused by changes in the bathymetry cannot accumulate and is bounded at all times. If the grid coarsens again to its initial configuration, the mass defect is precisely zero. If exact cell-wise mass conservation of the mean sea level is necessary, the bathymetry data could be stored as a wavelet transform such that the mean is conserved at all levels of resolution.

In the following sections the adaptive wavelet method for the shallow water equations with penalization is used to solve two characteristic ocean flows: tsunami propagation (i.e. the inertia gravity wave regime with fast dynamics) and wind-driven gyre flow (i.e. the quasi-geostrophic regime with slow dynamics). The goal of these simulations is to demonstrate the potential of this method for efficient simulation of global flows with localized small-scale features. It should be stressed that different degrees of physical accuracy are to be expected in each case due to the approximations inherent in the shallow water model. On the one hand, the shallow water equations model tsunami propagation quite accurately, so that a realistic tsunami simulation is expected. However, the shallow water equations are quite insufficient to model the general circulation of the oceans. Only the mean gyre circulation, driven by the wind stress and Sverdrup balance, which is acceptably represented in a one-layer model, can be captured realistically. Smaller-scale features, such as vortices

and jet meandering, are predominantly generated in the real ocean by baroclinic mechanisms which cannot be captured by a single-layer model. Their main characteristics are not expected to be realistic. Rather, the capacity of the adaptive model to produce, say, boundary currents should be analysed as a qualitative demonstration of the potential of the method, rather than evaluated quantitatively for its accuracy.

## 5.3 Tsunami propagation

Our first example illustrates how the penalization, combined with the dynamically adaptive wavelet method (Aechtner et al., 2014), performs for global calculation of tsunami wave propagation. In the absence of a treatment of wetting and drying at the shoreline, important aspects of the tsunami, especially in terms of its impacts, cannot be simulated. Nevertheless the propagation of the wave should be properly captured, especially wave refraction by the bathymetry, as well as arrival times and wave amplitude before breaking and flooding.

The flow is clearly in the inertia gravity wave regime and the dynamics are fast. Since the solution is very localized, the dynamical adaptation is particularly effective, allowing for local resolutions of up to 0.5 km on a global model. This inertia–gravity regime is a good test of the accuracy of the penalized approximation of the reflecting boundary conditions for height since reflection off coastlines and islands is an essential component of tsunami dynamics. Note that because of the sensitivity of the results on the precise choice of initial condition, bathymetry, and coastline geometry a precise measure of the error is not possible, although the results are qualitatively in good agreement with the observations and other simulations.

We simulate the 2004 tsunami generated by the Sumatra–Andaman earthquake. The initial condition is based on the seismic data calculated by Fujii and Satake (2007) from available tide gauge and satellite altimetry data. This initial condition is given in the form of complete seismic data on 22 separate square geographic regions, as shown in Fig. 4 of Fujii and Satake (2007). These 22 separate sets of seismic data are used to find the perturbed surface height using the Okada (1985) method with Matlab software written by Beauducel (2012). (Note that each of the 22 regions provides a separate sea surface height perturbation.) The initial velocity is taken to be zero.

The degree of mesh refinement is controlled by an overall non-dimensional tolerance $\epsilon$ (not to be confused with the relaxation time $\epsilon$ of the penalization), from which thresholds for height and velocity are deduced (Dubos and Kevlahan, 2013). The simulation was run with an overall tolerance of $\epsilon = 0.05$, and the thresholds for height and velocity were $\epsilon_h = H_{max}\epsilon^{3/2}$ and $\epsilon_u = H_{max}g/c\epsilon^{3/2}$ where $H_{max}$ is the maximum height perturbation at any given time step. This allows the adaptation to accurately track the waves even though after several hours their characteristic height $H_{max}$ is only 10% of its initial value. This modification is important
<figure><img src="image_10.png" /><figcaption>**Figure 8.** First arrival time (of a wave with height at least 5 cm) and maximum wave height for simulation of the 2004 Indonesian tsunami.</figcaption></figure>

<figure><img src="image_11.png" /><figcaption>**Figure 9.** Tsunami after 70 min. The grid compression ratio is 930 and the finest $J = 14$ resolution is required only near the coasts where the tsunami has hit and very locally in the propagating wavefront. The black boxes indicate the zoomed regions shown in Fig. 10</figcaption></figure>

<figure><img src="image_12.png" /><figcaption>**Figure 10.** Tsunami: approximately 650 km × 550 km zoom of grid (left) and height (right) for results shown in Fig. 9. Recall that in the left figure the black hexagons have the size of approximately 0.5 km.</figcaption></figure>

for cases where the flow field is not statistically stationary in time. Note that we have deliberately chosen a relatively high tolerance value to demonstrate that the code can provide qualitatively good results even for grid compression ratios of $O(10^3)$.

The coarsest level is $J = 9$ with five levels of refinement to give a maximum scale of $J = 14$ corresponding to a minimum average resolution of about $\langle \Delta x_{\min} \rangle = 475$ m. Note that a non-adaptive simulation at this resolution would require about $2.68 \times 10^9$ height nodes (hexagonal cells), while the initial condition requires only about $3.09 \times 10^6$ height nodes in the adaptive simulation corresponding to a grid compression ratio of 867.

The penalization parameters are $\alpha = 8 \times 10^{-3}$ and $\eta = 5 \times 10^{-5}$ and the minimum bathymetry depth is $H_{\min} = 50$ m. The adaptive wavelet code was run on 256 cores on the SciNet GPC (General Purpose Cluster) parallel computer.

The first arrival time of a 5 cm wave and the maximum wave height over all times up to 16 h at all positions are shown in Fig. 8. The maximum wave height results show the focusing effect of bathymetry features (particularly the Southwest Indian Ridge) and agree qualitatively with both observations and simulations using the MOST (Method of Splitting Tsunami) model (Titov et al., 2005). Detailed quantitative verification is not possible due to sensitive dependence of the results on details of the initial conditions, bathymetry and coastline modelling (including run-up, not included in this model).

The ability of the code to track an evolving localized tsunami wave over long times and through reflection and focusing events is illustrated in Figs. 9, 11, and 12. The actual tolerances are scaled dynamically to take into account the decreasing maximum wave height over time. Note that the finest $J = 14$ (475 m) resolution is only needed very locally along some parts of the coastline and where the wavefront is very steep or focusing. Figure 10 uses a zoomed view to show precisely where the finest resolution is required in the interior of a focusing wave packet. As mentioned above, we have deliberately chosen a relatively large tolerance since we
<figure><img src="image_13.png" /><figcaption>**Figure 11.** Tsunami: adaptive grid and wave height after 4 h. The grid compression ratio is 740.</figcaption></figure>

<figure><img src="image_14.png" /><figcaption>**Figure 12.** Tsunami: adaptive grid and wave height after 16 h. The grid compression ratio is 455.</figcaption></figure>

are interested in the propagation of the wavefront (and to illustrate the extreme adaptivity potential of the method). If we were interested in accurate simulation of the entire wavefront (e.g. the residual wave motion shown in Fig. 12 at 16 h) we could select a smaller tolerance.

This simulation has demonstrated the potential of the dynamically adaptive wavelet method with penalization for high resolution simulation of tsunami propagation. Local resolutions of less than 500 m have been achieved on a global model with modest consumptions of computational resources: the simulation until the arrival at the African coast requires only 2–3 days on 256 cores of a computing cluster. Because of the localization of the wavefronts, tsunami propagation is particularly well suited to adaptive simulation.

The plot of the grid compression ratio shown in Fig. 13 shows that the code achieves very high grid compression ratios, ranging from 936 at 40 min to 400 at 16 h when the wave has entered the Atlantic Ocean. The average grid compression ratio is 558. Note that Aechtner et al. (2014) found that CPU time is proportional to the number of active grid points. When all potential degrees of freedom are included (height and velocity nodes) the grid compression ratio varies from 1240 to 455. Since Aechtner et al. (2014) found that

<figure><img src="image_15.png" /><figcaption>**Figure 13.** Grid compression ratio for tsunami simulation counting height nodes only and all degrees of freedom (i.e. height and velocity nodes).</figcaption></figure>

the adaptive wavelet code is about 3 times slower per active height node than the non-adaptive TRiSK code, we expect the tsunami simulation to be between 130 and 300 times faster than the non-adaptive code for a $J = 14$ resolution. Compared to a similar spectral code the adaptive simulation should be about 248–91 times faster.

As mentioned above, the code is run on the SciNet GPC machine, which uses Intel Xeon E5540 processors connected with Infiniband DDR and QDR networks. In terms of actual CPU time, it takes on average 8.6 s of wall clock time for 1 s of physical time at 475 m resolution on 256 cores for the first 7 h (until the tsunami reaches the coast of Africa). During this initial time the average number of height nodes is $3.4235 \times 10^6$, the average time step is 1.1710 s and the average CPU time per time step is 10.1 s. For the entire 16 h there are, on average, $4.8059 \times 10^6$ active height nodes, a time step of 1.1490 s and a CPU time per time step of 12.8 s, leading to 11.1 s of wall clock time for 1 s of physics time. Note that, as shown in Aechtner et al. (2014), the CPU timescales proportionally to the number of active grid points, which increases steadily as the tsunami spreads across the globe.

If necessary, the CPU time per time step could be improved easily by using a time integration scheme with fewer trend evaluations per time step (the RK34 scheme requires four). A more substantial improvement could be found by using a more efficient technique for calculating the bathymetry and topography masks, such as the very efficient multi-scale method proposed by Popinet (2011).

Since we find that the code has 94 % strong parallel scaling efficiency when passing from 128 to 256 cores, operational forecasting should be possible using a few thousand cores. However, Aechtner et al. (2014) found that weak parallel scaling efficiency drops to about 70 % on 640 cores when
<table><caption>**Table 1.** Physical parameters used for the reduced gravity simulation of wind-driven ocean circulation.</caption><thead><tr><th colspan="3">Non-dimensional parameters of boundary layer determining simulation</th></tr></thead><tbody><tr><td>Reynolds number</td><td>Re</td><td>10<sup>4</sup></td></tr><tr><td>Froude number of boundary layer</td><td>Fr<sub>BC</sub></td><td>0.3</td></tr><tr><td>Non-dimensional boundary layer width</td><td>δ<sub>M</sub><sup>*</sup></td><td>0.0125</td></tr><tr><th colspan="3">Unconstrained parameters</th></tr><tr><td>Radius of Earth</td><td>R</td><td>6.3710 × 10<sup>6</sup> m</td></tr><tr><td>Reference length scale (radius of North Atlantic)</td><td>L</td><td>3.0000 × 10<sup>6</sup> m</td></tr><tr><td>Mean ocean depth</td><td>H</td><td>3.5729 × 10<sup>3</sup> m</td></tr><tr><td>Velocity of boundary layer</td><td>U<sub>BC</sub></td><td>1.8000 × 10<sup>0</sup> m s<sup>-1</sup></td></tr><tr><td>Rotation rate</td><td>Ω</td><td>5.7664 × 10<sup>-7</sup> s<sup>-1</sup></td></tr><tr><td>Wind stress</td><td>τ</td><td>7.1592 × 10<sup>-2</sup> N m<sup>-2</sup></td></tr><tr><td>Density</td><td>ρ</td><td>1.0270 × 10<sup>3</sup> kg m<sup>-3</sup></td></tr><tr><th colspan="3">Quantities determined by above choices</th></tr><tr><td>Boundary layer width</td><td>δ<sub>M</sub> = δ<sub>M</sub><sup>*</sup> L</td><td>3.7500 × 10<sup>4</sup> m</td></tr><tr><td>Kinematic viscosity</td><td>ν = U<sub>BC</sub>δ<sub>M</sub>/Re</td><td>6.7500 × 10<sup>0</sup> m<sup>-1</sup> s<sup>-1</sup></td></tr><tr><td>Effective β parameter</td><td>β = ν/δ<sub>M</sub><sup>3</sup></td><td>1.2800 × 10<sup>-13</sup> m<sup>-1</sup> s<sup>-1</sup></td></tr><tr><td>Sverdrup (gyre) velocity</td><td>U<sub>Sv</sub> ~ <sup>τ</sup>/<sub>βHL</sub>ρ</td><td>5.2875 × 10<sup>-2</sup> m s<sup>-1</sup></td></tr><tr><td>Wave speed</td><td>c = U<sub>BC</sub>/Fr<sub>BC</sub></td><td>6.0000 × 10<sup>0</sup> m s<sup>-1</sup></td></tr><tr><td>Gravitational acceleration</td><td>g = c<sup>2</sup>/H</td><td>1.0076 × 10<sup>-2</sup> m s<sup>-2</sup></td></tr><tr><td>Coriolis parameter</td><td>f ~ Ω</td><td>5.7664 × 10<sup>-7</sup> s<sup>-1</sup></td></tr><tr><td>Rossby radius of deformation</td><td>R<sub>d</sub> = c/f</td><td>1.0405 × 10<sup>7</sup> m</td></tr><tr><td>Rossby number</td><td>Ro = U<sub>Sv</sub>/(Lf)</td><td>3.0565 × 10<sup>-2</sup></td></tr></tbody></table>

there are only 1344 grid points per core. Therefore, efficient implementation on more than $O(10^3)$ cores will likely not be possible without adding vertical levels due to load balancing issues for highly inhomogeneous problems like tsunami propagation.

Popinet (2011) presented a test case of his quadtree adaptive code for the same Sumatra-Andaman earthquake initial conditions, but on a small local domain centred on 94° E, 8° N and extending over 54° in both longitude and latitude (about 2.6% of Earth's surface) with a finest resolution of about 1.5 km. He found an average grid compression ratio of about 50 but did not present any other metrics of computational efficiency. However, he did note that previous analysis had shown that the overhead due to adaptivity was about 5–10 times more compared with running the same simulation on a non-adaptive grid (recall that our method has an overhead of about 3 times more).

## 5.4 Wind-driven ocean circulation

The second simulation is of global wind-driven ocean circulation over several years. This tests the adaptive wavelet model with Brinkman penalization in the quasi-geostrophic regime for slow dynamics. Our goal is to qualitatively predict the structure of the main ocean gyre flows, within the limits of the rotating shallow water equation model. In this case large basin-scale circulation is driven by the applied

wind stress forcing via the Sverdrup relation. Intense boundary currents are expected to form along western coastlines (e.g. the Gulf Stream). The shallow water equations are modified by adding a wind-stress forcing term $τ/(ρh)$ to the right hand side of the equation.

As for the tsunami case, the bathymetry and topographic data are from the 1 arcmin NOAA ETOPO1 global relief data base (Amante and Eakins, 2009). The wind stresses $τ(x, y)$ are stationary in time and derived from the mean December wind stresses from the NCAR Hellerman and Rosenstein Global Wind Stress Data (Hellerman and Rosenstein, 1980, 1983) shown in Fig. 14. This data set consists of monthly averaged wind stress over the global ocean for the years 1870 through 1976 on a 2° latitude-longitude grid. The wind stress data is evaluated on the adapted grid using bilinear interpolation.

The numerical experiment is characterized by a few independent dimensional parameters: $τ/ρ$ with $τ$ the mean wind stress and $ρ$ the density of water, the planetary rotation rate $Ω \sim f$ and radius $R$, the basin scale $L \sim R$, the mean ocean depth $H$, gravity $g$, the Reynolds number $Re$, the width of the boundary layer $δ_M$, and the Froude number of the boundary layer $Fr_{BC}$. Once these are defined, a few other scales emerge following Sverdrup balance in the ocean interior and balance between viscous friction and meridional transport of planetary vorticity in the western boundary current. The kinematic
<figure><img src="image_16.png" /><figcaption>Figure 14. December wind stress field from Hellerman and Rosenstein (1980, 1983) used to force wind-driven ocean circulation shown in Fig. 15. Only every other wind stress data point is shown. The rms (root mean square) wind stress is 7.1592 × 10⁻² N m⁻².</figcaption></figure>

viscosity is therefore $v = U_{BC}\delta_M/Re$, and $\beta = v/\delta_M^3$. The gyre velocity $U_{Sv}$ set by Sverdrup balance is

$$U_{Sv} \sim \frac{1}{\beta HL} \frac{\tau}{\rho}. \qquad (34)$$

The gyre is characterized by its Rossby number $Ro = U_{Sv}/fL$, which should be small.

The dimensional and non-dimensional parameters are fully summarized in Table 1. Given the limitations of the shallow water model, we have sacrificed the realism of some of the dimensional parameters, while preserving the main scales of the gyres and boundary currents. We retain realistic values of $R, L, H, U_{BC}$, and $U_{Sv}$. On the other hand we choose unrealistic values for gravity $g$ and planetary rotation $\Omega$, and $\beta$. Indeed, a large gravity wave speed $c$ imposes small explicit time steps, which make the simulation very costly without affecting the gyre and boundary current. Since we do not currently use a local time-stepping scheme, the (global) time step is set by the smallest grid size over the whole computational domain. Hence, we sacrifice the realism of $c$ and reduce it to a minimum, i.e. $Fr_{BC}$ is set as large as possible without producing shocks. This defines $c = U_{BC}/Fr_{BC}$ and $g = c^2/H$. The Reynolds number is set moderately large to permit barotropic instability and the generation of vortices.

The wavelet simulation uses a tolerance of $\epsilon = 1.0$, and the thresholds for height and velocity are $\epsilon_h = U_{Sv}RoR/g\epsilon^{3/2}$ and $\epsilon_u = U_{Sv}Ro\epsilon^{3/2}$. The coarsest level is $J = 12$ with three levels of refinement to give a maximum level of $J = 12$ and a minimum average resolution of about $\Delta x_{min} = 1.9$km or $1/64^\circ$. The penalization parameters are $\alpha = 10^{-2}$ and $\eta = 10^{-4}$. The minimum bathymetry depth is limited to $H_{min} = 50$ m. The initial conditions are zero velocity and zero sea surface height perturbation. The adaptive wavelet code was run on 256 cores on the SciNet supercomputer.

The mean ocean circulation consists of basin-scale gyres driven by the wind stress via Sverdrup balance. The rigid-wall boundary condition induces narrow and intense western boundary currents dominated by advection of planetary

<figure><img src="image_17.png" /><figcaption>Figure 15. Adapted grid (left) and relative vorticity field (right) for wind-driven ocean circulation after 301 days. Note vortex shedding from the boundary current off Argentina and in Drake's Passage.</figcaption></figure>

velocity and friction. This case is therefore a good test for the penalized velocity boundary conditions. We stress again, however, that the mechanism generating meanders and vortices from the gyre circulation and the boundary currents in the shallow water equations is purely barotropic. Except perhaps close to coastlines and at a kilometre scale, a different baroclinic mechanism is believed to be dominant in the oceans at mesoscale and sub-mesoscale but cannot be captured in a one-layer shallow water model.

Figure 15 shows the vorticity after 301 days. The grid is refined only at the boundary currents and the grid compression ratio for height nodes is roughly constant at about 210 once the boundary currents have developed (after about 1 week). Coherent vortex shedding, similar to von Karman vortex streets, is clearly visible at some high wind stress locations, such as the Drake Passage and southern coast of Argentina shown in Fig. 15. The zoom of the unstable boundary layer region off southern Argentina shown in Fig. 16 illustrates the complex structure of the boundary current and multiple small-scale vortices. Note that the details of the boundary current are well captured by the adaptive grid.

Figure 17 shows the eastern coast of North America, including the area where the Gulf Stream is generated off Cape Hatteras. Intense western boundary currents and some vortices are clearly visible. The boundary current detaches north of Cape Hatteras, as for the Gulf Stream, although it subsequently stays closer to the coast than the Gulf Stream. However, as noted above, we do not expect to accurately model the dynamics and structure of the Gulf Stream since the shallow water equations used here do not capture the necessary baroclinic mechanisms of vortex generation.

Higher resolutions and Reynolds numbers would lead to more complex two-dimensional turbulence like dynamics (with physics different from the actual flow due to the shallow water approximation). Despite the limitations of the experimental set-up, these results give an indication of the potential performance of a multi-layer model and the ability of
<figure><img src="image_18.png" /><figcaption>**Figure 16.** Zoom of vortex shedding dynamics off the southern coast of Argentina shown in Fig. 15: grid (left) and relativity vorticity (right). The scales are as in Fig. 15. Note the complex boundary layer structure and vortices captured by the adaptive grid.</figcaption></figure>

<figure><img src="image_19.png" /><figcaption>**Figure 17.** Adapted grid (left) and relative vorticity (right) for wind-driven circulation near the east coast of North America, corresponding to the location of the Gulf Stream. The scales are as in Fig. 15. Intense western boundary currents and some vortices are clearly visible.</figcaption></figure>

the method to capture boundary currents and their complex vortical structure.

# 6 Conclusions

We have derived and analysed mathematically a new volume penalization for no-slip boundary conditions for the shallow water equations. This penalization is based on the physical equations for shallow water flow in a porous medium with vanishing porosity and permeability in that part of the do-

main corresponding to solid regions. Mathematical analysis of the linearized one-dimensional shallow water equations shows that the solution of the penalized equations converges to exact solution in the limit as porosity $\alpha$ and permeability $\eta$ tend to zero. The error at finite $\alpha$ and $\eta$ is $O(\alpha\eta^{1/2})$. Unlike previous penalizations of the shallow water equation, it conserves mass and energy and the wave speed is the same in both fluid and solid regions. The convergence and error properties of the method have been verified numerically for the one-dimensional linearized equations.

The primary motivation for developing this new penalization is to extend our recent dynamically adaptive wavelet method on the sphere (Dubos and Kevlahan, 2013; Aechtner et al., 2014) to model ocean flows with coastlines. Penalization techniques are ideal for dynamically adaptive methods because they implement the coastline geometry implicitly by modifying the equations of motion rather than by explicitly changing the geometry of the computation. The resolution of the coastline is high only where required by the flow dynamics.

We have implemented the proposed penalization in the adaptive wavelet code and tested it on two typical global-scale flows: long-distance tsunami propagation (i.e. the inertia-gravity wave regime with fast dynamics) and wind-driven ocean circulation (i.e. the quasi-geostrophic regime with slow dynamics). These simulations show the potential of the adaptive method combined with the penalization to drastically reduce the number of computational elements. The adaptive tsunami simulation uses between 455 and 1245 times fewer computational elements (i.e. height nodes) than an equivalent non-adaptive simulation, while the wind-driven ocean circulation simulation uses around 210 times fewer elements.

Although the shallow water equations are considered quite accurate for tsunami calculations (and are used in many operational models) they are clearly physically insufficient for calculating ocean circulation. The next step in the development of the adaptive wavelet model for ocean circulation is to add vertical layers and temperature and density equations. The grid adaptation will only be done in the horizontal plane, so the three-dimensional model should actually have better parallel performance than the model on the sphere since the computational load will be better balanced for large numbers of processors $O(10^4 - 10^5)$. We expect to also use penalization to model bathymetry, as well as coastlines, in the three-dimensional model, following Reckinger et al. (2012).

The penalization method presented here should aid in the development of fully dynamically adaptive ocean global models for tsunami propagation and ocean circulation.

## Code availability

The complete adaptive wavelet code used to generate the results in this paper is available at bitbucket.org/kevlahan/wavetrisk.
*Acknowledgements.* This research was enabled in part by support provided by a Resource Allocation Grant from Compute Canada/Calcul Canada (www.computecanada.ca). Computations were performed on the supercomputer at the SciNet HPC Consortium. SciNet is funded by the Canada Foundation for Innovation under the auspices of Compute Canada, the Government of Ontario, Ontario Research Fund-Research Excellence, and the University of Toronto. N. K.-R. Kevlahan would like to acknowledge to support of an NSERC Discovery Grant, a Mobility Grant from the French Embassy in Ottawa and a visiting professorship at École Polytechnique. M. Aechtner acknowledges the support of a Mobility Grant from École Polytechnique.

Edited by: R. Marsh

## References

Adcroft, A. and Marshall, D.: How slippery are piecewise-constant coastlines in numerical ocean models?, Tellus, 50A, 95–108, 1998.

Adcroft, A., Hill, C., and Marshall, J.: Representation of Topography by Shaved Cells in a Height Coordinate Ocean Model, Mon. Weather Rev., 125, 2293–2315, doi:10.1175/1520-0493(1997)125<0527:TRDOEM>2.0.CO;2, 1997.

Aechtner, M., Kevlahan, N.-R., and Dubos, T.: A conservative adaptive wavelet method for the shallow water equations on the sphere, Q. J. Roy. Meteor. Soc., 690, 1712–1726, doi:10.1002/qj.2473, 2014.

Almgren, A. S., Bell, J. B., Colella, P., and Marthaler, T.: A Cartesian Grid Projection Method for the Incompressible Euler Equations in Complex Geometries, SIAM J. Sci. Comp., 18, 1289–1309, 1997.

Amante, C. and Eakins, B.: ETOPO1 1 Arc-Minute Global Relief Model: Procedures, Data Source. Anal., http://www.ngdc.noaa.gov/mgg/global/global.html (last access: 1 September 2013), doi:10.7289/V5C8276M, 2009.

Angot, P., Bruneau, C.-H., and Fabrie, P.: A penalization method to take into account obstacles in viscous flows, Num. Math., 81, 497–520, 1999.

Arquis, E. and Caltagirone, J. P.: Sur les conditions hydrodynamiques au voisinage d'une interface milieu fluide – milieu poreux : application à la convection naturelle, C. R. Acad. Sci. Paris II, 299, 1–4, 1984.

Audusse, E., Bouchut, F., Bristeau, M.-O., Klein, R., and Perthame, B.: A Fast and Stable Well-Balanced Scheme with Hydrostatic Reconstruction for Shallow Water Flows, SIAM J. Sci. Comp., 25, 2050–2065, doi:10.1137/s1064827503431090, 2004.

Beauducel, F.: Okada source software: Institut de Physique du Globe de Paris, http://www.ipgp.fr/~beaudu/matlab.html (last access: 30 August 2012), 2012.

Berger, M. J., Calhoun, D. A., Helzel, C., and Leveque, R. J.: Logically rectangular finite volume methods with adaptive refinement on the sphere, Phil. Trans. Roy. Soc. Lond. A, 367, 4483–4496, doi:10.1098/rsta.2009.0168, 2009.

Berger, M. J., George, D. L., LeVeque, R. J., and Mandli, K. T.: The GeoClaw software for depth-averaged flows with adaptive refinement, Adv. Water Resour., 34, 1195–1206, doi:10.1016/j.adwatres.2011.02.016, 2011.

Dubos, T. and Kevlahan, N.-R.: A conservative adaptive wavelet method for the shallow water equations on staggered grids, Q. J. Roy. Meteor. Soc., 139, 1997–2020, 2013.

Fujii, Y. and Satake, K.: Tsunami Source of the 2004 Sumatra–Andaman Earthquake Inferred from Tide Gauge and Satellite Data, Bull. Seismol. Soc. America, 97, S192–S207, 2007.

Guinot, V. and Soares-Frazao, S.: Flux and source term discretization in two-dimensional shallow water models with porosity on unstructured grids, Int. J. Numer. Meth. Fluids, 50, 309–345, doi:10.1002/fld.1059, 2006.

Gustafsson, B., Kreiss, H.-O., and Sundström, A.: Stability theory of difference approximations for mixed initial boundary value problems. II., Math. Comput., 26, 649–686, 1972.

Harig, S., Chaeroni, Pranowo, W., and Behrens, J.: Tsunami simulations on several scales, Ocean Dynam., 58, 429–440, doi:10.1007/s10236-008-0162-5, 2008.

Hellerman, S. and Rosenberg, M.: Global Ocean Wind Stress, climatology, http://rda.ucar.edu/datasets/ds232.0/ (last access: 25 May 2014), 1980.

Hellerman, S. and Rosenberg, M.: Normal monthly wind stress over the world ocean with error estimates, J. Phys. Oceanogr., 13, 1093–1104, 1983.

Hervouet, J.-M.: Hydrodynamics of Free Surface Flows – modelling with the finite element method, John Wiley & Sons Ltd, Chichester, UK, 50–53, 2007.

Holm, D., Marsden, J., and Ratiu, T.: The Euler–Poincaré equations in geophysical fluid dynamics, in: Proceedings of the Isaac Newton institute programme on the mathematics of atmospheric and ocean dynamics, p. 42, University Press, Cambridge University Press Cambridge, UK, 2002.

Kevlahan, N. and Ghidaglia, J.-M.: Computation of turbulent flow past an array of cylinders using a spectral method with Brinkman penalization, Eur. J. Mech. B, 20, 333–350, 2001.

Kevlahan, N. and Vasilyev, O.: An adaptive wavelet collocation method for fluid–structure interaction at high Reynolds numbers, SIAM J. Sci. Comput., 26, 1894–1915, 2005.

Kevlahan, N. K.-R. and Wadsley, J.: Suppression of three-dimensional flow instabilities in tube bundles, J. Fluids Struc., 20, 611–620, 2005.

Kevlahan, N. K.-R., Vasilyev, O. V., and Cherhabili, A.: An adaptive wavelet method for turbulence in complex geometries, in: 16th Imacs World Congress 2000, Proceedings, Lausanne, 21–25 August 2000, edited by: Deville, M. and Owens, R., vol. 411-39, IMACS, 2000.

Kolomenskiy, D. and Schneider, K.: A Fourier spectral method for the Navier-Stokes equations with volume penalization for moving solid obstacles, J. Comput. Physics, 228, 5687–5709, 2009.

Liu, Q. and Vasilyev, O. V.: A Brinkman penalization method for compressible flows in complex geometries, J. Comput. Physics, 227, 946–966, 2007.

Okada, Y.: Surface deformation due to shear and tensile faults in a half-space, Bull. Seism. Soc. Amer., 75, 1135–1154, 1985.

Paccou, A., Chiavassa, G., Liandrat, J., and Schneider, K.: A penalization method applied to the wave equation, Compt. Rend. Mec., 333, 79–85, 2005.

Perret, G., Farge, M., Stegner, A., Azzalini, A., and Schneider, K.: The effect of rotation on a shallow water flow past a cylinder: Comparison between numerical and laboratory experiments, in: APS Division of Fluid Dynamics Meeting Abstracts, p. F3, 2003.
Popinet, S.: Quadtree-adaptive tsunami modelling, Ocean Dynam., 61, 1261–1285, doi:10.1007/s10236-011-0438-z, 2011.

Popinet, S. and Rickard, G.: A tree-based solver for adaptive ocean modelling, Ocean Model., 16, 224–249, doi:10.1016/j.ocemod.2006.10.002, 2007.

Reckinger, S., Vasilyev, O., and Fox-Kemper, B.: Adaptive volume penalization for ocean modeling, Ocean Dynam., 62, 1201–1215, doi:10.1007/s10236-012-0555-3, 2012.

Ringler, T. D., Thuburn, J., Klemp, J. B., and Skamarock, W. C.: A unified approach to energy conservation and potential vorticity dynamics for arbitrarily-structured C-grids, J. Comput. Phys., 229, 3065–3090, doi:10.1016/j.jcp.2009.12.007, 2010.

Schneider, K. and Farge, M.: Adaptive wavelet simulation of a flow around an impulsively started cylinder using penalisation, Com-put. Harm. Anal., 12, 374–380, 2002.

Shirokoff, D. and Nave, J. C.: A Sharp-Interface Active Penalty Method for the Incompressible Navier-Stokes Equations, J. Sci. Comput., 62, 53–77, doi:10.1007/s10915-014-9849-6, 2015.

Spiteri, R. and Ruuth, S.: A new class of optimal high-order strong-stability-preserving time discretization methods, SIAM J. Num-mer. Anal., 40, 469–491, 2002.

Titov, V., Rabinovich, A., Mofjeld, H., Thomson, R., and González, F.: The global reach of the 26 December 2004 Sumatra Tsunami, Science, 309, 2045–2048, 2005.

Vasilyev, O. V. and Kevlahan, N. K.-R.: Hybrid wavelet collocation-Brinkman penalization method for complex geometry flows, Int. J. Num. Meth. Fluids, 30, 531–538, 2002.