FESOM-C v.2: coastal dynamics on hybrid unstructured meshes

We describe FESOM-C, the coastal branch of the Finite-volumE Sea ice – Ocean Model (FESOM2), which shares with FESOM2 many numerical aspects, in particular, its finite-volume cell-vertex discretization. Its dynamical core differs by the implementation of time stepping, the use of terrain-following vertical coordinate and formulation for hybrid meshes composed of triangles and quads. The first two distinctions were critical for coding FESOM-C as an independent branch. The hybrid mesh capability improves numerical efficiency, since quadrilateral cells have fewer edges than triangular cells. They do 5 not suffer from spurious inertial modes of the triangular cell-vertex discretization and need less dissipation. The hybrid mesh capability allows one to use quasi-quadrilateral unstructured meshes, with triangular cells included only to join quadrilateral patches of differt resolution or instead of strongly deformed quadrilateral cells. The description of the model numerical part is complemented by test cases illustrating the model performance.

different. FESOM-C relies on a terrain-following vertical coordinate (vs. the Arbitrary Lagrangian Eulerian (ALE) vertical coordinate of FESOM2), but does a step further with respect to the mesh structure. It is designed to work on hybrid meshes composed of triangles and quads. Some decisions, such as for example, the lack of the ALE at the present stage, are only motivated by the desire to keep the code as simple as possible through the initial phase of its development and maintenance.
The code is based on the cell-vertex finite-volume discretization, same as FESOM2 (Danilov et al., 2017) and FVCOM (Chen 5 et al., 2003). It places scalar quantities at mesh vertices and the horizontal velocities at cell centroids.
Our special focus is on using hybrid meshes. In essence, the capability of hybrid meshes is build in finite-volume method.
Indeed, computations of fluxes are commonly implemented as cycles over edges, and the edge-based infrastructure is immune to the polygonal type of mesh cells. However, because of staggering, it is still convenient to keep some computations on cells, which then depend on the cell type. Furthermore, high-order transport algorithms might be sensitive to the cell geometry 10 too. We limit the allowed polygons to triangles and quads. Although there is no principal limitation on the polygon type, triangles and quads are versatile enough in practice for the cell-vertex discretization. Our motivation of using quads is two-fold (Danilov and Androsov, 2015). First, quadrilateral meshes have 1.5 times fewer edges than triangular meshes, which speeds up computations because cycles over edges become shorter. The second reason is the intrinsic problem of the triangular cellvertex discretization -the presence of spurious inertial modes (see, e.g., Le Roux (2012)) and decoupling between the nearest 15 horizontal velocities. Although both can be controlled by lateral viscosity, the control leads to higher viscous dissipation over the triangular portions of the mesh. The hybrid meshes can be designed so that triangular cells are included only to optimally match the resolution or even absent altogether. For example, FESOM-C can be run on curvilinear meshes combining smooth changes in the shape of quadrilateral cells with smoothly approximated coastlines. One can also think of meshes where triangular patches are only used to provide transitions between quadrilateral parts of different resolution, implementing an 20 effective nesting approach.
Many unstructured-mesh coastal ocean models were proposed recently (e.g., Casulli and Walters, 2000;Chen et al., 2003;Fringer et al., 2006;Zhang and Baptista, 2008;Zhang et al., 2016). It will take some time for FESOM-C to catch them up as concerns functionality. The decision on the development of FESOM-C was largely motiated by the desire to fit in the existing modeling infrastructure (mesh design, analysis tools, input-output organization), and not by any deficiency of existing models. 25 The real work load was substantially reduced through the use or modification of the existing FESOM2 routines.
We formulate the main equations and their discretization in the three following sections. Section 5 presents results of test simulations, followed by discussion and conclusions.
2 Model formulation 2.1 The Governing Equations boundary ∂Q 2 , Q = {x, y, z; x, y ∈ Ω, −h(x, y) ≤ z < ζ(x, y, t)}, 0 ≤ t ≤ t f . Here ζ is the surface elevation and h the bottom topography. We seek the vector of unknown q = (u, w, ζ, T, S), where u = (u, v) is the horizontal velocity, w the vertical velocity, T the potential temperature and S the salinity, satisfying the equations 10 Here i = 1, 2, x 1 = x, x 2 = y, u 1 = u, u 2 = v, and summation is implied over the repeating indices i; p is the pressure; j = 1, 2 with Θ 1 = T , Θ 2 = S the potential temperature and salinity respectively. The seawater density is determined by the equation of state ρ = ρ(T, S, p), ρ 0 is the reference density; f is the Coriolis parameter; k is the vertical unit vector; ϑ and K are the coefficients of vertical and horizontal turbulent momentum exchange, respectively; ϑ Θ and K Θ are the respective diffusion coefficients and g is the acceleration due to gravity. 15 Writing ρ(x, y, z, t) = ρ 0 + ρ (x, y, z, t), where ρ is the density fluctuation, we obtain, integrating Eq. (3), where p atm is the atmospheric pressure. The horizontal pressure gradient is expressed then as the sum of barotropic, baroclinic 20 and atmospheric pressure gradients: Note that horizontal derivatives here are taken at fixed z.

Turbulent closures
The default scheme to compute the vertical viscosity and diffusivity in the system of equations (1-4) is based on the Prandtl-Kolmogorov hypothesis of incomplete similarity. According to it, the turbulent kinetic energy b, the coefficient of turbulent mixing ϑ and dissipation of turbulent energy ε are connected as ϑ = l √ b, where l is the scale of turbulence, ϑ Θ = c ρ ϑ, ε = c ε b 2 /ϑ; c ε = 0.046 (Cebeci and Smith, 1974). Prandtl's number c ρ is commonly chosen as 0.1 and sets the relationship between 5 the coefficients of turbulent diffusion and viscosity. The equation describing the balance of turbulent kinetic energy is obtained by parameterizing the energy production and dissipation in the equation for turbulent kinetic energy b as with the boundary conditions where α b = 0.73, B 1 = 16.6, γ ζ = 0.4 · 10 −3 ; u * ζ = (ρ/ρ a ) 1/2 u * is the dynamical velocity in water near the surface, ρ a the air density, u * the dynamic velocity of water on the interface between air and water.
Dissipative term is written as: where ν is the index of iterations. Equation (7) is solved by a three-point Thomas scheme in the vertical direction with the boundary conditions given above. Iterations are carried out until the convergence determined by the condition: where is a small value O(10 −6 ). More details on the solution of this equation are given in (Voltzinger et al., 1989).
To determine the turbulence scale l in the presence of surface and bottom boundary layers we use the Montgomery formula 20 (Reid , 1957) In addition to the default scheme, one may select a scheme provided by the General Ocean Turbulence Model (GOTM) (Burchard et al., 1999) implemented into the FESOM-C code for computing vertical eddy viscosity and diffusion for momentum and tracer equations. GOTM includes large number of well-tested turbulence models with at least one member of every relevant model family (empirical models, energy models, two-equation models, Algebraic Stress Models, K-profile parameterisations, etc) and treats every single water column independently. An essential part of GOTM includes one-point second-order schemes Umlauf et al., , 2007.

5
The model uses either a constant bottom friction coefficient C d , or it is computed through the specified bottom roughness height z h . The first option is preferable if the vertical resolution everywhere in the domain does not resolve the logarithmic layer or when the vertically averaged equations are solved. In the second option the bottom friction coefficient is computed according to Blumberg and Mellor (1987) and has the following form where h b is thickness of the bottom layer. It is also possible to prescribe C d or z h as a function of horizontal coordinate at the initialization step.
The other approach is to adapt the external information. It is applied to scalar fields and will be explained further.
Note that despite simplifications, barotropic and baroclinic perturbations still may disagree at the open boundary, leading to 25 instabilities in its vicinity. In this case an additional buffer zone is introduced with locally increased horizontal diffusion and bottom friction.
Dynamic boundary conditions on the top and bottom specify the momentum fluxes entering the ocean. Neglecting the contributions from horizontal viscosities, we write The first of them sets the surface momentum flux to the wind stress at the surface (τ ζ ), and the second one, sets the bottom where Θ Γ is the given field value, usually a climatological one or relying on data from a global numerical model or observations.
If the phase velocity components a = −Θ t Θ x /G, b = −Θ t Θ y /G and G = [(∂Θ/∂x) 2 + (∂Θ/∂y) 2 ] −1 (Raymond and Kuo, 1984), Θ propagates out of the domain, and one sets τ = τ 0 . If it propagates into the domain, a and b are set to zero and τ = τ Γ , 15 with τ Γ τ 0 . The parameter τ is determined experimentally and commonly is from hours to days. In the FESOM-C such an adaptive boundary condition is routinely applied for temperature and salinity, yet it can also be used for any components of solution.
At the surface the fluxes are due to the interaction with the atmosphere, whereQ is the heat flux excluding short wave radiation part, which has been included as a volume heat source in the temperature equation, c ρ the specific heat of sea water. The impact of the precipitation-evaporation has been been included as a volume source in the continuity equation. In the presence of rivers, their discharge is added either as a prescribed inflow at the open 25 boundary in the river mouth, or as volume sources of mass, heat and momentum distributed in the vicinity of open boundary.
In the first case it might create an initial shock in elevation, so the second method is safer.

Temporal discretization
As is common in coastal models, we split the fast and slow motions into, respectively, barotropic and baroclinic subsystems (Lazure and Dumas, 2008;Higdon, 2008;Gadd, 1978;Blumberg and Mellor, 1987;Deleersnijder and Roland , 1993). The 30 reason for this splitting is that surface gravity waves (external mode) are fast and impose severe limitations on the time step, whereas the internal dynamics can be computed with a much larger time step. The time step for the external mode τ 2D is limited by the speed of surface gravity waves, and that for the internal mode, τ 3D , by the speed of internal waves or advection.
The ratio M t = τ 3D /τ 2D depends on applications, but is commonly between 10 and 30. In practice, additional limitation are due to vertical advection, or wetting and drying processes. We will further use the indices k and n to enumerate the internal 5 and external time steps respectively.
The numerical algorithm passes through several stages. On the first stage, based on the current temperature and salinity fields (time step k) the pressure is computed from hydrostatic equilibrium equation (6) and then used to compute the baroclinic We use an asynchronous time stepping, assuming that integration of temperature and salinity is half-step shifted with respect to momentum. The index k on I implies that it is centered between 10 k and k + 1 of momentum integration. The elevation in the expression above is taken at time step k, which makes the entire estimate for ∇p only first-order accurate with respect to time.
At the second stage, the predictor values of the three-dimensional horizontal velocity are determined as Here K is the coefficient of horizontal viscosity, and AB3 implies the third-order Adams-Bashforth estimate. The horizontal 15 viscosity operator can be made biharmonic or replaced with filtering as discussed in the next chapter.
To carry out mode splitting, we write the horizontal velocity as the sum of the vertically averaged oneū and the deviation thereof (pulsation) u :

By integrating the system (1)-(3) vertically between the bottom and surface, with regard for the kinematic boundary conditions
∂ t ζ + u∇ζ = w on the surface and −u∇h = w at the bottom and time discretization, we get Here a specific version of AB3 is used,ū AB3 = (3/2+β)ū k −(1/2+2β)ū k−1 +βū k−2 , with β = 0.281105 for stability reasons (Shchepetkin and McWilliams, 2005); AM 4 implies the Adams-Multon estimate ζ AM 4 = δζ n+1 +(1−δ−γ − )ζ n +γζ n−1 + ζ n−2 , taken with δ = 0.614, γ = 0.088, = 0.013 (Shchepetkin and McWilliams, 2005). In the equations above τ ζ and τ h are the surface (wind) and bottom stresses respectively, and ∇Ī is the vertically integrated gradient of baroclinic pressure. The term R 3D contains momentum advection and horizontal dissipation of the pulsation velocity integrated vertically In this expression H k is the total fluid depth at time step k, H k = h + ζ k . This term is computed only on the baroclinic time step and kept constant through the integration of the internal mode.

5
The bottom friction is taken as The first part of bottom friction is needed to increase stability, while the second part estimates the correct friction, withũ k+1 h the horizontal velocity vector in the bottom cell on the predictor time step.
The system of the vertically averaged equations is stepped explicitly (except for the bottom friction) through M t time steps 10 of duration τ 2D (index n), to 'catch up' the k + 1 baroclinic time step. The update of elevation is made first, followed by the update of vertically integrated momentum equations.
At the "corrector" step, the 3D velocities are corrected to the surface elevation at k + 1 The final step in the dynamical part calculates the transformed vertical velocity w k+1 from 3D continuity equation (2). It is used in the next predictor step. Note that in the predictor step the computations of vertical viscosity are implicit. 20 New horizontal velocities, the so-called "filtered" ones, are used for avection of tracer. They are given by the sum of the "filtered" depth-mean and the baroclinic part of the "predicted" velocities (Deleersnijder, 1993), . The procedure of "filtering" removes possible high-frequency component in the barotropic velocity. It also improves accuracy for it in essence works toward centering the contribution of the elevation gradient. Once the 25 filtered velocity is computed, the vertical velocity is updated to match it.
The equation for temperature is taken in the conservation form, where D combines the terms related to diffusion, w F t , w F b , T t , T b are the vertical transport velocity and temperature on top and bottom of the layer, T * is computed through the second-order Adams-Bashforth (AB) estimate. R is the boundary thermal flux (either from surface, or due to river discharge). The last term in the equation above is Its two constituents combine to zero because of continuity. Keeping this term makes sense if computation of advection are split 5 into horizontal and vertical substeps. The salinity is treated similarly.
In simulations of coastal dynamics it is often necessary to simulate flooding and drying events. Explicit time stepping methods of solving the external mode are well suited for this (Luyten et al., 1999;Blumberg and Mellor, 1987;Shchepetkin and McWilliams, 2005). The algorithm to account for wetting and drying will be presented in the next section. We only note that computations are performed on each time step of the external mode. The basic structure to describe the mesh is the array of edges given by their vertices v 1 and v 2 , and the array of two pointers c 1 and c 2 to the cells on the left and on the right of the edge. There is no difference between triangles, quads or hybrid meshes in the cycles which assemble fluxes. Quads and triangles are described through four indices to vertices forming them; in the case of triangles the fourth index equals the first one. The treatment of triangles and quads differs slightly in computations of 20 gradients as detailed below. We will use symbolic notation: e(c) for the list of edges forming cell c, e(v) for the list of edges connected to vertex v, v(c) for the list of vertices defining cell of element c.
In the vertical direction we introduce a σ-coordinate (Phillips, 1957) The lower and upper horizontal faces correspond to the planes σ = 0 and σ = 1 respectively. The vertical grid spacing is 25 defined by the selected set of σ i . The spacing of σ i is horizontally uniform in present implementation (but it can be varying) and can be selected as equidistant or based on a parobolic function with high vertical resolution near surface and bottom in the vertical, where N is the number of vertical layers. Here = 1(2) gives the uniform (parabolic) distribution of vertical layers. One 30 more possibility to use refined resolution near bottom or surface is implemented through the formula by Burchard and Bolding (2002): where L h and L ζ are the number of layers near bottom and surface respectively.
The vertical grid spacing is recalculated on each baroclinic time step for the vertices, where ζ is defined. It is interpolated from vertices to cells and to edges. The vector of horizontal velocity and tracers are located in the middle of vertical layers 5 (index i + 1/2), but the vertical velocity is at full layers.

Divergence and gradients
The divergence operator on scalar control volumes is computed as: where the cycle is over edges containing vertex v, the indices l and r imply that the estimates are made on the left and right 10 segments of the control volume boundary attached to the center of edge e, n is the outer normal and the length of the segment (see Fig. 1). Vectors s l and s r connecting the mid-point of edge e with the cell centers on the left and on the right, we get (n ) l = k×s l and similarly, but with the minus sign for the right element (k is a unit vertical vector). The mean cell values, for example layer thickness on the cell, can be defined as c = v=v(c) v w cv , where w cv = 1/3 on triangles and w cv = S cv /S c for quads (S c -cell area and S cv -the part of it in the scalar control volume around vertex).

15
Gradients of scalar quantities are needed on cells, and are computed as: where summation is over the edges of cell c, the normal and length are related to the edges, and ζ is estimated as the mean over edge vertices.
The gradients of velocities on cells can be needed for computation of viscosity and momentum advection term. They are 20 computed through the least squares fit based on the velocities on neighboring cells.
Here r cn = (x cn , y cn ) is the vector connecting the center of c to that of its neighbor n. Their solution can be reformulated in terms of two matrices (computed once and stored) with coefficients a x cn = (x cn Y 2 − y cn XY ))/d and a y cn = (y cn X 2 − x cn XY ))/d, acting on velocity differences and returning the derivatives. Here d = X 2 Y 2 −(XY ) 2 , X 2 = n=n(c) x 2 cn , Y 2 = 25 n=n(c) y 2 cn and XY = n=n(c) x cn y cn .

Momentum advection
We implemented two options for horizontal momentum advection in the flux form. The first one is the linear reconstruction upwind, based on cell control volumes (see Fig.1). The second one is central and is based on scalar control volumes, with subsequent averaging to cells. In the upwind implementation we write For edge e, linear velocity reconstructions on the elements on its both sides are estimated at the edge center. One of the cells is c, and let n be its neighbor across e. The respective velocity estimates will be denoted as u ce and u ne and upwind will be written in form 2u = u ce (1 + sgn(un)) + u ne (1 − sgn(un)), where un = n((u ce + u ne ))/2.

5
The other form is adapted from Danilov (2012). It provides additional smoothing for momentum advection by computing flux divergence for larger control volumes. In this case we first estimate the momentum flux term on scalar control volumes, [(un u) l + (un u) r ].
The notation here follows that for the divergence. No velocity reconstruction is involved. These estimates are then averaged to the centers of cells. In both variants of advection form the fluid thickness is estimated at cell centers.

Tracer advection
Horizontal advection and diffusion terms are discretized explicitly in time. Three advection schemes have been implemented.
The first two are based on linear reconstruction for control volume and are therefore second-order. The linear reconstruction upwind scheme and Miura scheme (Miura, 2007) differ in the implementation of time stepping. The first of them needs the Adams-Bashforth method to be the second-order with respect to time. The scheme by Miura reaches this by estimating the 15 tracer at a point displaced by uτ 3D /2. In both cases a linear reconstruction of tracer field for each scalar control volume is performed, where Θ 0 is the tracer value at vertex, Θ x and Θ y are the gradients averaged to vertex locations, and x v , y v the coordinates of vertex v. The fluxes for scalar control volume faces associated to edge e are computed as The estimate of tracer is made at the mid-points of the left and right segments, and at points displaced by uτ 3D /2 from them respectively.
The third approach used in the model is based on the gradient reconstruction. The idea of this approach is to estimate the tracer at mid-edge locations by a linear reconstruction using the combination of centered and upwind gradients Θ The advective flux of scalar quantity Θ through the face of the scalar volume (Q e = [(un ) l + (un ) r ]) associated with edge e which leaves the control volume ν 1 (see Fig. 1) is γ is the parameter controlling the upwind dissipation. Taking γ = 0 give the third-order upwind method whereas γ = 1 gives 5 the centered fourth-order estimate.
A quadratic upwind reconstruction is used in the vertical with the flux boundary conditions on surface (8) and (9) and zero flux at the bottom. Other options for horizontal and vertical advection, including limiters, will be introduced in future.
The advection schemes are coded so that their order can be reduced toward the first-order upwind for very thin water layer to increase stability in the presence of wetting and drying.

Viscosity and filtering
Consider the operator ∇A∇u. Its computation follows the rule: The estimate of velocity gradient on edge e is symmetrized, following the standard practice (Danilov, 2012), over the values on neighboring cells. "Symmetrized" means that the estimate on edge e is mean of horizontal velocity gradients computed 15 on elements c and n (notation from article) with the common edge e: (∇u) e = ((∇u) c + (∇u) n )/2. The consequence of this symmetrization is that on regular meshes (formed of equilateral triangles or rectangular quads) the information from the nearest neighbors is lost. Any irregularity in velocity on the nearest cells will not be penalized. Although unfavorable for both quads and triangles, it has far-reaching implications for the latter: it cannot efficiently remove the decoupling between the nearest velocities which may occur for triangular cells. This fact is well known, and the modification of the scheme above that 20 improves coupling between the nearest neighbors consists in using the identity n = r cn /|r cn | + (n − r cn /|r cn |), where r cn is the vector connecting the centroid of cells c and n. The derivative in the direction of r cn is just the difference between the neighboring velocities divided by the distance, which is explicitly used to correct n∇u. It is easy to show that on rectangular quads or equilateral triangles (n and r cn are collinear) the second term of the expression above will disappear. This 25 is the harmonic discretization and a biharmonic version is obtained by applying the procedure twice.
A simpler algorithm is implemented to control grid-scale noise in the horizontal velocity. It consists in adding to the right hand for the momentum equation (2D and 3D flow) a term coupling the nearest velocities, where τ f a time scale selected experimentally. On regular meshes this term is equivalent to the Laplacian operator. On general meshes it deviates from the Laplacian, yet after some trivial adjustments it warrants momentum conservation and energy dissipation (Danilov and Androsov, 2015).

Wetting and drying algorithm
For modeling wetting and drying we use the method proposed by Stelling and Duinmeijer (2003). The idea of this method is 5 to accurately track the moving shoreline by employing the upwind water depth in the flux computations. The criterion for a vertex to be wet or dry is taken as: where D min is the critical depth and h l is the topography. Each cell is treated as: where h v and ζ v are the depth and sea surface height at the vertices v(c) of the cell c. When a cell is treated as dry, the velocity at its center is set to zero and no volume flux passes through the boundaries of scalar control volumes inside this cell.

Numerical simulations
In this section we present the results of two model experiments. The first of them considers tidal circulation in the Sylt-Rømø Bight. This area has a complex morphometry with big zones of wetting/drying and large incoming tidal waves. In this case 15 our intention is to test functioning of meshes of various kind. The second experiment simulates a South-East part of the North Sea. For this area, annual simulation of barotropic-baroclinic dynamics with realistic boundary conditions on open and surface boundaries is carried out and compared to observations. We note that a large number of simpler experiments, including those where analytical solutions are known, were carried out in the course of model development, to test and tune the model accuracy and stability. Lessons learned from them were taken into account. We omit their discussion in favor of realistic simulations.

Sylt-Rømø experiment
To test the code sensitivity to the type of grid and grid quality we computed barotropic tidally driven circulation in the Sylt-Rømø Bight in the Wadden Sea.
It is a popular area for experiments and test cases (e.g. Lumborg and Pejrup, 2005;Ruiz-Villarreal et al., 2005;Burchard et al., 2008;Purkiani et al., 2014). The Sylt and Rømø islands are connected to the mainland by artificial dams, creating a 25 relatively small semi-enclosed bight with a circulation pattern well-known from observations and modeling (e.g. Becherer et al., 2011;Purkiani et al., 2014). It is a tidally energetic region with the water depth down to 30 m, characterized by wide intertidal flats and a rugged coastline. Water is exchanged with the open sea through a relatively narrow (up to 1.5 km wide) and deep (up to 30 m) tidal inlet Lister Dyb. The bathymetry data for the area was provided by Burchard (2015) and is presented in Fig 2. We constructed three different meshes (Fig. 2) for our experiments. The first one is a nearly regular quadrilateral mesh, complemented by triangles that straighten the coastline (MESH-1). Its spatial resolution is 200 m. The second mesh is purely 5 triangular (MESH-2) with resolution varying from ∼820 to ∼90 m. The third mesh was generated by the Gmsh mesh generator (Geuzaine and Remacle, 2009) and includes 34820 quads and 31 triangles with the minimum cell size of 30 m and maximum size of ∼260 m (MESH-3). All meshes have 21 non-uniform sigma layers in the vertical direction (refined near the surface and bottom). The wetting/drying option is turned on. We apply the k − turbulence closure model with transport equations for the turbulent kinetic energy and the turbulence dissipation rate using GOTM library. The second-moment closure is represented by 10 algebraic relations suggested by Cheng et al. (2002). The experiment is forced by prescribing elevation due to M 2 tidal wave at the open boundary (western and northern boundaries of the domain) provided by Burchard (2015).
Simulations on each mesh were continued until reaching the steady state in the tidal cycle of M 2 wave. The last tidal period was analyzed. The quasi-stationary behavior is established already on the second tidal period. The simulated M 2 wave is essentially nonlinear during the tidal cycle judged by the difference in amplitude of two tidal half-cycles.
15 Figure 3 shows the behavior of potential and kinetic energies in the entire domain, whereas the right panels show the energies computed over the areas deeper than 1 m. The results are sensitive to the meshes, which is explained further. The smallest tidal energy is simulated on the triangular mesh (MESH-2). The reason is that with the same value of the time scale τ f in the filter used by us in these simulations the effective viscous dissipation is much higher on a triangular mesh than on quadrilateral meshes of similar resolution. However, the solutions on quadrilateral meshes are different too, and this time the reason is the 20 difference in the details of representing very shallow areas on meshes of various resolution (MESH-3 is finer than MESH-1).
The difference between the simulations on two quadrilateral meshes is related to the potential energy and comes from the difference in the elevation simulated in the areas subject to wetting and drying (see Fig. 8). Note that the velocities and layer thickness are small in these areas, so the difference between kinetic energies between the left and right bottom panels of Fig. 3 is small.  Figure 6 presents the range of fluctuations for the whole period. As is seen, the main tidal wave M 2 has a smaller amplitude (about 70 cm) than in simulations. However, the high-frequency part of the spectrum is very noisy because of atmospheric loading and winds. If the analysis is performed for separate tidal cycles in cases of strong wind and no-wind, the correspondence with observation is recovered in the second case.

35
Of particular interest is the convergence of solution on different meshes. For comparison the solutions simulated on MESH-2 and -3 were interpolated to the MESH-1. The comparison was performed for the full tidal cycle and is shown in Fig. 7 which presents the histograms of the differences.
For the solutions on MESH-1 and MESH-3 values at more than 80% of points agree within the range of ±1 cm for the elevation (the maximum of tidal wave exceeds 1 m) and within the range of ±1 cm/s for the velocity (the maximum horizontal 5 velocity is about 120 cm/s). Thus the agreement between simulations on quadrilateral MESH-1 and MESH-3 is also maintained on a local level. The agreement becomes worse when comparing solutions on triangular MESH-2 and quadrilateral MESH-1.
Here the share of points with larger deviations is noticeably larger.
Spatial patterns of the differences for elevations and velocities simulated on different meshes are presented in Figs 8 and 9 respectively. Substantial differences for the elevation are located in wetting and drying zones. This is related to the sensitivity 10 of the wetting and drying algorithm to the cell geometry. For the horizontal velocity the difference between the solutions is defined by the resolution of bottom topography in the most energetically active zone on the quadrilateral meshes (see residual circulation in Fig. 4). The difference between the triangular grid and quadrilateral grid has a noisy character and is seen in the regions of strongest depth gradients.

15
Here we present the results of realistic simulations of circulation in the southeastern part of the North Sea. The area of simulations is limited by the Dogger Bank and Horns Rev (Denmark) on the North and border between Belgium and the Netherlands on the west. It is characterized by complex bathymetry with strong tidal dynamics (Maßmann et al., 2010;Idier et al., 2017).
The related estuarine circulation (Burchard et al., 2008;Flöser et al., 2011), strong lateral salinity and nutrient gradients and rivers plumes (Voynova et al., 2017;Kerimoglu et al., 2017) are important aspects of this area. In our simulations, the 20 mesh consists of mainly quadrilateral cells. The mesh is constructed with the Gmsh (Geuzaine and Remacle, 2009) using the Blossom-Quad method (Remacle et al., 2012). It includes 31406 quads and only 32 triangles. The mesh resolution (defined as the distance between vertices) varies between 0.5 -1 km in the area close to the coast and Elbe estuary, coarsening to and 4 -5 km at the open boundary (Fig. 10). The mesh contains 5 sigma layers in the vertical.
The bathymetry from the EMODnet Bathymetry Consortium (2016) has been used. Model runs were forced by 6 hourly 25 atmospheric data from NCEP/NCAR Reanalysis (Kalnay et al., 1996) and daily resolved observed river runoff (Radach and Pätsch , 2007;Pätsch and Lenhart, 2011). Salinity and temperature data on the open boundary were extracted from hindcast simulations based on TRIM-NP (Weisse et al., 2015). The sea surface elevation at the open boundary was prescribed in terms of amplitudes and phase for M 2 and M 4 tidal waves derived from the previous simulations of the North Sea (Maßmann et al., 2010;Danilov and Androsov, 2015). Data for temperature and salinity from TRIM-NP model were used to initialize model 30 runs for one year. The results of these runs were used as initial conditions for 10 month final simulation.
The validation of simulated amplitudes and phases of M 2 tidal wave is presented in Fig. 11. This wave is the main tidal constituent in this region. It enters the domain at the western boundary and propagates along the coast as a Kelvin wave. The phase field is characterized by two amphidromic points. We used the observed values from Andersen (2008) for the comparison.
The simulated amplitudes are generally slightly smaller than the observed ones (Fig. 11). The deviations in amplitudes can be explained by uncertainty in model bathymetry and the use of constant bottom friction coefficient. The phases of M 2 wave are well reproduced by the model. We characterize its accuracy by the total vector error: where A * , ϕ * , and A, ϕ are the observed and computed amplitudes and phases, respectively at N stations. The total vector  The 3D velocity part takes approximately the same CPU time as the computation of vertically averaged velocity and eleva-of gradients of velocity and scalars, are approximately twice cheaper on quadrilateral meshes, as expected. Computations of viscosity and momentum transport are carried out in a cycle over edges which is 1.5 times shorter for meshes made of quadrilateral elements, which warrants a similar gain of ∼ 1.5 in performance on quadrilateral meshes. In our simulation, the net gain was ∼ 1.62 times on MESH-1 compared to MESH-2, even despite the fact that the number of vertices is 13% larger than on MESH-2. Model is stable on the quadrilateral meshes with smaller horizontal viscosity, which is also an advantage. 5

Triangles vs. quads: Open boundaries
The presence of open boundaries is a distinctive feature of regional models. The implementation of robust algorithms for the open boundary is more complicated on unstructured triangular meshes than on structured quadrilateral meshes. For example, it is more difficult to cleanly assess the propagation of perturbations toward the boundary in this case. In addition, spurious inertial modes can be excited on triangular meshes in the case of cell-vertex discretization used by us, which in practice leads  to the open boundary with quadrilateral cells we stabilize the numerical solution (see the right insert), for it allows us to cleanly 25 handle the directions normal and tangent to the boundary.

Conclusions
We described the numerical implementation of three-dimensional unstructured-mesh model FESOM-C, relying on FESOM2 and intended for coastal simulations. The model is based on a finite-volume cell-vertex discretization and works on hybrid unstructured meshes composed of triangles and quads.
ity study was carried out to elucidate the dependence of simulated surface elevation and horizontal velocity on mesh type and quality. The elevation simulated in zones of wetting and drying may depend on the mesh structure, which may lead to distinctions in the simulated energy on different meshes. The total energy comparison shows that on the triangular MESH-2, having approximately the same number of vertices as MESH-1, the solution is more dissipative, for higher dissipation is generally 5 needed to stabilize it against spurious inertial modes.
The second experiment deals with the southeastern part of the North Sea. Computation relied on the boundary information from hindcast simulations by the TRIM-NP, and realistic atmospheric forcing from NCEP/NCAR. Modeling results agree both qualitatively and quantitatively with observations for the full period of simulation.
Future development of the FESOM-C will include coupling with the global FESOM2 (Danilov et al., 2017), addition of 10 monotonic high-order schemes and sea ice of FESOM2, and various modules that would increase functionality of FESOM-C.
Code and data availability.  Velocities are located at centroids (red circles) and elevation at vertices (blue circles). A scalar control volume associated with vertex v1 is formed by connecting neighboring centroids to edge centers. The control volumes for velocity are the triangles/quads themselves. The lines passing through two neighboring centroids (e. g., c1 and c2) are broken in a general case at edge centers. Their fragments are described by the left and right vectors directed to centroids (s l and sr for edge e). Edge e is defined by its two vertices v1 and v2 and is considered to be directed to the second vertex. It is also characterized by two elements c1 and c2 to the left and to the right respectively.              The dashed rectangle shows the areaof the inserts. A numerical instability evolves on a purely triangular mesh (blue ellipse).