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

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.


Introduction
Properly handling coastlines is crucial for realistic twodimensional or three-dimensional ocean models.Twodimensional, 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(10 m) 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 smallscale 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.(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 subkilometric 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 higherorder 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 winddriven 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.

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: 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 where momentum m = hu coincides with the mass flux.φ(x) and σ (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: where the parameters α and control the accuracy of the boundary condition approximation.(For stable numerical implementation of the penalization, the discontinuities in φ and σ 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 noslip 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 where m = hu is the height (i.e.mass) flux.In order to conserve mass, the mass flux should actually be m = φ(x)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.hu instead of φhu).Therefore, it is impossible to derive an energy budget from Eqs.
The Reckinger et al. (2012) penalization also has the property that inertia-gravity wave speeds are 1/ √ α times faster in the porous medium.This introduces a stiffness in time associated with the small porosity α 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 −σ (x)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 advan-tages apart from eliminating the stiffness constraint associated with the small porosity α.

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 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 u(x) and position vector x ∈ R 2 .If the conservation equation for the scalar h is and the vector-invariant equation of motion is where The total energy We now use the Euler-Poincaré theory to derive standard and modified shallow water equations.The fluid has free surface perturbations η(x) from the mean free surface η = 0 and the depth of the fluid is given by b(x) > 0 so the total depth is h(x) = η(x) + b(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 η 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:  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.
from which one derives Thus, the shallow water equation of motion is the equation of motion: We now assume a porous medium with volume fluid fraction given by the variable porosity φ(x).We define a new variable h = φh satisfying the conservation law and the action The Lagrangian density for the new variable h is then from which The momentum equation for the porous shallow water system is 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 √ gh if the porosity φ is constant, independent of the actual value of φ.
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 where µ is the fluid viscosity and K(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 with constant permeability K which, like , 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 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 √ g/k 1/6 s (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.

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 φ 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. u = 0.
The vector-invariant penalized shallow equations based on (Eq.12) are where η = φ(x)η.The porosity φ(x) and porous friction coefficient σ (x) are discontinuous such that the fluid portion of the domain is unaffected and the solid portion is penalized as a very impermeable medium: with K α 1.The solid regions are defined by the indicator function χ (x): When implemented numerically the indicator function χ (x) is smoothed over a few grid points, as discussed in Reckinger et al. (2012).The porosity φ(x) and friction coefficient σ (x) are then defined based on χ (x) and the control parameters α 1 and K α 1 as Note that the prognostic variables for the penalized shallow water equations (Eq.15) are h and u and that h = h in the non-penalized (i.e.non-porous) region.Equation ( 19) shows that the velocity penalization friction term σ (x) depends explicitly on both the porosity α and the permeability K.In contrast, in Reckinger et al. (2012) the velocity friction parameter 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 and α can be varied independently.

The flux form of the equations is
where the mass flux m = φhu.This shows clearly that both mass and momentum move at the same speed 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 onedimensional wave propagation problem.

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 whereas the exact behaviour at the boundary is perfect reflection, R = 1.Therefore, some height amplitude will be lost since part of the wave is transmitted and the size of the error is O(α).
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 u, so energy is conserved.In particular, total energy decreases as which implies that the penalization is stable.Secondly, ignoring friction, the linear wave speed is the same in both the fluid and porous regions, 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 α does not place any additional constraints on the spatial resolution x or the time step 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.

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: where the penalization functions φ(x) and σ (x) are as given in (Eq.4).The geometry of the domain is defined by the indicator function χ (x) = H (x), where H (x) is the Heaviside function.This means that x < 0 is fluid and x ≥ 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 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 ≥ 0 and solving the resulting ordinary differential equations in x.The resulting four constants are determined by the requirement of finite solutions as x → ±∞ and from the jump conditions at x = 0, 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 (1 where the wave speed c = √ gH , and h 1 (x, s) and u 1 (x, s) do not depend on the penalization.Now, taking the leadingorder series expansions in α 1 we have the following approximate expressions for the Laplace transforms of the penalized solutions: 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: where and M(1/2, 2, −z) is a hypergeometric function with leading-order asymptotic expansion for large argument z: 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 where we have assumed that L/c.The asymptotic estimates (Eq.26) show that the penalization converges as → 0 and α → 0 and that the relative errors of the penalized equations are O(α 1/2 √ c/L) for height and O(α 1/2 √ 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 If we now assume that t − (L + 1)/c to approximate Laplace transform integrals become (28) Again, assuming x/c, the integrand in the first equation decays exponentially as τ → x/c and we can approximate the lower integration limit x/c by zero.Evaluating the integrals in Eq. ( 28) gives the final results: where Assuming an interaction time t ≈ L/c, the results (Eqs.29, 30) show that the penalized solution penetrates a distance O( √ cL ) into the solid region.This numerical boundary layer must be resolved, so we require a local grid size near the boundary x ≤ √ cL /2 or, equivalently, ≥ 4 x 2 /cL for a given grid size x.If the wavefront is well resolved, i.e.L is much larger than the grid size x, then the penalization is first-order accurate in space with a relative height error O(α x/L).However, if the wavefront is only marginally resolved, i.e.L ≈ x, then the relative error is O(α), independent of the grid resolution.In this case a sufficiently small error can be achieved for any grid by choosing α appropriately.
In summary, we have found that the penalized solution converges to the exact solution in the fluid domain with the rates O( √ c/Lα 1/2 ) for height and O(H w /H √ c/Lα 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 √ cL into the solid region and this numerical boundary layer must be resolved.

Numerical verification on linearized 1-D wave propagation
The error estimate O(α 1/2 ) = O( √ αK) for height and velocity derived in the previous section is verified here for onedimensional linear wave propagation with reflection.The computational domain is x ∈ [0, L x ] with periodic numerical boundary conditions.The penalized (i.e.solid) region is x ≤ x 1 and x ≥ x 2 defined by indicator functions: A smoothed porosity is used since φ(x) must be differentiated.However, the permeability σ (x) is not smoothed since otherwise the penalization error begins to grow for a sufficiently small (depending inversely on α).(If = K/α, a smoothed σ (x) may be used.)When = K/α we choose K = (4 x) 2 .A good choice for the smoothing parameter is the smallest value that ensures stable solutions and linear error convergence with α.Since we use a low-order (secondorder) method in space, it is often possible to obtain stable solutions with no smoothing.However, to ensure the solution is always stable we choose = 4 x, which smooths the indicator function over about four grid points as shown in Fig. 2. We use these choices for the K and 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: with wave width L = 1/24 = 4.1667×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 ∂h/∂x = 0 is 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 t = min(4 , 0.4 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 √ c/L ≈ 5 in the expressions (Eq.26) for the error convergence and we expect 4.1 × 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( 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 ∞ 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 α if α and are independent and like α 1/2 if = K/α (as in a porous medium) is verified in Fig. 4. Note that the error at small α < 10 −4 is effectively limited by the error of the underlying finite volume/finite difference numerical scheme, which is about 6 × 10 −5 for the exact boundary conditions at the resolution N = 2400.predicted scaling α (straight line) when = 10 −3 is fixed, and with scaling α 1/2 when = K/α as in the porous medium equations.The permeability is fixed at K = (4 x) 2 and the resolution is N = 2400.Note that at this resolution the error of the secondorder finite volume method saturates at 7.7 × 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 = K/α.Finally, Fig. 5 (right) confirms that the error for this penalization scheme, with permeability K = 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 α appropriately as explained in Sect.4.3.
As mentioned in Sect.3.2, Reckinger et al. (2012) assume that α and are formally independent.However, in practice they advise that should be smaller than α, and choose /α = 10 −2 for their simulations.This restriction is not necessary in our case since the error is O(α 1/2 ).This means that α can be chosen smaller than , as shown in Fig. showing a weaker error convergence O(α 1/2 ), it actually appears to show the expected scaling O(α) but over a small range of α of about 1 decade.Finally, we consider the effect of smoothing width on the accuracy of the results.As explained above, to guarantee stability of the penalized solution it is often necessary to smooth the porosity φ(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 for < 6 x and = 2 x is the minimum smoothing to ensure stability.Figure 6 (right) shows how the error depends on the ratio L/ (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/ x 1.

Guidelines for choosing penalization parameters
The parameters , α, and determining the penalization are chosen as follows.
The permeability parameter is set first, based on the spatial resolution of the simulation x near the coastlines.As x 2 /cL.However, the velocity penalization term is stiff, restricting the time step to t ≤ C 1 (with C 1 an order one constant) for an explicit method.It is therefore often preferable to choose a larger so the penalization does not enforce an artificially small time step.For example, set = t = C 2 x/c according to the Courant-Friedrichs-Lewy (CFL) stability condition for hyperbolic equations.Note that this is also the smallest permissible when the smallest wavefronts are only marginally resolved so L ∼ x, where ≥ 4 x/c.Using this choice of , and in the least favourable case where the smallest wavefronts are only marginally resolved, the relative error in height is O(α) and the relative error in velocity is O(αH w /H ) independent of and x.Now, since has been determined by the resolution of the simulation, the desired accuracy is controlled by setting the porosity α.Recall that the choice of α does not affect the numerical stability of the simulation.Typically, α = O(10 −3 ) is appropriate for a second-order accurate simulation.In a dynamically adaptive method like the one used here, α should be set about 10 times smaller than the tolerance ε.Recall that the parameter also enforces the no-slip (i.e.tangential) velocity condition to a relative accuracy of O( 1/2 √ 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 of the indicator function χ (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

√
Lc .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 α is not too small, i.e. α > 7.5 × 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).

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).

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 χ (x).Adcroft and Marshall (1998) proposed a test to identify any spurious effects due to piecewise-constant boundary approximations.They calculated wind-driven β-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 piecewiseconstant 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 (θ = 45 • ) 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.
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 ε = 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, ρ 0 , and the Sverdrup velocity U Sv = τ 0 /(ρ 0 βH L) = 0.01 m s −1 .In this nondimensionalization the penalization parameters chosen are 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 δ M = 1.16 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 θ = 0, 10, 30, and 45 • 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.8m at θ = 0 • , h max = 723.4m at θ = 10 • , h max = 722.1 m at θ = 30 • , and h max = 728.7 m at θ = 45 • .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 θ = 45 • than at θ = 0 • .
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.

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: In practice, H min > 2 m is usually sufficient.The mask χ (x) defining the solid and fluid regions is found by setting locations with negative bathymetry to zero and re- This generates a mask on the regular 1 arcmin latitudelongitude 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.

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 ε (not to be confused with the relaxation time 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 ε = 0.05, and the thresholds for height and velocity were ε h = H max ε 3/2 and ε u = H max g/cε 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  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 x min = 475m.Note that a non-adaptive simulation at this resolution would require about 2.68 × 10 9 height nodes (hexagonal cells), while the initial condition requires only about 3.09 × 10 6 height nodes in the adaptive simulation corresponding to a grid compression ratio of 867.
The penalization parameters are α = 8 × 10 −3 and η = 5×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  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 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 × 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×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 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).

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 andRosenstein, 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 ∼ f and radius R, the basin scale L ∼ 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 The gyre is characterized by its Rossby number Ro = U Sv /f L, 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 , and β.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 ε = 1.0, and the thresholds for height and velocity are ε h = U Sv RoR / gε 3/2 and ε u = U Sv Roε 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 x min = 1.9km or 1 / 64 • .The penalization parameters are α = 10 −2 and η = 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 rigidwall boundary condition induces narrow and intense western boundary currents dominated by advection of planetary 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  the method to capture boundary currents and their complex vortical structure.

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 α and permeability η tend to zero.The error at finite α and η is O(αη 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 globalscale flows: long-distance tsunami propagation (i.e. the inertia-gravity wave regime with fast dynamics) and winddriven 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 threedimensional 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.
For statistically homogeneous shallow water turbulence, we have obtained encouraging results by combining wavelet-based dynamic adaptivity with local refinement criteria based on truncation-Published by Copernicus Publications on behalf of the European Geosciences Union.N. K.-R.Kevlahan et al.: Adaptive wavelet simulation of global ocean dynamics error estimates

Figure 1 .
Figure1.Shallow water geometry.The perturbation of the sea surface from equilibrium sea surface z = 0 is η(x) and the sea depth is given by the bathymetry b(x) ≥ 0, which is the depth of the seafloor below the equilibrium sea surface.The total height of the fluid is then h(x) = η(x) + b(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.

Figure 2 .
Figure 2. Initial height conditions for the wave packet and Gaussian test cases and porosity φ(x) with α = 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 = x.
are the odd periodic extension of the initial conditions outside the fluid interval [x 1 , x 2 ].

Figure 3 .Figure 4 .
Figure3.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 α = 10 −3 and K = 4 × 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 φ(x).The error in the velocity boundary condition is 0.03 ≈ 1/2 , as expected.

Figure 5 .Figure 6 .
Figure5(left) confirms that the error scales like K 1/2 when = K/α.Finally, Fig.5(right) confirms that the error for this penalization scheme, with permeability K = 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 α appropriately as explained in Sect.4.3.As mentioned in Sect.3.2,Reckinger et al. (2012) assume that α and are formally independent.However, in practice they advise that should be smaller than α, and choose /α = 10 −2 for their simulations.This restriction is not necessary in our case since the error is O(α 1/2 ).This means that α can be chosen smaller than , as shown in Fig.4.In fact, to ensure scaling of the error like O( 1/2 ) when α is fixed, it is necessary to choose α = K (constant) when the indicator function defining the solid region is smoothed.AlthoughReckinger et al. (2012) interpret Fig.8for α = as

Figure 7 .
Figure7.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 hexagonaltriangular computational grid.

Figure 8 .
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.

Figure 9 .
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

Figure 10 .
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.

Figure 11 .
Figure 11.Tsunami: adaptive grid and wave height after 4 h.The grid compression ratio is 740.

Figure 12 .
Figure 12.Tsunami: adaptive grid and wave height after 16 h.The grid compression ratio is 455.

Figure 13 .
Figure 13.Grid compression ratio for tsunami simulation counting height nodes only and all degrees of freedom (i.e.height and velocity nodes).

Figure 14 .
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 −2 N m 2 .

Figure 15 .
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.

Figure 16 .
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.

Figure 17 .
Figure 17.Adapted grid (left) and relative vorticity (right) for winddriven 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.

Table 1 .
Physical parameters used for the reduced gravity simulation of wind-driven ocean circulation.