Jeroen Wackers
email: jeroen.wackers@ec-nantes.fr

Ganbo Deng

Emmanuel Guilmineau

Alban Leroyer

Patrick Queutey

Michel Visonneau

Combined refinement criteria for anisotropic grid refinement in free-surface flow simulation

Keywords: Combined criteria, Hessian criteria, anisotropic refinement, free-surface waves

Anisotropic grid refinement is performed for the simulation of water flow with free-surface waves. For these flows, the refinement criterion must provide refinement at the water surface, to accurately resolve the conservation law which indicates the surface position, and below the surface to resolve the water flow. A combined criterion is presented, based on the free-surface position and on the Hessian of the pressure. Different forms of this criterion are presented, based on least-squares or Gaussian computation of the Hessian, in order to overcome irregularities in the computed pressure. The weighting of the two criteria for their combination is discussed; this weighting can be chosen independently of the Reynolds and Froude number of the flow. It is shown that the criterion creates suitable grids for two-and three-dimensional free-surface flows when starting from uniformly coarse original grids.

Introduction

The simulation of two-fluid flows with a free surface between the fluids is inherently a multiphysics problem, since the motion of the free surface interacts with the turbulent viscous flows on both sides of the interface. In Navier-Stokes models for such flows, an equation for the water surface position has to be added to the standard flow equations [START_REF] Wackers | Free-surface viscous flow solution methods for ship hydrodynamics[END_REF], like a convection equation for either the volume fraction of water (volume-of-fluid methods) or for a smooth distance function to the surface (level set methods).

Automatic grid refinement is the technique of creating optimal meshes for a particular flow, by locally dividing the cells of a coarse original grid into smaller cells, so the grid resolution is increased there where greater precision is needed. Grid refinement methods are widespread, see for example [START_REF] Aubry | Adaptive Modelling and Simulation[END_REF][START_REF] Kroll | Achievements of the European project ADIGMA on adaptive high-order methods for aerospace applications[END_REF][START_REF] Loseille | Fully anisotropic goal-oriented mesh adaptation for 3D steady Euler equations[END_REF]. Free-surface water flows have many features which are local in nature, so their precision can be increased with adaptive grid refinement. First, refinement around the surface strongly increases the resolution of the volume fraction equation [START_REF] Hay | Computation of three-dimensional free-surface flows with an automatic adaptive mesh refinement and coarsening strategy[END_REF][START_REF] Hay | H-adaptive Navier-Stokes simulations of free-surface flows around moving bodies[END_REF][START_REF] Wackers | Adaptive grid refinement for hydrodynamic flows[END_REF][START_REF] Wackers | Adaptive grid refinement for unsteady ship flow and ship motion simulation[END_REF], so the modeling of the free surface is improved. But also other aspects of these flows, such as wakes and trailing vortices, are resolved with greater precision when grid refinement is used [START_REF] Karlsson | Implementation of anisotropic mesh refinement in OpenFOAM[END_REF][START_REF] Wackers | Adaptive grid refinement applied to RANS ship flow computation[END_REF][START_REF] Windt | Adaptive mesh refinement in MARIN's viscous flow solver ReFRESCO: implementation and application to steady flow[END_REF]. And finally, complex physical phenomena such as cavitation appear in general very locally and can be computed efficiently on adaptively refined grids.

The unstructured Reynolds-averaged Navier-Stokes solver ISIS-CFD which we develop contains an automatic grid refinement method [START_REF] Wackers | Adaptive grid refinement applied to RANS ship flow computation[END_REF][START_REF] Wackers | Adaptive grid refinement for hydrodynamic flows[END_REF]. This flow solver, distributed by NUMECA Int. as part of the FINE/Marine computing suite, is aimed at the simulation of realistic flow problems in all branches of marine hydrodynamics. The grid refinement method is therefore developed to be general and flexible, featuring anisotropic refinement on unstructured hexahedral grids, derefinement of previous refinements to enable unsteady flow computation, and full parallelisation including integrated dynamic load balancing. The anisotropic refinement is based on metric tensors.

In our earlier work on grid refinement for free-surface flows, the multiphysics character of the flows was not explicitly taken into account for the grid refinement. Instead, the original grid was chosen sufficiently fine to get a reasonable resolution of the flow, then automatic grid refinement was used to to improve the accuracy of one particular flow feature. Thus, gravity waves at the water surface were computed with refinement based on the discontinuity in the volume fraction [START_REF] Wackers | Adaptive grid refinement for unsteady ship flow and ship motion simulation[END_REF] and wake flows with refinement based on the pressure [START_REF] Wackers | Adaptive grid refinement applied to RANS ship flow computation[END_REF][START_REF] Wackers | Sliding grids and adaptive grid refinement applied to ship hydrodynamics[END_REF].

The goal of the present paper is to obtain adapted fine grids for free-surface flows, starting from a coarse original grid without any initial refinement. To reach this goal, the focus is on the refinement criterion. In our mesh refinement technique, the criterion is a real field variable computed from the solution, which indicates everywhere in the flow domain the ideal sizes of the cells. For metric-based anisotropic refinement, the criteria are 3 × 3 symmetric tensors in each cell that indicate the local desired cell sizes independently in all directions. Given such a criterion, our existing mesh refinement module [START_REF] Wackers | Adaptive grid refinement for hydrodynamic flows[END_REF] automatically creates the best corresponding adapted mesh. Thus, the problem of producing refined free-surface meshes comes down to finding the right refinement criterion for free-surface flow.

The discussion in this paper follows the development of this refinement criterion, from the analysis of mesh requirements to practical details of the criterion computation. Good meshes for free-surface flow are studied first. We analyse the discretisation of the flow equations and the free surface model, as well as the physics of flows around bodies with free-surface effects and gravity waves, in order to find out what properties of the mesh are important for the accurate computation of such flows. The conclusions from this study are translated into requirements for the refinement criterion: it is shown that the multiphysics nature of two-fluid flows demands refinement criteria that are a combination of different physical sensors. We therefore discuss how multiple refinement criteria can be combined into one, how the different criteria should be weighted to achieve good accuracy in all equations, and which features are relevant as refinement criteria for hydrodynamic flows. The selected criterion combines directional refinement at the free surface with a pressure Hessian criterion that is modified to overcome the gravity-induced discontinuity in the pressure gradient at the water surface. Simulations of travelling wave trains and ship-generated wave patterns are presented to test these developments and to assess practical guidelines for their use.

The paper is organised as follows. Section 2 introduces the flow solver and the meshes used, concentrating on those aspects that are important for grid refinement. Section 3 gives an overview of the anisotropic mesh refinement method. Then, section 4 discusses the necessity of combined criteria for flows with a free water surface. Section 5 shows the construction of a criterion that combines directional refinement at the free water surface with a pressure Hessian criterion. Finally, section 6 analyses the weights that should be chosen for each criterion when two criteria are combined. Three test cases in section 7 indicate that the criterion generates effective meshes for a wide range of free-surface and cavitating flows. With these meshes, similar accuracies as on user-generated fine meshes are obtained with significantly less computational costs.

Surface capturing and finite-volume discretisation

The study of combined refinement criteria in this paper is conducted in the context of a finite-volume discretisation for the the Unsteady Reynolds-averaged Navier Stokes (URANS) equations on unstructured grids. This section describes the governing flow equations, the discretisation, and the type of meshes used, concentrating on those aspects that are most important for grid refinement and the construction of refinement criteria. Full details of the discretisation can be found in [START_REF] Queutey | An interface capturing method for free-surface hydrodynamic flows[END_REF][START_REF] Wackers | Free-surface viscous flow solution methods for ship hydrodynamics[END_REF].

Governing equations

The ISIS-CFD flow solver which we develop resolves the incompressible URANS equations in a mixturefluid formulation to model water-air two-fluid flow. Here, the entire fluid is modelled as a numerical mixture of the pure fluids on the two sides of the interface. The system uses the conservation laws for momentum, total mass, and mass of each fluid. When the densities of the individual fluids are constant, the latter two reduce to ∇ • U = 0 and to a volume-of-fluid equation. In integral form, the equations are written as follows:

∂ ∂t V ρU dV + S ρU(U • n) dS = S (τ -pI)n dS + V ρg dV, (1)
S U • n dS = 0, (2)
∂ ∂t V α i dV + S α i U • n dS = 0, ( 3
)
where V is a fixed volume, bounded by the closed surface S with a unit normal vector n directed outward. U and p represent, respectively, the velocity and pressure fields. τ and g are the viscous stress tensor and the gravity vector, whereas I is a unit diagonal matrix. α i is the volume fraction for fluid i and is used to distinguish the presence (α i = 1) or the absence (α i = 0) of fluid i. In the case of turbulent flows, additional transport equations are added to the system. The effective flow physical properties (viscosity µ and density ρ) are obtained from the physical properties of the constituent fluids (µ i and ρ i ) with the following constitutive relations. The last identity follows from the definition of the volume fraction.

ρ = i α i ρ i , µ = i α i µ i , 1 = i α i . (4)
Thus, for two fluids, equation (3) only has to be solved for fluid 1; for this case, we denote the volume fraction of fluid 1 by α.

In this framework, free-surface water flows are modelled by specifying a discontinuous inflow condition for α (α = 1 below the surface and α = 0 above it). As equation ( 3) is a pure convection equation, the resulting solution for α in the whole domain is a discontinuity representing the free surface.

Face-based discretisation

The flow equations of the previous subsection are discretised in a finite-volume framework, using pressurevelocity coupling obtained through implicit time integration with a Rhie & Chow SIMPLE-type method [START_REF] Rhie | A numerical study of the turbulent flow past an isolated airfoil with trailing edge separation[END_REF]. The discretisation is face-based. While all unknown state variables are cell-centered, the systems of equations used in the implicit time stepping procedure are constructed face by face. Fluxes are computed in a loop over the faces and the contribution of each face is then added to the two cells next to the face. This technique poses no specific requirements on the topology of the cells. Therefore, the grids can be completely unstructured, cells with an arbitrary number of arbitrarily-shaped faces are accepted.

Central discretisations

The core of the discretisation are the reconstructions of the state variables and their derivatives from the cell centres to the faces. For the diffusive fluxes and the pressure equation, these are basically central approximations of the normal derivatives. In case of misalignment, i.e. when the face normal vector is not aligned with the line between the neighbouring cell centres, extra correction terms are added using the cell-centered gradients computed with a Gauss method. These discretisations will be reused in the construction of refinement criteria (section 5.2).

As an example, the reconstruction of the pressure and its normal derivative is shown here for the case of constant density, i.e. below the surface. More details on the reconstruction, including the weighting of the reconstruction with the density when it is non-constant, are given in [START_REF] Queutey | An interface capturing method for free-surface hydrodynamic flows[END_REF][START_REF] Wackers | Free-surface viscous flow solution methods for ship hydrodynamics[END_REF]. The pressure reconstruction used in the momentum equations is (see figure 1 for notations):

p f = h + h p L + h - h p R + h -E + -h + E - h . h + h -→ ∇p L + h - h -→ ∇p R . (5)
Geometrical vectors E ± are introduced so that the framed term contribution goes to zero when the grid becomes orthogonal (Lf .n = fR.n = 0):

E -(Lf .n) n -Lf , E + (fR.n) n -fR. (6)
Distances used are the projected distances to the face h ± and the projected distance h between the L and R cell centers:

h -= Lf .n , h + = fR.n , h = h -+ h + = LR.n. (7)
The reconstruction of the pressure normal derivative for the pressure equation is:

-→ ∇p.n f = p R -p L h + -→ ∇p L .E -+ -→ ∇p R .E + h . (8)
Here again, the framed term contribution goes to zero when the grid becomes orthogonal.

Convective fluxes

The convective fluxes are computed using limited schemes in Leonard's Normalised Variable Diagram (NVD) [START_REF] Leonard | The ULTIMATE conservative difference scheme applied to unsteady one-dimensional advection[END_REF]. These schemes use nonlinear interpolation between three points for the reconstruction at a cell face, depending on the flow direction, see figure 2. The points C and D are the cell centres of the two neighbour cells, in the upwind and downwind direction. The point U , for structured grids, is the cell centre upwind of point C; for unstructured grids there usually is no suitable cell at this point, so the value in U is extrapolated from C using the gradient computed in C. Many different schemes exist, the standard scheme in ISIS-CFD is the AVLSMART scheme [START_REF] Pržulj | Bounded convection schemes for unstructured grids[END_REF].

For the volume fraction equation, the solutions are known a-priori to be numerical approximations to a discontinuity at the water surface, with constant values elsewhere. For these special solutions, normal accuracy considerations do not hold. Therefore, downwind-biased NVD schemes are used which add artificial antidiffusion (negative diffusion) to the equation while preserving stability, see for example [START_REF] Ubbink | Numerical predictions of two fluid systems with sharp interfaces[END_REF]. Antidiffusion continuously compresses the interface in α so it remains as sharp as possible. As the discontinuous α does not have a well-defined gradient, the state U in our BRICS scheme [START_REF] Wackers | Free-surface viscous flow solution methods for ship hydrodynamics[END_REF] is not extrapolated from C but interpolated from the cell centre nearest to the point U and its neighbours.

Misalignment corrections, for the case where the face centre does not lie on the midpoint of the line CD (the point of interpolation) are not used. For the volume fraction equation, these are difficult to envisage because no useful gradient information exists. However, misalignments have a strong negative effect on the accuracy of the solution for α, so if possible the mesh should be made such that they are prevented as much as possible near the free surface.

Meshes

For this study, as usual for ISIS-CFD, unstructured hexahedral meshes generated with the HEXPRESS grid generator from NUMECA Int. are used (see figure 3 for an example). In these meshes, variations in cell size are handled by having small cells laying next to larger cells. This situation is called hanging nodes in the literature and solvers often need specific discretisations to handle these topologies. In ISIS-CFD, due to the face-based algorithm, these cells are treated in exactly the same way as all the others: the larger cells are simply seen as cells with more than 6 faces. Thus, no specific hanging-node treatment is included. Unstructured hexahedral grids are ideal for automatic grid refinement. Isotropic or anisotropic grid refinement can be applied to any of the hexahedral cells, the result will still be an unstructured hexahedral mesh. Therefore, locally refined meshes can be used directly in a flow solver that supports unstructured hexahedral meshes, without requiring changes to the flow solver.

Due to the small cell -large cell transitions, strong cell misalignments exist in parts of the grid. When the grid is refined, these situations persist: no matter the size of the grid, there will always be cells that have neighbours twice smaller than themselves. Thus, misalignment problems may limit the accuracy of the solutions, certainly if the percentage of cells which have misaligned faces remains constant when the grid is refined. The only way to ensure good grid convergence is to make sure that the number of same-sized cells between the cell size transitions becomes larger and larger as the grid is refined, so the percentage of cells that have misalignments is reduced. For automatic mesh refinement, it is therefore essential to ensure grids with smoothly varying cell sizes.

Grid refinement procedure

The grid refinement procedure developed for ISIS-CFD [START_REF] Wackers | Adaptive grid refinement applied to RANS ship flow computation[END_REF][START_REF] Wackers | Adaptive grid refinement for hydrodynamic flows[END_REF] is integrated completely in the flow solver. The method is entirely parallelised, including automatic redistribution of the grid over the processors. During a flow computation, the refinement procedure is called repeatedly. In such a call, first a refinement criterion is calculated, which is a real field variable based on the flow field that indicates where cells should be refined. Then, in a separate step of the procedure the grid is refined based on this criterion. These steps are kept separated so the criterion can be changed easily without modifying the rest of the refinement method. For steady flow, the refinement procedure eventually converges: once the grid is correctly refined according to the criterion, further calls to the procedure no longer cause any changes.

Anisotropic refinement

Grid refinement for hexahedral cells can be either isotropic, where a cell is always refined in all its directions at once, or anisotropic where division in only one or two directions is possible as well. For realistic applications, anisotropic refinement is essential. Isotropic grid refinement is very costly in three dimensions, since every refinement of a cell means a division in eight. Thus, creating very fine cells to accurately resolve a local flow phenomenon becomes far too expensive. However, by applying anisotropic refinement for flow features that require a fine grid in only one direction (notably, the water surface), the total number of cells required can be greatly reduced, or much finer flow details can be resolved.

A second reason for directional refinement is, that our refinement is based on unstructured hexahedral original grids as shown in figure 3. In these grids, cells of completely different aspect ratios lie side by side. Therefore, when refining, we need to control the size of the fine cells in all their directions independently, otherwise refined grids may have smoothly varying sizes in one direction, but repeated changes from fine to coarse and back to fine in another [START_REF] Wackers | Adaptive grid refinement for hydrodynamic flows[END_REF]. Isotropic refinement is not enough to prevent this, so directional refinement is the mandatory choice.

Tensor refinement criteria

For directional refinement, a way is needed to specify different cell sizes in different directions. The use of metric tensors as refinement criteria is such a way. This technique was first developed for the generation and refinement of unstructured tetrahedral meshes [START_REF] Alauzet | High-order sonic boom modeling based on adaptive methods[END_REF][START_REF] George | Delaunay Triangulation and Meshing -Application to Finite Elements[END_REF][START_REF] Loseille | Fully anisotropic goal-oriented mesh adaptation for 3D steady Euler equations[END_REF]. It is also an extremely useful and flexible framework for the refinement of unstructured hexahedral meshes.

In the metric context, the refinement criterion is a smoothly varying tensor field whose values at every point in the flow domain indicate what the ideal size for a cell in that position would be. As such, it can be thought of as the continuous equivalent of a mesh [START_REF] Alauzet | High-order sonic boom modeling based on adaptive methods[END_REF]. This ideal mesh depends on the flow field. There exists an 'exact' criterion which is computed from the exact solution; as the grid is refined the actual computed criterion converges to this exact criterion (this is different from the classical error indicating criteria where the criterion is halved when a cell is refined.) Adaptive grid refinement is performed to get the actual cell sizes in the refined grid as close to these ideal sizes as possible, so the refined mesh can be considered as a 'discretisation' of the criterion. Cell Ω and unit circle (reference) in the physical space, deformed cell Ω and deformed circle after application of the transformation C, refinement decisions to create a uniform grid in the deformed space, and the resulting anisotropically refined grid.

The refinement criterion in each cell is a 3×3 symmetric positive definite matrix C, which is interpreted as a geometric transformation of the cell in the physical space to a deformed space (figure 4). The refinement of the cells is decided as follows. Let the criterion tensors C in each cell be known (their computation from the flow solution is described in section 5). In each hexahedral cell, the cell size vectors d j (j = 1, 2, 3), which are the vectors between the opposing face centres in the three cell directions, are determined. Next, the modified sizes are computed as:

dj = Cd j . (9)
Finally, a cell is refined in the direction j when the modified size exceeds a given, constant threshold value T r : dj ≥ T r .

Thus, the objective of the refinement is to create a uniform grid in the deformed space. The tensors C are direct specifications of the desired cell sizes: in a converged refined grid, the cell sizes are inversely proportional to the magnitude of the C. The threshold T r functions as a global specification of the fineness of the grid; sensible choices for T r in different situations are discussed in section 7 (see also sections 5.3 and 6.1).

Grid misalignment

The convection equation for the volume fraction is sensitive to the quality of the grid, as noted in section 2.2.2. Specifically, faces parallel to the water surface that have a large cell on one side and small cells on the other (see figure 5a) cause a distortion and diffusion of the water surface, since there is a strong misalignment between the face normal and the line connecting the centres of its two neighbour cells [START_REF] Wackers | Adaptive grid refinement for unsteady ship flow and ship motion simulation[END_REF]. This problem is reduced by enforcing the refinement of extra cells to keep a good grid quality. For this, a quality criterion is applied (figure 5b): if refining the cell at one side of a face would cause too great an angle between the face normal and the line cell centre -face centre, the cell on the other side of the face is refined as well (figure 5c). The enforcement of this criterion improves the regularity of the grids at the water surface. However, on its own it is not enough.

The need for combined refinement criteria

Gravity waves in free-surface flows are usually generated by the flow passing around a foreign body, either a stationary object or a floating body such as a ship. The direct cause of the wave generation are the pressure and velocity disturbances created by the presence of this body. These disturbances are not only generated at the free surface, but also well below it; even a fully submerged object may create waves (see section 7.1 for an example). Then, once the waves are created, they propagate through a cyclic exchange of potential (gravity) and kinetic energy. Water particles in a travelling wave field describe an orbital motion; the velocities associated with this motion cause the propagation of the wave energy. Thus, to correctly resolve the generation and the propagation of a travelling surface wave, a good resolution must be obtained for the pressure and velocity fields below the surface, as given by equations ( 1) and ( 2). Accurate computation of the volume fraction equation ( 3) is of prime importance as well. As the water surface is physically a discontinuity, the interface region for the volume fraction α must be as sharp as possible. This is the reason for the use of antidiffusive schemes for the volume fraction equation (section 2.2), which can be shown to give less numerical damping of waves than diffusive schemes [START_REF] Queutey | An interface capturing method for free-surface hydrodynamic flows[END_REF]. It follows that a coarse grid at the free surface will also damp out waves. In our experience, the grid at the surface needs to be about twice as fine as the grid used in the vicinity of the surface, in order to resolve equation ( 3) correctly [START_REF] Wackers | Adaptive grid refinement for unsteady ship flow and ship motion simulation[END_REF].

Thus, to create suitable grids, a grid refinement criterion for free-surface wave simulation must be based both on the pressure and velocity field and on the volume fraction. For these two, different indicators must be used. The reason for this is, that α is discontinuous at the free surface and constant everywhere else, while the pressure and the velocity are smooth in the whole flow field except at the surface. Therefore, spatial derivative based error indicators can be used to identify the regions of importance for the flow field below the surface, but not to find the water surface itself, since any derivative-based indicator applied to α would go to infinity when the grid is refined.

Also, grid misalignment must be avoided in the free-surface region, as it leads to large errors in the volume fraction (section 3.3). Therefore, the grid specified by the criterion must be as uniform as possible near the surface. Numerical evaluations of the derivatives of α can never be smooth, so they are not suitable for guaranteeing a uniform grid. Instead, a criterion can be based on the value of α itself.

Therefore, a suitable refinement criterion for water flow with waves is an error indicator for the flow field and a simpler criterion for α, combined into one.

Free surface -pressure Hessian criterion

For the simulation of flow with waves, we propose a criterion based on the Hessian matrix of second derivatives of the pressure, combined with a criterion that refines in the normal direction of the surface for those cells where α is neither 0 nor 1. This section describes both of these criteria individually, then shows how they can be combined into one.

Free-surface criterion

To resolve accurately the solution of equation ( 3) which is a discontinuity for α that is convected with the flow, it is sufficient to refine the grid at and around the free surface, in the direction normal to the surface. When the surface is locally aligned with the cell directions, anisotropic refinement can be used to keep the total number of cells as low as possible. As noted in the previous sections, it is important that cells locally have the same size, to prevent misalignments near the surface.

The free-surface criterion C S is based on α in the cells, it is non-zero when α is neither 0 nor 1. The normal direction to the surface is computed from a field α s which corresponds to α, smoothed out by averaging over a cell and its neighbours a given number of times. The gradient of this field gives the normal directions. The criterion is then derived from vectors v α in each cell which are unit vectors in this normal direction for those cells where the smoothed α s field is non-zero:

v α = ∇αs ∇αs if 0.1 ≤ α s ≤ 0.9, 0 otherwise. ( 11
)
Using the smoothed field guarantees that the normals are well defined and also that the mesh is refined in a certain zone around the surface to create a margin of safety.

In tensor form, the free-surface criterion is computed as matrices having only one non-zero eigenvalue, associated with the direction of the vector v α . The tensors C S are computed as follows (with ⊗ representing the tensor product):

C S = v α ⊗ v α . (12)
In the directions normal to the vector v α , the eigenvalues are zero. This implies a modified cell size of zero (equation ( 9)). As a consequence, the grid is not refined in these directions, the original cell sizes are kept. Since the v α are unit vectors near the surface, the only non-zero eigenvalues of C S are equal to 1. Thus, from equation [START_REF] Karlsson | Implementation of anisotropic mesh refinement in OpenFOAM[END_REF] it follows that the threshold value T r directly indicates the desired cell size at the surface. We also see that the specified cell size normal to the surface is exactly the same in all surface cells, as required. The free-surface criterion has been used on its own, with good results, in our earlier work [START_REF] Wackers | Adaptive grid refinement for unsteady ship flow and ship motion simulation[END_REF][START_REF] Wackers | Adaptive grid refinement applied to RANS ship flow computation[END_REF][START_REF] Wackers | Adaptive grid refinement for hydrodynamic flows[END_REF].

Computing the pressure Hessian

Hessian-based criteria are often used to control anisotropic grid refinement [START_REF] Alauzet | High-order sonic boom modeling based on adaptive methods[END_REF][START_REF] Loseille | Fully anisotropic goal-oriented mesh adaptation for 3D steady Euler equations[END_REF][START_REF] Majewski | Anisotropic adaptation for flow simulations in complex geometries[END_REF], since various demonstrations show that the Hessian matrix can be considered as an indicator of the local truncation error. Here this criterion is based on the pressure, because of our refinement strategy in boundary layers [START_REF] Wackers | Adaptive grid refinement for hydrodynamic flows[END_REF]. We consider that the number of layers in the boundary layer grid should be the same everywhere, to ensure the best grid quality. And since the approximate thickness of the boundary layer is known, these grid layers can be inserted on the original grid. Therefore, it is unnecessary to employ a criterion which has very high values in the boundary layer region. The pressure varies little over the thickness of a boundary layer, so its second derivatives there are limited.

To compute the Hessian matrix of a numerical solution, second-derivative operators must be discretised. A particular complication for this discretisation is that our meshes always contain places where the grid size changes abruptly, as small cells lie next to twice larger cells (see section 2.3). These places do not disappear when the mesh is refined, on the contrary their number increases significantly when automatic refinement is used. However, many discretisations of the second spatial derivatives depend on the mesh becoming smoother and smoother as it is refined, in order to obtain second-order accuracy. In particular, the well-known computation of the Hessian by using the Gauss theorem for finding the gradients of the quantity, then applying the Gauss theorem again to the gradients in order to compute the second derivatives, has an accuracy of order zero in places where the grid size changes abruptly. A suitable technique for computing the Hessian, on the other hand, must be insensitive to these cell size changes. This section describes two possible ways of computing the Hessian matrix.

Definition of the Hessian criterion

The pressure Hessian matrix is:

H(p) =   (p) xx (p) xy (p) xz (p) xy (p) yy (p) yz (p) xz (p) yz (p) zz   . (13)
This matrix can be used directly as a tensor refinement criterion. However, if we assume heuristically that an indication of the local truncation error is given by H times the cell sizes to a power b (where b depends on the numerical method), equidistribution of this error indicator leads to a refinement criterion where the Hessian matrix is modified with a power law:

C H = (H(p) a ), (14)
where H a has the same eigenvectors as H and eigenvalues that are those of H (in absolute value) to the power a = 1 b . In general, we use a = 1 2 which is appropriate for a second-order accurate discretisation.

Third-order least-squares (LS3) approximation

A first solution for the computation of the Hessian is to use a least-squares approximation [START_REF] Wackers | Adaptive grid refinement for hydrodynamic flows[END_REF]. In each cell, we construct a least-squares fit of a third-order polynomial to the solution in the cell, its neighbour cells and its neighbours' neighbours. The approximated Hessian is then computed from the second derivatives of this polynomial. Let P j (x), j = 1 • • • 20 be the set of basic three-dimensional polynomial functions in x of up to third order (i.e.

P 1 (x) = 1, P 2 (x) = x, P 3 (x) = y, • • • , P 5 (x) = x 2 , • • • , P 11 (x) = x 3 , • • • ,P 20 (x) = xyz)
. Furthermore, I is the vector of cell indices of a cell i, its neighbours and its neighbours' neighbours. Then we shall search coefficients β such that the polynomial:

φ(x) = 20 j=1 β j P j (x -x i ), (15)
is the closest fit to the values of p in the cell centres of I, within the space defined by the set P j (xx i ). Defining the matrix A and vector b as:

A jk = P j (x I k -x i ), b k = p I k , j = 1 • • • 20, k = 1 • • • size(I), (16)
the coefficients β are found as:

β = (A T A) -1 A T b. (17)
According to the definition of the least-squares procedure, there is no better third-order polynomial fit to the points I, so the error in the fit is at least fourth-order. Therefore, if p is a sufficiently smooth function, the approximated Hessian H LS3 (p) is a second-order accurate approximation to H(p) (two orders are lost by the double differentiation). Tests with manufactured solutions in [START_REF] Wackers | Adaptive grid refinement for hydrodynamic flows[END_REF] confirm this on our refined grids.

Smoothed Gauss (SG) method

Unfortunately, the numerically evaluated pressure p h is not a smooth function. Our SIMPLE-based pressure equation contains a Laplace-type operator in finite-volume form, for which the fluxes over the faces are based on the normal derivatives of the pressure computed with equation ( 8). On arbitrary meshes, these are first-order accurate. Therefore, the truncation error of the Laplace equation which contains the derivatives of the fluxes is formally of order zero. The solutions for the pressure still have at least first-order accuracy (p h = p + O(h) where h is a measure of the grid size), because these local truncation errors depend on the relative sizes of a cell and its neighbours so they have opposite signs in small and large cells lying next to each other, which means that they mostly cancel globally. However, the second derivatives of the pressure appear directly in the pressure equation so they have the same order of accuracy as the truncation error, i.e. H(p h ) = H(p) + O(1). It has been numerically confirmed for an 1D case that the LS3 Hessian gives errors of order zero where small cells lie next to larger cells. The consequence for grid refinement is, that refining cells creates large errors in the Hessian on the boundaries between finer and coarser cells. Thus, the grid is not only refined where the solution dictates it, but also in places where it has already been refined. This spurious refinement leads to irregular meshes.

As the error in the Hessian is related to small-scale irregularities in the pressure field, it can be reduced by smoothing. Therefore, we define a smoothed Gauss (SG) Hessian. Let the Gauss approximation to the gradient of a field q be given as:

-→ ∇ G (q) = 1 V f q f S f n f , (18)
where the face values q f are computed with the expression (5) and V is the volume of the cell, S f are the areas of the faces. With the same face reconstructions, a Laplacian smoothing L is defined as:

L(q) = f q f S f f S f . ( 19
)
Then the SG Hessian is computed as follows:

1. Compute the gradient of p using Since the error in the pressure p h has an oscillatory component of O(h 2 ), differenciating this solution creates an oscillatory error of O(h) in the first and O(1) in the second derivatives. The smoother L uses the same type of interpolation to the faces as the Laplace operator in the pressure equation, so it produces O(h 2 ) oscillations itself. Therefore, L cannot increase the smoothness of p h , which is the reason why the pressure is not smoothed. On the other hand, the smoothing of the gradients (2) is essential. The O(h) wiggles in -→ ∇p h are small compared to the gradient of p so smoothing is very effective for removing these wiggles. The new O(h 2 ) oscillations introduced by L are inoffensive since the gradients are only differenciated once more. In the Hessian, the remaining oscillations of the original solution are of the same order as the solution itself so smoothing cannot improve the accuracy. The step ( 5) is only applied to create better mesh quality through a smoother criterion.

-→ ∇ G , 2
The resulting Hessian is not second-order accurate but its smoothness makes it interesting as a refinement criterion, since smooth criteria provide good mesh quality. However, smoothing decreases the spurious oscillations in the refinement criterion but also reduces the intensity of physical small-scale features. This limitation of the criterion is the reason that all smoothing should be kept to a minimum.

Hessian at the free surface

The Hessian criterion cannot be directly evaluated at the free surface. The pressure derivatives are proportional to the density ρ according to equation (1), so the exact pressure gradient has a discontinuity in the normal direction at the free surface and the second derivative is a Dirac δ function. For numerical solutions, the second derivative in the zone of varying α has a peak which grows as the grid becomes finer. Numerical differentiation produces large errors in this case.

As a result, no correct values can be computed for the pressure Hessian around the surface so an approximative procedure is needed. For LS3 (section 5.2.2) it is considered that, while the Hessian has a peak at the surface, this peak is associated with an eigenvalue normal to the surface. The pressure gradient parallel to the surface is approximately zero, so the second derivative parallel to the surface is close to zero as well. Therefore, we compute the Hessian at the surface from the unmodified pressure, then we limit all eigenvalues of the matrix C H (equation ( 14)) at the surface to a constant value. The LS3 Hessian criterion then behaves like the free-surface criterion around the surface.

For the smoothed Gauss evaluation (section 5.2.3), this procedure is impossible since the smoothing spreads out the discontinuity in the first and second derivatives, thus creating high values of the Hessian in a large zone around the surface. Therefore, the gradient smoothing (step (2) of the algorithm in section 5.2.3) is not performed in those cells where 0.0001 ≤ α ≤ 0.9999. The Hessian is smoothed in three steps: 5a. Smooth the Hessian in all cells except those where 0.0001 ≤ α ≤ 0.9999 plus two layers of cells around those, to take into account that the perturbed pressure gradient in the cells at the surface influences the Hessian in their neighbours as well.

5b. Copy the computed values of the Hessian from outside the zone in (5a) across the zone, following the vertical direction (this removes the peak at the surface). The criterion is copied in the upward direction, so the Hessian values computed in the water are used across the surface region.

5c. Smooth the Hessian only in the zone of (5a).

The idea of this approach is, that the SG Hessian at the surface must not be used. Therefore, sensible values must be copied from elsewhere. While both this procedure and the one for the LS3 criterion are heuristic, they work well in practice as will be shown in section 7.

The combined criterion

The final criterion is a combination of the two criteria above. Considering the problems of the Hessian criterion at the surface, it is tempting to select the free-surface criterion there and the Hessian criterion everywhere else. However, the free-surface criterion specifies no refinement in the direction parallel to the surface, while this refinement may be needed if only to ensure that the grid at the surface is not less refined than just below it. Therefore, the Hessian criterion must be considered everywhere (this explains why the approximative procedures detailed above are necessary). On the other hand, while the LS3 Hessian has a behaviour similar to a free-surface criterion, the real free-surface criterion is used as well because it guarantees that the grid at the surface is absolutely regular and that a safety zone of refined cells is generated around the surface. The criterion in each cell is thus computed from both criteria. The tensor criteria are combined into one by taking a weighted maximum of the two tensors. We want the threshold T r to indicate directly the desired cell size at the surface (as for the free-surface criterion), so a weighting factor c is applied only to the Hessian criterion:

C C = max (C S , c C H ) . ( 20
)
The approximate maximum of the two tensors is computed using the procedure described in [START_REF] Wackers | Adaptive grid refinement for hydrodynamic flows[END_REF], which is an improvement of the one in [START_REF] George | Delaunay Triangulation and Meshing -Application to Finite Elements[END_REF]. First, the eigenvalues and eigenvectors of the two tensors are computed. Then new eigenvalues for each tensor are set as as the maximum of the original eigenvalue and the length of the corresponding eigenvector when it is multiplied by the other tensor. This gives two approximations to the maximum tensor; the final tensor in each cell is the element-by-element average of these two.

Proportionality and scaling rules

Inherent in the choice of a combined refinement criterion is the need to define the proportionality between the criteria being combined. In our criterion, the proportionality is given by the factor c in equation [START_REF] Rhie | A numerical study of the turbulent flow past an isolated airfoil with trailing edge separation[END_REF].

No universally valid expression for c exists, since the choice depends on the problem and on the output quantities of interest. However, it is possible to give guidelines for c purely in terms of the non-dimensional characteristics of the flow, since the scaling of the flow does not influence the optimal mesh. This section first derives a scale-independent form for the weighting, then discusses which non-dimensional parameters should be taken into account when constructing guidelines for c. Some practical advice for choosing c will be discussed during the analysis of the test cases in section 7.

Scale-independent form of c

Let a flow problem be characterised by a geometry-based reference length L, velocity V ∞ , and gravity g, as well as a density ρ ∞ and a kinematic viscosity µ ∞ . In a liquid-gas two-fluid flow the latter two will generally be the properties of the liquid, since this is the dominant fluid in the interaction. With these, we define non-dimensional coordinates and pressure:

x = x L , c p = p -p ∞ 1 2 ρ ∞ V 2 ∞ , (21)
as well as the Reynolds and Froude number:

Re = ρ ∞ V ∞ L µ ∞ , F r = V ∞ √ gL . ( 22
)
Now consider two flows that are identical up to a scaling factor, i.e. they have the same non-dimensional pressure distribution c p (x). It is logical to require that these flows get the same refined mesh in xcoordinates; one mesh should be a scaled version of the other. This also guarantees that identical meshes are produced when a problem is computed in dimensional or in non-dimensional form. For two such scaled flows, the free-surface part of the refinement criterion has identical values, since its eigenvalues are equal to 1 at the surface (see section 5.1). It follows that the pressure-Hessian part of the criterion should also be the same for the two flows, which is obtained when the product c C H is non-dimensional. The Hessian matrix H has the dimension of the second spatial derivative of the pressure and scales therefore with 1 2 ρ ∞ V 2 ∞ /L 2 . Taking into account the power a from equation ( 14), a non-dimensional criterion is obtained by setting c as:

c = c L 2 1 2 ρ ∞ V 2 ∞ a . ( 23
)
The new proportionality factor c is non-dimensional. For constant c the entire refinement criterion is identical for the two flows so similar meshes can be obtained, as in the case for the pure free-surface criterion, by setting the threshold T r proportional to L (see equation [START_REF] Karlsson | Implementation of anisotropic mesh refinement in OpenFOAM[END_REF]). The parameter c will be used to formulate guidelines for the proportionality which do not depend on the scaling of the problem.

Dependence on F r

The question remains, how c should depend on the non-dimensional parameters of the problem. For typical water flows, the influence of Re is weak, since the boundary layers are thin and have little effect on the pressure. Thus, the criterion with scaling ( 23) is already more or less independent of Re, so there is no reason to modify c with this parameter. However, the influence of F r is significant. To analyse the effect of the Froude number on the pressure Hessian for waves around objects in steady motion, we will study a simple example: 2D linear waves.

Hessian criterion in linear waves

Consider a travelling wave of moderate amplitude in deep water. Supposing irrotational flow gives the following velocity potential [START_REF] Stoker | Water Waves -The Mathematical Theory with Applications[END_REF]:

Φ = A exp (kz) cos (k (x -υt)) , (24)
for the amplitude A, where the wave number k = 2π λ . The wave length λ and the celerity υ are linked through the dispersion relation υ 2 = gλ 2π or, in non-dimensional form:

ῡ = λ 2πF r 2 , ( 25
)
where the non-dimensional quantities are ῡ = υ V∞ and λ = λ L . Furthermore, let k = kL, Ā = A LV∞ and t = tV∞ L . With the unsteady form of Bernoulli's equation we find the pressure:

c p = - 2z F r 2 + 2ῡ Ā F r 2 exp z F r 2 sin x -ῡt F r 2 , ( 26
)
The (dimensional) 2D Hessian becomes:

H = 1 2 ρ ∞ V 2 ∞ L 2 2ῡ Ā F r 6 exp z F r 2   -sin x-ῡ t F r 2 cos x-ῡ t F r 2 cos x-ῡ t F r 2 sin x-ῡ t F r 2   . ( 27
)
Finally, we find for the Hessian contribution to the combined criterion (cf. equations ( 14), ( 20) and ( 23)):

c C H = c 2ῡ Ā F r 6 a exp az F r 2 1 0 0 1 . ( 28
)
This result indicates that the refined cell sizes in waves will increase exponentially with the depth and that the cells will be square, even when using directional refinement. In a steady flow, the waves created by an immersed object have υ = V ∞ or ῡ = 1. For these waves, the pressure at the surface (z = 0 in linear theory) becomes:

c p = 2 Ā F r 2 sin x - t F r 2 . ( 29
)
For the criterion at the surface, we get:

c C H = c 2 Ā F r 6 a 1 0 0 1 . ( 30
)
This expression can be used to study the grid refinement obtained near the surface due to the contribution of the Hessian criterion. Two extreme cases exist. For long waves at high F r, i.e. when λ ≈ L, the extreme values of c p in the wave will be proportional to the extremes on the body, which are more or less constant with F r (c p on a streamlined body varies from 1 to about -3). Thus, from (29) it follows that 2 Ā F r 2 is independent of F r, so (30) shows that c C H ∼ cF r -4a for long waves. In the typical case where a = 1 2 we get c C H ∼ cF r -2 . Given the dispersion relation [START_REF] Wackers | Sliding grids and adaptive grid refinement applied to ship hydrodynamics[END_REF] which reduces to λ ∼ F r 2 for ῡ = 1, this implies that the number of cells per wavelength is constant for varying F r when c is constant.

The other extreme situation is the creation of very short waves (λ ≪ L) at low F r. In this case the pressure field of the body, which creates the wave, can be supposed to vary linearly over the length of the wave. As a result, the extreme values of c p in the wave will be proportional to the wave length λ. Therefore, we get 2 Ā F r 2 ∼ λ ∼ F r 2 (from ( 25)) so c C H ∼ cF r -2a . For a = 1 2 this results in c C H ∼ cF r -1 so the cell sizes scale with F r when c is constant; as the wave length itself scales with F r 2 the number of cells per wavelength diminishes when F r goes to zero.

Variation of c with F r

Given the result of section 6.2.1 it makes sense to choose c, for a given type of geometry, independent of the Froude number. First of all, this means that flow phenomena near the body far below the surface (such as trailing vortices) are resolved with the same mesh density for all F r, which is good because these phenomena do not depend much on the Froude number, especially for low F r. Also, the accuracy of a computed wave is related to the number of cells per wave length, so waves at various Froude numbers are resolved with the same accuracy if c is independent of F r. Only the waves at very small F r are resolved less accurately, but even this is natural since the influence of these waves on the flow is small. However, it may also be sensible to increase c slightly with F r. A consequence of choosing c constant is, that low-F r flows require more cells than high-F r flows. Also, better accuracy may be required for waves at high F r since these waves have a stronger influence on the flow. For longer waves, the number of cells per wave length is proportional to c (see above), so setting c ∼ F r 1/2 for example results in a number of cells per wave length that varies with F r 1/2 . The test case in section 7.2 specifically adresses the choice of c depending on F r.

Test cases

This section presents three test cases which analyse the meshes created by the combined refinement criterion, the choice of the weighting factor c, and the different types of flow that can be computed with the criterion. The cases are the two-dimensional immersed wing of Duncan (section 7.1), the Series 60 ship (section 7.2), and the cavitating INSEAN E779A propeller (section 7.3).

Immersed NACA0012 wing

The first test case is meant to evaluate the behaviour of the combined refinement criterion for a twodimensional wave field. The case is the geometry studied by Duncan [START_REF] Duncan | The breaking and non-breaking wave resistance of a two-dimensional hydrofoil[END_REF], a wave train generated by an immersed NACA0012 profile of chord 0.203 m at 5 degrees angle of attack, with its centre point at 0.236 m below the surface. The inflow velocity is 0.8 m/s and Re = 1.42 • 10 The figure 6 shows the refined meshes created with the LS3 and the SG Hessian criterion of section 5.2, starting from an original mesh that has some refinement around the wing but none at all around the free surface (figure 7). The figures show that the refinement criterion detects the free surface, the pressure peaks at the leading and trailing edges, and the zone where the pressure disturbance is transferred from the wing to the surface. Little refinement is created in the air zone, since the pressure is nearly constant there; for this case, a fine grid in the air is in fact not really necessary. The SG criterion gives by far the better mesh: it is smoother around the wing and below the surface and the spurious refinement in the wake is absent. The refined wake for the LS3 criterion comes from small oscillating numerical errors in the pressure, as discussed in section 5.2.3; it is irregular and does not increase the precision of the solution. Also, the SG mesh around the surface has a continuous horizontal cell size, while the LS3 mesh is too fine at the surface. Thus, the explicit removal of the peak (step 5b in section 5.2.4) is a more robust procedure than the limiting of the LS3 criterion.

Figures 8a-c show the influence of varying T r and c for the SG Hessian. Figure 8a gives the first wave crest for a target cell size T r = 0.0025m and c = 0.002. The grid here is four times finer at the surface than just below it. When T r is increased, this ratio does not change but the entire grid becomes coarser (figure 8b). Reducing c produces a coarser grid only below the surface (figure 8c); the grid at the surface does not change. All these figures show directional refinement at the surface, the grids are coarser in horizontal direction when the surface is horizontal. The pressure Hessian criterion creates only square cells below the waves, as is predicted in section 6.2.1. In figure 8d, the position of the free surface is given for T r = 0.0025m and four different values of c. Except for the case with pure free-surface refinement (c = 0), the agreement with experiments is as good as can be expected in this case (RANS computations tend to underpredict the wave height for Duncan's case). Moreover, the results on the two finest grids produced with the combined criterion are very similar. Thus, it is not necessary to refine the grid below the surface to twice the size of the grid at the surface, four times coarser cells as obtained with c = 0.002 (corresponding to c = 0.176) are acceptable. As the total number of cells increases strongly with the parameter c (table 1), this information can be used to keep the total number of refined cells low.

Series 60 wave pattern

The goal of the second test case is to study the dependence of the refined mesh and the flow solution on the weighting factor c for a typical ship flow case at different Froude numbers. Thus, we can obtain practical guidelines for the choice of c depending on F r. The test case is the Series 60 hull in straightahead motion and calm water. While this hull form is outdated, it has the advantage of producing very clear and distinct wave patterns that are ideal for evaluating refined meshes. Detailed experiments for this case are available from IIHR [START_REF] Longo | Effects of drift angle on model ship flow[END_REF] at F r = 0.316 and Re = 5.3 • 10 6 . Apart from this Froude number, we also compute the flow at F r = 0.16 and F r = 0.41 with Re = 2.7 • 10 6 and Re = 6.9 • 10 6 respectively. Like the previous case, the computations are started from a mesh that has no initial refinement at all around the free surface, to show that a sensible refined mesh for free-surface ship flows can be obtained entirely with automatic grid refinement. This original grid has 242k cells. Based on the Duncan test case, the SG Hessian is chosen for the refinement criterion. The threshold for all computations (equivalent to the desired cell size at the surface) is kept constant, T r = 0.001L which is the usual cell size at the surface for ISIS-CFD computations without grid refinement. The weighting factor is varied: for each Froude number, the flow is computed with c = 0.016, 0.024 and 0.032 which gives the grid sizes in table 2. Reference results come from computations without grid refinement on a fine mesh of 3.45M cells. The turbulence is modelled with the Menter k -ω SST model. To analyse the flow, the wave pattern at the three Froude numbers is shown in figure 9. While the wave strength varies strongly with F r, the main diverging waves in all cases are created at the bow and the stern; for the two highest F r, the bow wave breaks. Transverse waves are visible behind the bow wave for F r = 0.16 and behind the stern for the other F r. To verify the approximations of wave length and pressure variation used to study the pressure Hessian in waves (section 6.2.1), the nondimensional length of the transverse stern wave λ = λ/L and the height of the bow wave h = h/L (first trough to second crest) measured from these plots are given in figure 10. As expected, the wave length varies linearly with F r 2 , confirming the dispersion relation [START_REF] Wackers | Sliding grids and adaptive grid refinement applied to ship hydrodynamics[END_REF]. The difference in c p over the wave height (∆c p ) is computed by noting that ∆c p ∼ g h ∼ h/F r 2 , so this quantity is plotted. ∆c p was assumed in section 6.2.1 to be constant for high F r and proportional to λ ∼ F r 2 for lower F r. The graph shows a behaviour which is neither constant nor linear in F r 2 , but increases faster for lower than for higher F r. Thus, the two approximations are reasonable as limit values for very small or large F r.

Figure 11 shows cross-sections of the mesh for the three Froude numbers at the largest weighting factor c = 0.032. Around the position of the free surface, which clearly shows the difference in wave amplitude between the cases, the meshes have directional refinement. The cell size below the surface decreases gradually from the bottom up, the finest cells are concentrated in the bow wave (left) and the stern wave (right). As for the Duncan test case, the refined cells below the waves are predominantly square, although some cells near the surface are smaller in the vertical direction. The size of the cells in the original grid can be seen in the upper right corner of figure 11b, so the entire fine grid is effectively created by automatic refinement.

To study the dependence of the mesh size on F r, the horizontal cell size in the stern wave just below the surface for the meshes of figure 11 is also given in figure 10. As the refined cells are created by division of the original cells, there is only a limited number of possible cell sizes, so the sizes for the F r = 0.316 and F r = 0.41 case are the same. Therefore, it is impossible to conclude whether the number of cells per wave length stays constant for high F r. When F r is reduced, the cell size decreases slower than the wave length so the number of cells per wave decreases. Still, for low F r the cells are smaller than for high F r. On one hand this is logical, since figure 9 reveals that the waves at F r = 0.16 are extremely fine so a good grid resolution is needed to resolve them. On the other hand, the total grid sizes are larger for small F r than for large F r (see table 2), which may seem counter-intuitive since the waves at low F r have little influence on the solution. Finally, the solutions for all cases are compared in figure 12, which shows the evolution of the free surface in three X-cuts when c is varied, compared with the non-adapted fine grid. For the highest Froude number (figure 12c), even the solution with c = 0.016 is in close agreement with the fine-grid solution, only some discrepancy can be noted for the c = 0.024 solution behind the ship. This is no longer the case at F r = 0.316 (figure 12b), where notable differences exist for c = 0.016. However, c = 0.024 gives sufficient accuracy. Finally, at F r = 0.16 (figure 12a) the computation for c = 0.016 is the closest to the fine-grid solution. Thus, this solution is probably wrong! The waves in this case have a height of less than one grid cell, a situation for which wave heights may be overpredicted on too coarse grids [START_REF] Deng | Verification and validation for unsteady computation[END_REF]. The solutions for c = 0.024 and c = 0.032 are reasonably close, so again c = 0.024 is satisfactory. The figure 12d shows velocity profiles on a horizontal line below the water at the stern. Only F r = 0.316 is shown here, since the results for all Froude numbers are similar. All c give results that are close to the fine-grid solution, the discrepancy with the experimental results may be due to the isotropic k -ω SST turbulence model which is not always well adapted to the simulation of ship wake flows [START_REF] Deng | Comparison of explicit algebraic stress models and second-order turbulence closures for steady flows around ships[END_REF][START_REF] Duvigneau | On the role played by turbulence closures in hull shape optimization at model and full scale[END_REF].

In conclusion, the analysis of the meshes for the Series 60 test case confirms the findings of section 6.2 on the behaviour of the pressure Hessian in waves. To accurately model the wave pattern, higher values for c are needed at low F r than at high F r. However, considering the weak influence of the waves on the rest of the flow field at low F r, a constant choice for c is justified, which gives the added advantage that the grid on the hull below the surface is refined in the same way for all F r. For slender hulls like the Series 60, setting T r = 0.001L to obtain the standard ISIS-CFD cell size at the surface with a value of c around 0.024 gives sufficient accuracy. Higher values of c should be used with care, since they increase significantly the total number of cells (table 2).

Cavitating INSEAN E779A propeller

The two-fluid mixture model framework can also be used for the modelling of cavitation. For these computations, water and its vapour are considered as two separate fluids so evaporation and condensation are transformations from one of the fluids into the other. These transformations are produced by a source term in equation [START_REF] Deng | Verification and validation for unsteady computation[END_REF]. Different approximative cavitation models exist in the literature, we use the model of Merkle [START_REF] Merkle | Computational modeling of the dynamics of sheet cavitation[END_REF] which expresses the production or destruction of vapour as a function of the difference between the pressure and the vapour pressure.

To demonstrate that combined grid refinement may also be useful for this particular kind of flow, an initial test case is presented: the INSEAN E779A propeller is simulated in open-water conditions, for a regime with steady sheet cavitation on the propeller blades and cavitating cores in the trailing vortices. The propeller with diameter D = 0.227m runs at n = 36rps with an advance coefficient J = V∞ nD = 0.71 and a cavitation number σ = p∞-pvap 1/2ρ∞V 2 ∞ = 3.5. Experiments for this case have been performed by CNR-INSEAN [START_REF] Pereira | Measurement and modelling of propeller cavitation in uniform inflow[END_REF][START_REF] Salvatore | Propeller cavitation modelling by CFD -Results from the VIRTUE 2008 Rome workshop[END_REF]. The flow requires a very fine resolution of the vortices, in order to capture the low pressure peaks in the cores. The advantage of the combined refinement criterion here is that the Hessian part detects the entire structure of the vortices, while the free-surface criterion ensures that the cavitating core has a regular, fine grid.

The computation is started on a coarse grid that has 770k cells, with some refinement around the blades but very little in the wake zone. The free-surface refinement for the combined criterion is based on the volume fraction of the vapour. A single computation is performed with a threshold T r = 0.0012 and a scaling factor c = 0.000012. The refined mesh has 1.23M cells. As a reference, the computation is also performed on the coarse grid without adaptive refinement. The LS3 Hessian is used, rather than the smoother and more robust SG Hessian, since it gives a sharper definition of the vortex core. In fact, the pressure gradient in the core varies rapidly in space, so any smoothing of the gradient affects the Hessian, lessening the amount of grid refinement in the core.

The computed cavitation zones are given in figure 13. Compared with the cavitation observed experimentally (figure 14), the outline of the vapour bubble computed on the refined grid comes close. The pocket on the blade has the right shape, both the tip and propeller hub vortices are clearly seen and the characteristic rollup of the tip vortices is reproduced correctly in the simulation. This is different for the original-grid solution. While the sheet cavitation on the blades is reasonable and similar to the different numerical results presented by [START_REF] Salvatore | Propeller cavitation modelling by CFD -Results from the VIRTUE 2008 Rome workshop[END_REF], the cavitation in the trailing vortices is not simulated at all.

The main difference between the adapted-grid simulation and the experiments is, that the cavitating tip vortices do not persist over a very long distance. We have also observed this effect for non-cavitating propellers, it is due to the damping out of the pressure peak in the vortex cores caused mainly by the RANS turbulence models, which overpredict the turbulent viscosity in the core. Numerical diffusion from the spatial and temporal discretisation also contributes. However, the vortices do not disappear when the cavitating cores collapse. A cross-section of the mesh (figure 15) shows grid refinement in the cores of the first and second vortices downstream of the blade tips, which means that a low pressure peak persists over this distance. The influence of these vortices on the flow near the propeller is therefore taken into account for the simulation of the cavitation near the tips. As these non-cavitating vortex cores cannot be detected by a free-surface refinement criterion alone, this clearly demonstrates the value of a combined criterion. This cavitation study is preliminary, since the influence of different models, model settings, and indeed the interaction between the cavitation model and the grid refinement were not tested. Also, sensible guidelines for choosing c and the threshold T r are not yet available. However, these first results indicate that continuing such research is worthwile.

Conclusion

Grid refinement criteria are studied for automatic mesh adaptation in free-surface flow simulation. It is shown that these criteria must refine both around the surface, to resolve the convection equation for the volume fraction, and in the region below it in order to capture the orbital flow fields. While derivativebased criteria suitable for detecting the velocity and pressure fields can in principle locate the free surface, a dedicated robust free-surface capturing criterion is preferred in order to ensure a regular mesh at the surface and to prevent errors in the volume fraction coming from cell misalignment. Thus, the refinement criterion must be a combination of a free-surface criterion with a derivative-based sensor.

We choose a criterion which combines directional refinement in the region where the volume fraction is between 0.1 and 0.9 with refinement based on the pressure Hessian. The difficulty in obtaining an accurate and smooth Hessian criterion lies in the numerical evaluation of second spatial derivatives on unstructured meshes. An evaluation using least-squares interpolation with third-order polynomials (LS3) is presented, which is insensitive to the mesh geometry. However, this formulation still produces irregular criteria since the pressure solution itself is non-smooth. This leads us to a second type of computation (SG) where Gauss derivation is used twice to compute first the gradient of the pressure and then its Hessian. Both the gradient and the Hessian are smoothed after their computation, to remove irregularities. Numerical tests show that SG gives much better mesh quality in waves than LS3, so it is the preferred choice for combined refinement. However, the smoothing may damp out small-scale structures such as vortex cores, so the LS3 Hessian is better adapted for these flows; improving the vortex-capturing performance of the SG Hessian is a subject for further study.

The numerical pressure Hessian has a peak at the free surface, due to the discontinuity in the pressure gradient. For LS3, this peak is conserved since it is associated with an eigenvector normal to the surface; the Hessian therefore acts like the free-surface criterion at the surface. The peak eigenvalue is simply limited to a given maximum. This is not possible for SG, since the smoothing diffuses the peak. Therefore, the free-surface region is not smoothed and the computed Hessian outside the surface zone is extrapolated through this zone. This technique performs best, since it is shown to produce no unnecessary refinement parallel to the surface.

When combining two refinement criteria, the relative weight of each criterion must be chosen. Since the free-surface criterion is non-dimensional, it is useful to introduce a non-dimensional scale-independent form for the Hessian criterion as well, with a weight c. This weight can be set independently of the Reynolds number for the flow, since the pressure for typical hydrodynamic flows varies little with Re. Analysing the dependence of the Hessian on the Froude number, we find that in gravity waves for a constant c, the number of cells per wave length remains constant for high F r and diminishes for low F r. A numerical test on the Series 60 hull shows that, to get good accuracy for the free surface, a higher value for c is needed at low F r than at high F r. However, due to the limited influence of the free surface on the flow at low F r, it is acceptable to choose c independently of F r. Sensible values for slender ships are c = 0.02 -0.025 with a refinement threshold set around T r = L/1000.

The ultimate goal of combined refinement criteria for free-surface flows is to generate fine meshes of good quality entirely with grid refinement, starting from uniformly coarse original meshes. Thus, a user does not need to take into account the free surface when generating this original mesh, which greatly simplifies the setup of a computation and even forms an important step towards the automatisation of simulation. For three different free-surface test cases, including a case with cavitating flow, the current paper has demonstrated such mesh generation. Creating complete free-surface meshes with grid refinement therefore seems entirely possible.

Figure 1 :

 1 Figure 1: Cell face notations.

Figure 2 :

 2 Figure 2: Points for NVD face reconstruction. The points C and D are the neighbouring cells of the face f , the point U is the mirror image of D with respect to C.

Figure 3 :

 3 Figure 3: Cut through an unstructured hexahedral mesh.

Figure 4 :

 4 Figure

Figure 5 :

 5 Figure 5: Misalignment distorts the water surface (a), the curves are volume fraction isolines. Quality criterion (b): large angles between face normals and lines cell-face are forbidden. Added refinement (c).

, 4 .

 4 . Smooth each component of the gradient by applying N times the smoothing L, where N = 4 is sufficient in most cases, 3. Compute the gradients of the smoothed gradient components using -→ ∇ G Symmetrize the resulting Hessian matrix by setting (H) ij = 1 2 ((H) ij + (H) ji ), 5. Smooth the Hessian by applying N times L to each component.

Figure 6 :

 6 Figure 6: Refined mesh around the immersed profile for the Duncan case with c = 0.002. The Hessian is evaluated with SG (a) and LS3 (b).

Figure 7 :

 7 Figure 7: Original mesh for the Duncan case.

Figure 8 :

 8 Figure 8: Refined meshes at the first wave crest for the Duncan case with T r = 0.0025, c = 0.002 (a), with T r = 0.005, c = 0.002 (b), and with T r = 0.0025, c = 0.001 (c). Figure (d) compares the wave elevation for T r = 0.0025 and four different c with Duncan's experiment [5].

Figure 9 :

 9 Figure9: Wave patterns for the Series 60 at F r = 0.16 (a), F r = 0.316 (b), and F r = 0.41 (c). The isoline distance is the same for all figures and corresponds to L/1000. The F r = 0.316 result is compared with experiments from IIHR[START_REF] Longo | Effects of drift angle on model ship flow[END_REF].

Figure 10 :Figure 11 :

 1011 Figure 10: Nondimensional stern wave length, bow wave height, and horizontal cell size at the stern wave in the automatically refined meshes (c = 0.032) for the Series 60 test case at different F r.

Figure 12 :

 12 Figure 12: Series 60, comparisons of the water surface in three X-cuts at F r = 0.16 (a), F r = 0.316 (b), and F r = 0.41 (c). Comparison of the velocities on the line X/L = 1, Z/L = -0.02 (d) for F r = 0.316. Experiments from IIHR [13].

Figure 13 :

 13 Figure 13: Computed surface of the cavitating pockets (isovalue α = 0.5) for the INSEAN E779A propeller, on the original grid (a) and the adaptively refined grid with T r = 0.0012 (b). (The small spots on the surface are plotting artefacts.)

Figure 14 :

 14 Figure 14: Experimental view of the cavitation on the E779A propeller, from CNR-INSEAN [17].

Figure 15 :

 15 Figure 15: Refined grid in the Y = 0 plane for the INSEAN E779A propeller.

Table 1 :

 1 Number of cells in the refined meshes, Duncan test case with T r = 0.0025.

	c	0	0.001 0.002 0.004
	c	0	0.088 0.176 0.352
	cells 8151 14392 25848 54890

Table 2 :

 2 Number of cells in the refined meshes for the Series 60 test cases.

	c	0.016 0.024 0.032
	F r = 0.16	698k 1169k 1793k
	F r = 0.316 597k	892k 1360k
	F r = 0.41	757k	973k 1348k

Acknowledgements

The authors thank Master students A. Jebali, for his contribution to the validation of the combined criterion, and F. Lemoine, for his work on the application to cavitation. Computations were performed using HPC resources from GENCI (Grant2010-x2010021308), which is gratefully acknowledged.