1 Introduction

In the last decades, CFD simulations of free surface flows have become a key tool in engineering analysis in the design of marine structures. To be able to obtain valid estimates of environmental stress on ship-wave hydrodynamics, offshore wind turbines, wave energy converters, and offshore production systems the CFD tools need to be able to account for non-linear wave-wave and wave-body interaction. Traditionally free surface water simulation has been simulated using lower order methods, however recently spectral element methods have been used [2]. In contrast to earlier work, in the present article, we simulate 2D free surface waves using a mimetic spectral element method. This ensures that the invariants of the system mass, momentum, and energy are conserved throughout the simulation. The governing equation for incompressible, Newtonian fluids is the Navier–Stokes equation. Free surface waves can be assumed to be governed by an inviscid and irrotational fluid flow. Assuming first the fluid to be inviscid we arrive at the Euler equations,

$$\displaystyle \begin{aligned} \rho \left[ \frac{\partial \mathbf{u}}{\partial t} + \mathbf{u} \cdot \nabla \mathbf{u} \right] = -\nabla p + \rho \mathbf{g}, \end{aligned}$$

together with the continuity equation

$$\displaystyle \begin{aligned} \nabla \cdot \mathbf{u} = 0. \end{aligned}$$

Using the vector identity \(\frac {1}{2} \nabla (\mathbf {u} \cdot \mathbf {u}) = (\mathbf {u} \cdot \nabla )\mathbf {u} + \mathbf {u} \times (\nabla \times \mathbf {u}) \) and using that the fluid is irrotational (∇×u = 0), we can rewrite the momentum and continuity equations,

(1)
$$\displaystyle \begin{aligned} \nabla ^2 \phi &= 0, {} \end{aligned} $$
(2)

where ϕ is a vector potential defined as u = ∇ϕ, ϕ = ϕ(x, z, t). We can now rewrite the momentum equation as,

which we can integrate in space to obtain the time dependent Bernoulli’s equation.

where C(t) is an arbitrary function of integration. We assign C(t) = 0 by recalling that ϕ and \(\phi + \int C(t)dt\) yield exactly the same flow. Redefining ϕ and retaining the symbol \(\phi \mathrel{\mathop:}= \phi + \int C(t)dt\) we obtain the time dependent Bernoulli’s equation for the problem as,

(3)

The governing equations for inviscid and irrotational flows for an incompressible fluid are stated through (2) and (3), where the unknowns are the velocity potential, ϕ, and the pressure, p. Equations (2) and (3) together with proper boundary conditions constitute a well-posed problem. The velocity potential, ϕ, can be solved from the Laplace equation and then substituted into the Bernoulli’s equation to obtain the pressure field.

1.1 Boundary Conditions

The physical domain is shown in Fig. 1, where the notations are also illustrated. The fluid domain \(\varOmega \subset \mathbb {R}, d = 2\) is a bounded, connected domain with piecewise bathymetry \(\varGamma ^b \subset \mathbb {R}^{d-1}\). The time domain is taken as T: t ≥ 0. The unknowns for the problem become the velocity potential and the free surface elevation \(\eta (x,t): \varGamma ^{FS}\times T \longrightarrow \mathbb {R}\). The pressure can hereafter be determined through (3).

The unsteady kinematic and dynamic free surface boundary conditions are given by Zakharov [8],

$$\displaystyle \begin{aligned} \begin{array}{rcl} {} \partial_t \eta = -\partial_x \eta \partial_x \tilde{\phi} + \tilde{\nu}(1 + \partial_x \eta \partial_x \eta) \quad \in \quad \varGamma^{FS} \times T, \end{array} \end{aligned} $$
(4)
$$\displaystyle \begin{aligned} \begin{array}{rcl} \partial_t \tilde{\phi} = -g\eta -\frac{1}{2}((\partial_x \tilde{\phi})^2 - \tilde{\nu^2}(1 + \partial_x \eta \partial_x \eta)) \quad \in \quad \varGamma^{FS} \times T, {} \end{array} \end{aligned} $$
(5)

where \(\tilde {\ }\) signify functions defined only on the free surface. The vertical component of the velocity is calculated by solving the Laplace problem (2) together with the Zakharov boundary conditions (4) and (5) on the free surface. On the bottom we have the no penetration condition,

$$\displaystyle \begin{aligned} \partial_z \phi + \partial_x h\partial_x\phi = 0, \textit{for} z = -h(x) \textit{on} \varGamma^b.\end{aligned} $$
(6)

On the inlet and outlet boundaries (ΓΓ FS ∪ Γ b) the gradient of the velocity potential is specified. The computational domain is shown in Fig. 2.

Fig. 1
figure 1

Illustration of the physical domain with notation of the relevant quantities shown

Fig. 2
figure 2

Computational domain

2 Discretization of Governing Equations

The developed method adopts elements from differential geometry. The unknowns of our system are described by use of differential forms. In a three-dimensional setting we are making use of four types of sub-manifolds: points, curves, surfaces, and volumes, both as inner and outer oriented objects, see an example in Fig. 3. The mimetic spectral element method uses an approach similar to the Galerkin method of the finite element method where the numerical residual is weighted by an arbitrary weight function. In contrast to the traditional finite element method the arbitrary weight functions are taken from the dual space of the function space used by the unknowns.

Fig. 3
figure 3

Three-dimensional dual De Rahm complex showing the four types of sub-manifolds and their different orientations

2.1 Basis Functions

For the polynomial representation we use Lagrange polynomials l i(x) and edge polynomials e i(ξ), see [5]. The Lagrange polynomials are based on a Gauss-Lobatto-Legendre (GLL) point distribution for the nodal values. The Lagrange polynomials and edge polynomials satisfy the properties,

$$\displaystyle \begin{aligned} l_{i}(\xi_j) = \left\{ \begin{array}{ll} 1 \quad \text{ if }\ i = j\\ 0 \quad \text{ if }\ i \neq j, \\ \end{array} \right. \qquad \int_{L_{j}}e_{i}(\xi) = \left\{ \begin{array}{ll} 1 \quad \text{if} \ i = j\\ 0 \quad \text{if} \ i \neq j,\\ \end{array} \right. \end{aligned}$$

and the edge polynomials are explicitly given in terms of the nodal Lagrange basis functions l i(x) as

$$\displaystyle \begin{aligned} e_{i}(\xi) = -\sum_{k=1}^{i-1} dl_{k}(\xi_i), \end{aligned} $$
(7)

where dl k(ξ) is the exterior derivative applied to the 0-form l k(ξ). This definition of the edge polynomial also implies, see [4] and [5],

$$\displaystyle \begin{aligned} dl_{i} = e_{i} - e_{i+1}. \end{aligned} $$
(8)

2.2 Mimetic Discretization in 2D

If we let the 0-form ϕ (0) ∈ Λ 0(M) be expanded as

$$\displaystyle \begin{aligned} \phi_{h}^{(0)} = \sum_{i,j = 0}^{N} \phi_{i,j}l_{i}(\xi)l_{j}(\eta), \end{aligned} $$
(9)

then we can write \(\phi _{h}^{(0)} \) as a matrix-vector product

$$\displaystyle \begin{aligned} \boldsymbol{\phi}_{h}^{(0)} = \left[\mathbf{L} \otimes \mathbf{L}\right] \boldsymbol{\phi} = {\mathbf{M}}^{(0)} \cdot \boldsymbol{\phi}, \end{aligned} $$
(10)

where L i,j = l i(ξ j) and ξ j are the Gauss-Lobatto-Legendre points, GLL points.

If we let the 1-form u (1) ∈ Λ 1(M) be defined as

$$\displaystyle \begin{aligned} u^{(1)} = u^{\xi}\ d\xi + u^{\eta}\ d\eta, \end{aligned} $$
(11)

we can expand u ξ and u η using edge polynomials as,

$$\displaystyle \begin{aligned} u^{\xi}_h = \sum_{i=1}^{N} \sum_{j=0}^{N} u^{\xi}_{i,j}e_{i}(\xi)l_{j}(\eta), \end{aligned} $$
(12)
$$\displaystyle \begin{aligned} u^{\eta}_h = \sum_{i=0}^{N} \sum_{j=1}^{N} u^{\eta}_{i,j}l_{i}(\xi)e_{j}(\eta). \end{aligned} $$
(13)

The discrete one-form u (1) can also be written as a matrix-vector product, where u is evaluated in the GLL points,

$$\displaystyle \begin{aligned} u_{h}^{(1)} = \begin{bmatrix} \left[\mathbf{L} \otimes \mathbf{E}\right] & \mathbf{0}\\ \mathbf{0} & \left[\mathbf{E} \otimes \mathbf{L}\right]\\ \end{bmatrix} \cdot \begin{bmatrix} {\mathbf{u}}^{\xi}\\ {\mathbf{u}}^{\eta} \end{bmatrix} = {\mathbf{M}}^{(1)} \cdot \mathbf{u}, \end{aligned} $$
(14)

where E i,j = e i(ξ j).

The 2-form P (2) ∈ Λ 2(M) is expanded using only edge polynomials,

$$\displaystyle \begin{aligned} p_{h}^{(2)} = \sum_{i,j = 1}^{N} p_{i,j}e_{i}(\xi)e_{j}(\eta) \Rightarrow \left[\mathbf{E} \otimes \mathbf{E}\right] \cdot \mathbf{p} = {\mathbf{M}}^{(2)} \cdot \mathbf{p}. \end{aligned} $$
(15)

The Laplace equation can be reformulated using a mixed formulation, see [1], where the equilibrium equation and the constitutive relationship are separated into two equations.

$$\displaystyle \begin{aligned} \nabla \phi = u, \quad \nabla \cdot u = 0. \end{aligned} $$
(16)

Writing (16) using differential geometry for a 3-D geometry we obtain,

$$\displaystyle \begin{aligned} d\phi^{(0)} &= u^{(1)}, \end{aligned} $$
(17)
$$\displaystyle \begin{aligned} dq^{(2)} &= 0^{(3)}, \end{aligned} $$
(18)
$$\displaystyle \begin{aligned} q^{(2)} &= \star u^{(1)}, \end{aligned} $$
(19)

where we have utilized the Hodge star operator. The Hodge star operator is a map, which maps p-forms onto (n − p)-forms, where n is the dimension of the domain, Ω. Given a p-form, λ (p), the hodge star maps as follows:

$$\displaystyle \begin{aligned} \star\lambda^{(p)}(\varOmega^{n}) = \tilde{\lambda}^{(n-p)}(\varOmega^{n}), \end{aligned} $$
(20)

where \(\tilde {\ }\) denotes the change of orientation of the new form. The Hodge star is also the coupling between the outer oriented domain and the inner oriented dual space, as seen in Fig. 3.

In 2-D, using differential geometry, equations (16) take the form,

$$\displaystyle \begin{aligned} d\phi^{(0)} = u^{(1)},\quad \star u^{(1)} = \tilde{q}^{(1)},\quad d\tilde{q}^{(1)} = \tilde{0}^{(2)}. \end{aligned} $$
(21)

When the exterior derivative is applied to the balance equation of (21) we obtain, see [5]

$$\displaystyle \begin{aligned} d\tilde{q}^{(1)}_{h} = \sum_{i,j = 1}^{N}(q^{\xi}_{i,j} - q^{\xi}_{i-1,j} + q^{\eta}_{i,j} - q^{\eta}_{i,j-1})e_{i}(\xi)e_{j}(\eta), \end{aligned} $$
(22)

where we have utilized (8). The equilibrium equation, the first equation in (21), is equated to a zero valued 2-form. Expanding the last equation in (21) yields,

$$\displaystyle \begin{aligned} \sum_{i,j = 1}^{N} f_{i,j} e_{i}(\xi)e_{j}(\eta) = \sum_{i,j = 1}^{N}(q^{\xi}_{ij} - q^{\xi}_{i-1j} + q^{\eta}_{ij} - q^{\eta}_{ij-1})e_{i}(\xi)e_{j}(\eta), \end{aligned} $$
(23)

where f i,j = 0. The basis can then be cancelled and we can rewrite (23) as,

$$\displaystyle \begin{aligned} \mathbf{f} = \mathbb{E}^{(2,1)} \mathbf{q}, \end{aligned} $$
(24)

where \(\mathbb {E}^{(2,1)}\) is an incidence matrix, only consisting of 0, 1 and − 1. This matrix relates the fluxes of q to the volume integral of the balance equation, see Fig. 4.

Fig. 4
figure 4

Three-dimensional representation of surface fluxes making up the divergence of a volume integral

The first step in developing the discrete system is the formulation of the weak form, where we make use of duality pairing between an arbitrary k-form, α (k), and an arbitrary (n − k)-form, β (nk). The duality pairing is defines as,

$$\displaystyle \begin{aligned} \left\langle \alpha^{(k)}, \tilde{\beta}^{(n-k)} \right\rangle_{\varOmega^{n}} = \int_{\varOmega^{n}} \alpha^{(k)} \wedge \tilde{\beta}^{(n-k)}. \end{aligned} $$
(25)

The pairing with the (n − k)-form, β (nk), takes the role of a weight function in traditional finite element analysis and lives in the dual space and carry the opposite orientation. The result of duality pairing can also be represented as a matrix-vector product,

$$\displaystyle \begin{aligned} \boldsymbol{\beta}^{T} \cdot \tilde{\mathbf{M}}^{(n-k),T} \cdot \mathbf{W} \cdot \mathbf{J} \cdot {\mathbf{M}}^{(k)} \cdot \boldsymbol{\alpha} = \boldsymbol{\beta}^{T} \cdot \mathbb{M}^{(k)} \cdot \boldsymbol{\alpha},\end{aligned} $$
(26)

where W contains the Gauss weights and J is the Jacobian matrix. \(\mathbb {M}^{(k)}\) is a mass matrix of the corresponding discretized k- and (n − k)-form pairing, and \(\tilde {(\ )}\) denotes a matrix of opposite orientation.

Using Stokes generalized theorem [3] and applying integration by parts to the balance equation (the last equation of (21)), we obtain.

$$\displaystyle \begin{aligned} \int_{\varOmega} d \tilde{q}^{(1)} \wedge \alpha^{(0)} &= \int_{\varOmega} d \left(\tilde{q}^{(1)} \wedge \alpha^{(0)}\right) - \int_{\varOmega} \tilde{q}^{(1)} \wedge d\alpha^{(0)} \end{aligned} $$
(27)
$$\displaystyle \begin{aligned} &= \int_{\partial\varOmega} \left(\tilde{q}^{(1)} \wedge \alpha^{(0)}\right) - \int_{\varOmega} \tilde{q}^{(1)} \wedge d\alpha^{(0)}.\end{aligned} $$
(28)

Using duality pairing, an inner product projection for the term with the Hodge star operator, the expansions in (9)–(15), and appropriate boundary conditions we can set up the matrix system for the discrete Laplace operator as shown in (29).

$$\displaystyle \begin{aligned} \begin{bmatrix} \mathbf{0} & \mathbf{0} & \mathbb{E}^{(1,0),T} \tilde{\mathbb{M}}^{(1)}\\ \mathbf{0} & \mathbb{M}^{(1)} & \tilde{\mathbb{M}}^{(1)} \\ \mathbb{M}^{(1)}\mathbb{E}^{(1,0)} & \mathbb{M}^{(1)} & \mathbf{0} \end{bmatrix} \cdot \begin{bmatrix} \phi\\ \mathbf{u}\\ \tilde{\mathbf{q}} \end{bmatrix} = \begin{bmatrix} \mathbf{0}\\ \mathbf{0}\\ \mathbf{0} \end{bmatrix}. \end{aligned} $$
(29)

Using the forward Euler scheme for the temporal term and pairing it with an arbitrary 0-form, \(\tilde {\alpha }^{(0)}\), we can rewrite the Bernoulli’s equation as,

$$\displaystyle \begin{aligned} \left\langle (\rho^{(2)} \wedge \frac{\phi_{n}^{(0)} - \phi_{n-1}^{(0)}}{\varDelta t} + \frac{1}{2} \rho^{(2)} \wedge \left(i_{d\phi^{(0)}_{n-1}}d\phi_{n}^{(0)}\right) + p^{(2)} = - \rho^{(2)} \wedge h^{(0)}\ g)), \ \tilde{\alpha}^{(0)} \right\rangle_{\varOmega}. \end{aligned} $$
(30)

The density is considered a 2-form, which leaves (30) Hodge invariant. The interior product i is defined in [7]. The discrete version of (30) takes the form,

$$\displaystyle \begin{aligned} \begin{bmatrix} \frac{\rho}{\varDelta t}\mathbb{M}^{(2)} + \frac{\rho}{2}\mathbb{M}^{(2)}\mathbb{M}_{i}^{(1,1)} & \mathbb{M}^{(2)} \end{bmatrix} \cdot \begin{bmatrix} \boldsymbol{\phi}_{n} \\ \mathbf{P} \end{bmatrix} = -\rho\ g\ \mathbb{M}^{(2)} \mathbf{h}\ + \frac{\rho}{\varDelta t}\mathbb{M}^{(2)} \phi_{n-1}. \end{aligned} $$
(31)

\(\mathbb {M}_{i}^{(1,1)}\) is derived from the interior product of the two 1-forms in the convective term, and contains information of ϕ from the previous time step and consequently has to be updated at each new time step.

The simulation is initialized by first solving the Laplace equation with the prescribed boundary conditions. The initial velocity potential ϕ on the free surface, is set to \(\tilde {\phi }(x,t=0) = x\), and the free surface height is set to η(x, t = 0) = 0. At the following time steps, the Zakharov free surface equations are solved to obtain new values of \(\tilde {\phi }\) as well as the free surface elevation, η.

3 Numerical Results

The method is first applied to a non-temporal problem without a free surface. The geometry sketched in Fig. 5 contains a cylinder in the middle of a square. On the horizontal walls of the square and the cylinder wall the no penetration condition is applied. On the left vertical boundary a fully developed velocity profile is specified and on the right vertical boundary a constant velocity potential is defined. The velocity potential ϕ and streamlines are shown in the middle section of Fig. 5. In the right part of Fig. 5 the pressure field is shown. Figure 6 shows that we obtain spectral convergence for both unknowns.

Fig. 5
figure 5

Left: multi-element mesh of the cylinder problem with corresponding boundary conditions. Middle: solved velocity potential ϕ in black with corresponding streamlines in red. Right: Solved pressure field from the Bernoulli equation

Fig. 6
figure 6

The two unknowns of the system, the velocity potential, ϕ, and the pressure field, P, are shown to carry spectral convergence

Furthermore, the balance equation ∇⋅u = 0 (conservation of mass) is satisfied both globally and point-wise independent of polynomial order as shown in Fig. 7.

Fig. 7
figure 7

The mass balance equation of (16) (∇⋅u = 0) is satisfied both globally and locally for any order of the expanding polynomial

Next we apply the method to a temporal and free surface problem where we have included a bump on the bottom boundary. The Zakharov free surface equations are applied on the top horizontal boundary. In Fig. 8 the pressure field and the free surface are plotted at t = 1, 100, 200.

Fig. 8
figure 8

Time progression of the pressure fields, P, at time steps t = 1, 100 and 200 are shown to the left. To the right the height of free surface wave η is shown (a scaling factor of 10 is used)

4 Discussion and Conclusion

Using an isoparametric, multi-element formulation the solution of the discretized Laplace equation shows spectral convergence. In addition, we observe that mass is conserved both globally and locally.

In (31), the discretized Bernoulli equation was kept Hodge-invariant, leaving the equation metric free. This suggests that the fundamental invariant of the equation is conserved. The Bernoulli equation conserves the total energy of the system. However, in Fig. 9 it is observed that a small amount of energy is gained and lost in a periodic manner. It is also observed that the mean energy is constant. It was possible to time integrate over very long time periods without noticing any degradation of data and we conclude that energy is conserved over long time periods even though fluctuations were observed for short time periods. In the future we plan on using a mimetic time integration scheme, which was used in [6], as well as the mimetic spatial discretization that was used in the present work.

Fig. 9
figure 9

Potential and kinetic energy is summed for the entire system at every time step and plotted against time