1 Introduction

International shipping is responsible for transporting around 90% of the global trade. The dominant role of shipping is attributable to the low-fuel consumption per tonne-km of transported cargo. However, the mere magnitude of the many ten thousand operating vessels puts environmental and economic aspects of shipping into the focus of regulatory provisions. The seaborne pollution and approximately 50% of the direct operating costs for shipping are related to fuel consumption, which in turn is governed by the vessel’s resistance. Therefore, reducing the hydrodynamic drag, even by a few per mille, is highly appreciated from commercial and environmental perspectives. The endeavor for shortening development cycle times shifts the center of interest towards simulation-based approaches.

Marine engineering two-phase flow simulations mainly refer to Volume-of-Fluid (VoF) methods, cf. Hirt and Nichols (1981), which reconstruct the free surface from an indicator function that quantifies the volume concentration of the participating phases. The popularity of VoF methods is due to the simplicity of a shared kinematics approach, the inherently conservative formulation, and the capability to predict merging and rupturing of free surfaces. When attention is directed to the simulation-driven optimization of non-parameterized industrial shapes, gradient-based local optimization procedures using adjoint formulations are perhaps the most efficient approach to complement the simulation process by an optimization component. The efficiency benefits of the adjoint method increase with the number of degrees of freedom, and the procedure requires an established reference/initial design. Both aspects apply to the optimization of industrial shapes.

Industrial applications of adjoint methods to optimize fluid dynamic shapes have reached an impressive level of maturity for single-phase flows, cf. Othmer (2014) or Papoutsis-Kiachagias and Giannakoglou (2016). However, adjoint applications to marine engineering two-phase flows remain in their infancy. Significant challenges refer to the substantial Reynolds number turbulent flow and the immiscible two-phase flow characteristics that feature a discontinuous property change across the interface. Moreover, the dynamic floatation alters the drag, which interacts with the shape modification. In addition, hull shape updates are usually constraint to a sufficient level of smoothness and must conserve the vessel’s displacement. Therefore, only a few applications were previously published for adjoint optimizations in marine engineering two-phase flows, cf. Palacios et al. (2012), Springer and Urban (2015), Kröger et al. (2018) and He et al. (2019).

The adjoint analysis aims at the efficient computation of derivative information for an integral objective functional with respect to (w.r.t) a general control function, cf. Giles and Pierce (1997), Giles and Pierce (2000), Kröger et al. (2018), Papoutsis-Kiachagias et al. (2019). Two competing methods, known as the continuous and the discrete adjoint approach, are widely employed, cf. Peter and Dwight (2010). In continuous space, the dual or adjoint flow state can be interpreted as a co-state that follows from the primal flow model. However, the formulation of boundary conditions and the choice of an appropriate discretization of the underlying Partial Differential Equation (PDE) system is not intuitively obvious in a continuous adjoint framework. The situation gets more delicate for complex flow models with possibly non-differentiable expressions and larger PDE-systems featuring an augmented level of non-linearities. Related marine engineering examples refer to the aforementioned discontinuous property changes and the many inter-parameter couplings between the momentum/continuity equations on the one hand and the equation governing the indicator function on the other hand. Another frequently debated topic is the adjoint treatment of turbulence usually modeled by transport equations in a Reynolds-averaged Navier-Stokes (RANS) framework. Practical solutions found in the literature often suggest the neglect of adjoint variables and are frequently labeled “incomplete” or “frozen” adjoint strategies, such as the “frozen turbulence” or the “frozen free surface” approach, e.g. Soto et al. (2004), Dwight and Brézillon (2006), Martinelli and Jameson (2007), Othmer (2008), Stück (2012), Marta and Shankaran (2013) and Kröger et al. (2018)

Without a doubt, frozen adjoint strategies impair the computed sensitivity derivative and, at the same time, grossly simplify its calculation. The degree of derivative uncertainty is, however, debatable, cf. Zymaris et al. (2010), Hartmann et al. (2011), Marta and Shankaran (2013), Papoutsis-Kiachagias et al. (2015), Kavvadias et al. (2015), Manservisi and Menghini (2016a, b). To assure consistent and synchronized primal and dual development states, discrete adjoint approaches based upon automatic differentiation were suggested by, e.g., Nielsen et al. (2004, 2010) or Nielsen and Diskin (2013), Burghardt et al. (2022). The approach passes over the adjoint PDE and directly bridges a discrete linearized primal system into a consistent dual system, cf. Giles and Pierce (1997, 2000) or Vassberg and Jameson (2006a, b).

Despite the various merits and drawbacks of the discrete vs. the continuous adjoint method, the authors believe that the latter offers significant cost benefits for large-scale parallel implementations. Moreover, it is unique for its invaluable contribution to a physical understanding, i.e., the challenges mentioned above often disclose the weaknesses of the flow model. Nonetheless, considering the full range of inter-parameter couplings of a consistent framework can hamper the robustness and efficiency, mainly if a sequential or partly sequential algorithm is employed, while accuracy implications of a frozen turbulent two-phase adjoint approach are not well understood.

Therefore, the present contribution scrutinizes selected continuous adjoint formulations using a conventional pressure-based, sequential finite-volume algorithm, see Ferziger and Peric (2012), for optimizing the shape of free-floating ships. Attention is restricted to a two-phase flow RANS procedure using an SST kω model coupled to a motion modeler. A CAD-free shape update is used under restrictions of the length and the hull’s displacement. Novel aspects refer to the adjoint two-phase flow approach and the application to high Reynolds number free-floating full-scale configurations using a simplified algebraic adjoint turbulence treatment. Moreover, we present a novel strategy to preserve the displacement and restrict the length within a volume-based identification of the descent direction. The employed formulation aims to balance accuracy opportunities and efficiency weaknesses using “improved frozen” approaches that retain the algorithmic benefits and preserve the predictive realism in practical marine flows.

The remainder is organized as follows: Sect. 2 is concerned with the derivation of the mathematical model. Section 3 outlines our approach to adjust the floatation and to simultaneously update the mesh and the shape under the aegis of geometric constraints. Subsequently, the numerical method and the optimization procedure are briefly outlined in Sect. 4. Section 5 is devoted to the validation for 2D flow around a submerged cylinder. Section 6 scrutinizes the performance of the optimizer for a total drag objective applied to an offshore supply vessel at full scale. Section 7 provides conclusions and outlines future research. The publication employs Einstein’s summation convention for lower-case Latin subscripts. Vectors and tensors are defined with reference to Cartesian spatial coordinates, e.g., \(x_k\), and the spatial derivative vector refers to \(\nabla_k\).

2 Mathematical model

2.1 Two-phase model

The paper deals with the flow of two immiscible, inert fluids (ab) featuring constant bulk densities (\(\rho_{\rm a}, \rho_{\rm b}\)) and bulk viscosities (\(\mu_{\rm a}, \mu_{\rm b}\)). Fluid a is referred to as foreground fluid and fluid b as background fluid. In the present study, the foreground fluid typically refers to air and the background fluid to water. Both fluids are assumed to share the kinematic field along the route of the VoF-approach suggested by Hirt and Nichols (1981). The spatial distribution of the fluids is described by an Eulerian concentration field, where \(c=c_{\rm a}=V_{\rm a}/V\) denotes the volume concentration of the foreground fluid, and the volume fraction occupied by the background fluid refers to \(c_{\rm b}=V_{\rm b}/V=(V-V_{\rm a})/V=(1-c)\).

2.1.1 Concentration transport

The material properties of immiscible and inert fluids are invariable. The (foreground) fluid concentration of a VoF model, therefore, follows from a simple Lagrangian transport equation, i.e. \(\text{d}c_{\rm a}/\text{d}t (=-\text{d} c_{\rm b}/\text{d}t) =\text{d}c/\text{d}t =0\), which is translated into an Eulerian formulation prior to its discretization. More elaborate diffuse interface methods exist, which are frequently labeled Cahn–Hilliard (CH) models, cf. Cahn and Hilliard (1958), Lowengrub and Truskinovsky (1998), Jacqmin (1999), Abels et al. (2012). CH models replace the sharp interface with a thin layer where the fluids exchange mass fluxes. They are distinguished by mass or volume conservative strategies and essentially augment the Lagrangian concentration transport equation by a velocity-divergence term and a non-linear, diffusive right-hand side of order four, which is zero outside the interface region, cf. Ding et al. (2007) and Kühl et al. (2021a)

$$\begin{aligned} \frac{\text{d}c}{\text{d}t} = \frac{\partial }{\partial x_{\rm k}} \left[ M \frac{\partial \psi }{\partial x_{\rm k}} \right] - c \frac{\partial v_{\rm k}}{\partial x_{\rm k}} \quad \rightarrow \quad \frac{\partial c}{\partial t} + \frac{\partial \; v_{\rm k} c}{\partial x_{\rm k}} = \frac{\partial }{\partial x_k} \left[ M \frac{\partial \psi }{\partial x_k} \right],\end{aligned}$$
(1)

where M(c) refers to a mobility parameter of dimension [m4/(N s)] and \(\psi (c, \partial ^2 c/\partial x_k^2\)) denotes a chemical potential of dimension [Pa]. Following (Kühl et al. 2021a), the present study employs a mass conservative strategy together with an appropriate choice of M and a frequently used “double-well potential” which yields

$$\begin{aligned}\psi &= 2 C_{1} \left[ (2c^3 -3c^2+c) - 0.5 \left( \frac{C_{2}}{C_{1}}\right) \frac{\partial ^2 c}{\partial x_i^2} \right] \\ & \rightarrow \frac{\partial \psi }{\partial x_k} = 2 C_{1} \left[ (6c^2 -6c+1) \frac{\partial c}{\partial x_k} - 0.5 \left( \frac{C_{2}}{C_{1}}\right) \frac{\partial }{\partial x_k} \frac{\partial ^2 c}{\partial x_i^2} \right]. \end{aligned}$$
(2)

The ratio \(C_{2} [\text{N}]/C_{1} [\text{Pa}] \sim \gamma_{\rm c}^2\) scales with the square of the interface thickness, and \(C_{1} \cdot M \;[\text{m}^2/\text{s}] \sim \nu_{\rm c}\) describes a nonlinear apparent viscosity \(\nu_{\rm c} = 2 C_{1} \cdot M (6c^2 -6c+1)\). Evaluating the last term of \(\nabla_k \psi\) in (2) requires sufficient grid resolution, in other words, the term can be neglected when the interface is under-resolved, which is the case in marine engineering simulations. As illustrated in Fig. 1, \(\nu_c\) vanishes at \(c=(0.5 \pm \sqrt{3}/6)\) and is negative over approximately 58% of the inner transition regime, where it supports the phase separation process.

Though the non-zero RHS of (1) of order \({\mathcal{O}} (\nabla_{k{k}}(\nabla_{{ii}} c))\) appears to increase the complexity, it is beneficial for various reasons, cf. Kühl et al. (2021a): It naturally includes surface tension effects, supports the use of stability-preserving, upwind-biased convective approximations, and facilitates consistent yet numerically robust primal/adjoint formulations. The latter is particularly relevant for the present study and also holds if the third derivative term in (2) is not considered.

2.1.2 Equation of state

An equation of state (EoS) m(c) extracts the local flow properties from the concentration field and the bulk properties, viz.

$$\begin{aligned} \rho = m^{\rho} \rho^{\Delta} + \rho_{\rm b} \quad \mathrm{and} \quad \mu = m^{\mu} \mu^{\Delta} + \mu_{\rm b}, \end{aligned}$$
(3)

where \(\rho^{\Delta} = \rho_{\rm a} - \rho_{\rm b}\), \(\mu^{\Delta} = \mu_{\rm a} - \mu_{\rm b}\) mark the respective bulk property differences. Though this is not necessary, the paper assigns \(m^{\mu} = m^{\rho}\). Provisions on the EoS considered in this study aim to exclude non-physical, unbounded density states by means of \(m \in \left[ 0,1\right]\) and to recover the single-phase limit states, i.e. \(m(c=1[0]) = 1[0]\), cf. Kühl et al. (2021a) and Kühl (2021). The simplest conceivable EoS \(m^{(1)}\) corresponds to a bounded linear interpolation between the limit states. A more advanced nonlinear alternative \(m^{(2)}\) follows the rule of a hyperbolic tangent and employs a user-specified non-dimensional transition parameter \(\gamma^{\rm m}\)

$$\begin{aligned} m^{\rm (1)} = {\left\{ \begin{array}{ll} 0 &{}\text {if} \; c < 0 \\ 1 &{}\text {if} \; c > 1 \\ c &{}\text {otherwise} \end{array}\right. } \quad \mathrm{and} \quad m^{\rm (2)} = \frac{1}{2} \left[ \mathrm{tanh} \left( \frac{2 c - 1}{\gamma ^{\rm m}}\right) +1 \right]. \end{aligned}$$
(4)

Since the hyperbolic EoS complies with the limit states only asymptotically, an upper bound for the transition parameter is estimated by \(\gamma^{\rm m} \le 0.3\) to limit the error w.r.t. the limit states below 0.1%. Typical values for the transition parameter refer to \(0.25 \le \gamma^{\rm m} \le 0.35\).

In combination with a CH-formulation, the hyperbolic EoS offers a decisive advantage for constructing a consistent continuous primal/adjoint two-phase flow model dedicated to shape optimization, which closely resembles the traditional VoF framework. The benefit follows mainly from the employed continuous adjoint framework and applies to academic studies featuring grid-resolved interface physics and, even more importantly, engineering simulations with under-resolved interface physics. Introducing the EoS (3) into the mass conservative continuity equation yields an expression for the divergence of the velocity field that is essentially governed by (4) even for a diffuse interface scheme

$$\begin{aligned} \frac{\partial \rho }{\partial t} + \frac{\partial \, v_{\rm k} \rho }{\partial x_{\rm k}}&= 0 \rightarrow \frac{\partial v_{\rm k}}{\partial x_{\rm k}} = \frac{\sigma_{\rm a}}{\rho_{\rm a}}+ \frac{\sigma_{\rm b}}{\rho_{\rm b}} \\&= f^{\rho} \frac{\text{d}c}{\text{d}t} \quad \mathrm {with} \quad f^{\rho} = \frac{- \rho^{\Delta}}{\rho } \frac{\partial \, m}{\partial c}. \end{aligned}$$
(5)

Here \(\sigma_{\rm a} = -\sigma_{\rm b}\) represent the mass transfer rates into phases a and b. Mass conservative CH formulations yield non-solenoidal velocity fields unless \(f^\rho\) vanishes, cf. Kühl et al. (2021a). This in turn suggests to employ the hyperbolic EoS which can compress the non-solenoidal regime to a small layer controlled by \(\gamma ^{\rm m}\).

2.2 Primal governing equations

The governing fluid dynamic equations refer to the momentum and continuity equation for the mixture as well as a transport equation for the volume concentration of the foreground phase, that need to be solved for the pressure p, the velocity \(v_{\rm i},\) and the concentration c, viz.

$$\begin{aligned} R_{\rm p}&= \frac{\partial v_{\rm k}}{\partial x_{\rm k}} - \frac{f^{\rho}}{1 + f^{\rho} \, c} \, \frac{\partial }{\partial \, x_{\rm k}} \left[M \frac{\partial \, \psi }{\partial \, x_{\rm k}}\right]&= 0 \end{aligned}$$
(6)
$$\begin{aligned} R^{\rm c}&= \frac{\text{d}c}{\text{d}t} - \frac{1}{1 + f^{\rho} \, c} \, \frac{\partial }{\partial \, x_{\rm k}} \left[ M \frac{\partial \, \psi }{\partial \, x_{\rm k}}\right]&= 0 \end{aligned}$$
(7)
$$\begin{aligned} R_{\rm i}^{v_{\rm i}}&= \rho \frac{\text{d}v_{\rm i}}{\text{d}t} + \frac{\partial }{\partial \, x_{\rm k}} \left[p^{\rm eff} \, \delta_{\rm ik} - 2 \, \mu ^{\rm eff} \, S_{\rm ik} \right]\\&\quad - \rho \, g_{\rm i} + \frac{2}{3} \frac{\partial }{\partial \, x_{\rm i}} \left[ \mu \, \frac{f^{\rho}}{1 + f^{\rho} \, c} \frac{\partial }{\partial \, x_{\rm k}} \left [ M \frac{\partial \, \psi }{\partial \, x_{\rm k}}\right ] \right ]&=0. \end{aligned}$$
(8)

The unit coordinates and the strain rate tensor are denoted by \(\delta_{\rm ik}\) and \(S_{\rm ik}\). The framework supports laminar and Reynolds-averaged (modeled) turbulent flows (RANS). In the latter case, \(v_{\rm i}\) and \(p^{\rm eff}\) correspond to Reynolds-averaged properties and \(p^{\rm eff}\) is additionally augmented by a turbulent kinetic energy (k) term, i.e. \(2 \rho k/3\). Along with the Boussinesq hypothesis, the dynamic viscosity \(\mu ^{\rm eff} = \mu + \mu ^{\rm t}\) of turbulent flows consists of a molecular and a turbulent contribution (\(\mu ^{\rm t}\)), and the system is closed using a two-equation turbulence model to determine \(\mu ^{\rm t}\) and k. Details of the turbulence modeling practice are omitted to save space and can be found in textbooks, e.g., Wilcox (1998).

Contributions arising from the two-phase model are noted in the respective final positions of Eqs. (6)–(8). The PDE system agrees with the classical VoF framework for a vanishing mobility \(M \rightarrow 0\). A divergence-free velocity field (6) is often highly appreciated and also reduces the differentiation efforts during the subsequent derivation of a continuous adjoint formulation. Using the nonlinear material model \(m^{\rm (2)}\) in (4), \(f^{\rho}\) approximately vanishes due to \(\partial m / \partial c \rightarrow 0\) for sufficiently small values of \(\gamma ^{\rm m}\). Note that a Heavyside EoS refers to \(\gamma ^{\rm m} \rightarrow 0\) which returns \(\partial m/\partial c \rightarrow \infty\) at \(c=0.5\) in Eq. (5) and would thus require a regularization. Moreover, vanishing \(\gamma ^{\rm m}\)-values are prone to generate artificial staircase effects in the employed Finite-Volume approximation. Therefore, typical values for the transition length refer to \(0.5 \le \gamma ^{\rm m} \le 0.8\). Whilst \(f^{\rho} \rightarrow 0\) for \(c \ne 0.5\) yields the neglect of net diffusion fluxes in (6) and surface tension effects in (8), it leaves a diffusive term within the concentration equation (7). The latter arises from the first part of the chemical potential \(\psi\), cf. Eq. (2), and yields a consistent—therefore robust—adjoint two-phase formulation. Such under-resolved CH-VoF methods consistently employ \(f^{\rho} \rightarrow 0\) to simplify the primal PDE system, and serve as the basis of our adjoint two-phase flow derivation, viz.

$$\begin{aligned} R_{\rm p}&= \frac{\partial v_{\rm k}}{\partial x_{\rm k}} = 0 \end{aligned}$$
(9)
$$\begin{aligned} R^{\rm c}&= \frac{\partial \, c}{\partial \, t} + \frac{\partial \, v_{\rm k} \, c}{\partial x_{\rm k}} - \frac{\partial }{\partial x_{\rm k}} \left[ \nu_{\rm c} \frac{\partial c}{\partial x_{\rm k}} \right] = 0 \end{aligned}$$
(10)
$$\begin{aligned} R_{\rm i}^{v_{\rm i}}&= \rho \bigg [ \frac{\partial \, v_{\rm i}}{\partial \, t} + v_{\rm k} \frac{\partial \, v_{\rm i}}{\partial \, x_{\rm k}} \bigg ] \\&\quad + \frac{\partial }{\partial \, x_{\rm k}} \bigg [p^{\rm eff} \, \delta_{\rm ij} - 2 \, \mu ^{\rm eff} \, S_{\rm ij} \bigg ] - \rho \, g_{\rm i} =0 . \end{aligned}$$
(11)

The nonlinear apparent viscosity reads \(\nu_{\rm c} = M \partial ^2 b/\partial c^2 = 2 C_{1} \, M (6 \, c^2 - 6 \, c + 1)\), cf. Sect. 2.1.1. As indicated by Fig. 1 (left), it follows from a double-well potential \(b = (c-1)^2 c^2\) to be minimized in a phase separation process. Depending on the concentration value c, the last term in (10) acts locally diffusive (\(\nu_{\rm c} \ge 0\)) or compressive (\(\nu_{\rm c} <0\)), cf. Fig. 1 right. This underlines the compressive character of the CH-VoF approach. The primal two-phase flow model is closed by assigning the product \(C_{1} M\) to a spatially constant value that is guided by the numerical diffusion of the primal convective concentration transport as suggested by Kühl et al. (2021a).

Fig. 1
figure 1

Double well potential: a normalized fourth-order polynomial b as well as its first three (normalized) derivatives and b the evolution of the normalized apparent viscosity with indicated roots

Boundary conditions to close the PDE system (9)–(11) are listed in Table 1. Constant values of the pressure gradient typically follow from a piezometric effective pressure definition, viz. \(p^{\rm eff} \rightarrow p + \rho \, x_{\rm k} \, g_{\rm k}\) and thus \(\partial p^{\rm eff} / \partial x_{\rm i} \rightarrow \partial p/\partial x_{\rm i} + \rho \, g_{\rm i}.\) In all cases, inlet, symmetry and slip-wall boundaries are perpendicular to the gravity vector and no hydrostatic boundary contributions occur.

Table 1 Boundary conditions for the primal equations, where \(t_{\rm i}\) [\(n_{\rm i}\)] refer to the local boundary tangential [normal] vector

2.3 Adjoint governing equations

The adjoint PDE system depends on an underlying integral objective functional, viz.

$$\begin{aligned} J = \int_{\Omega_{\rm O}} j^\Omega \,\text{d}\Omega + \int_{\Gamma_{\rm O}} j^\Gamma \,\text{d}\Gamma , \end{aligned}$$
(12)

that either acts in parts of the domain (\(\Omega_{\rm O} \subseteq \Omega\)) or along boundary segments (\(\Gamma_{\rm O} \subseteq \Gamma\) ). Both integrands in (12) can depend on the field quantities of the primal system (9)–(11). The objectives used in this paper read

$$\begin{aligned} j^\Omega = \frac{1}{2} \left[ c - c_{\rm t} \right] ^2 \quad \mathrm{and} \quad j^\Gamma = \left[ p \delta_{\mathrm {ij}} - 2 \mu S_{\mathrm {ij}} \right] n_{\rm j} r_{\rm i}. \end{aligned}$$
(13)

The volume objective minimizes the deviation from a target concentration value \(c_{\rm t}\), e.g. aiming at calm water elevation. The surface objective addresses the fluid force projected in a spatial direction \(r_{\rm i}\), e.g. the fluid flow induced drag. The cost functional (12) is augmented by the primal PDE system (9)–(11) which yields the following Lagrangian

$$\begin{aligned} L = J + \int \int \left[ {\hat{p}} \, R_{\rm p} + {\hat{c}} \,R^{\rm c} + {\hat{v}}_{\rm i} \,R^{v_i} \right]\text{d}\Omega \,\text{d}t . \end{aligned}$$
(14)

In (14) \({\hat{p}},{\hat{c}}\) and \({\hat{v}}_{\rm i}\) refer to adjoint pressure, adjoint concentration and adjoint velocity components, respectively. The units of adjoint pressure and adjoint concentration are equal \(\left[ {\hat{p}} \right] = \left[ {\hat{c}} \right] = [\mathrm{J}] \, 1/\mathrm{m}^3\). The unit of the adjoint velocity reads \(\left[ {\hat{v}}_i \right] = [\mathrm{J}] \, 1 /\mathrm{(N \, s)}\). Demanding first-order optimality conditions yields \(\delta_{{\hat{\phi }}, \phi , u} L = 0\) (Kühl et al. (2019, 2021d)), where \({\hat{\phi }}\in [{{\hat{p}}}, {{\hat{c}}}, {{\hat{v}}}_i]\) and \(\phi \in [p, c, v_i]\) denote to the adjoint and primal variables and u refers to the control, i.e., the normal displacement of discrete surface-element’s centroids for shape optimization purposes. The optimality conditions yield three sets of constraints. The first part (\(\delta_{{\hat{\phi }}}L = 0\)) reproduces the PDE system (9)–(11). The second part (\(\delta_{\phi }L = 0\)) yields the adjoint field equations, viz.

$$\begin{aligned} R^ {\hat{\mathrm {p}}}&= -\frac{\partial {\hat{v}}_{\rm k}}{\partial x_{\rm k}} + \frac{\partial \, j^{\Omega }}{\partial \, p} = 0 \end{aligned}$$
(15)
$$\begin{aligned} R^{\hat{\text{c}}}&= - \frac{\partial {\hat{c}}}{\partial \, t} - v_{\rm k} \frac{\partial \, {\hat{c}}}{\partial \, x_{\rm k}} - \rho^{\Delta} \left[{\hat{v}}_{\rm i} \, g_{\rm i} - {\hat{v}}_{\rm i} \, v_{\rm k} \frac{\partial \, v_{\rm i}}{\partial \, x_{\rm k}} - \frac{\partial \, \mu ^{\rm t}}{\partial \, \rho} 2 S_{\rm ik} \frac{\partial \, {\hat{v}}_{\rm i}}{\partial \, x_{\rm k}} \right] \frac{\partial m}{\partial c} \\& \quad + \mu ^{\Delta} \left[ 2 \, S_{\rm ik} \frac{\partial \, {\hat{v}}_{\rm i}}{\partial \, x_{\rm k}} \right] \frac{\partial m}{\partial c} + \frac{\partial\, j^{\Omega}}{\partial \, c} - \frac{\partial}{\partial \, x_{\rm k}}\left[\nu_{{\hat{\rm c}}} \frac{\partial \, {\hat{c}}}{\partial \, x_{\rm k}} \right]&= 0 \end{aligned}$$
(16)
$$\begin{aligned} R_{\rm i}^{\hat{\mathrm{v}}_{\rm i}}&= -\rho \left[ \frac{\partial \, {\hat{v}}_{\rm i}}{\partial \, t} + v_{\rm k} \frac{\partial \, {\hat{v}}_{\rm i}}{\partial \, x_{\rm k}} \right] + \frac{\partial }{\partial \, x_{\rm k}} \left[{\hat{p}} \, \delta_{\rm ik} - 2 \, \left( \mu + \beta \mu ^{\rm t} \right) \, {\hat{S}}_{\rm ik} \right] + {\hat{c}} \frac{\partial \, c}{\partial \, x_{\rm i}} + \rho \, {\hat{v}}_{\rm k} \frac{\partial \, v_{\rm k}}{\partial \, x_{\rm i}} + \frac{\partial \, j^{\Omega }}{\partial \, v_{\rm i}} = 0, \end{aligned}$$
(17)

that are supplemented by boundary integrals

$$\begin{aligned} \delta_{\rm p} L&= \int_{\Gamma_{\rm O}} \frac{\partial \, j^\Gamma }{\partial \, p} \delta p\,\text{d}\Gamma \\&\quad + \int \int \delta p \, {\hat{v}}_{\rm i} n_{\rm i} \,\text{d}\Gamma\text{d}t \quad \overset{!}{=} 0 \quad \forall \, \delta p \end{aligned}$$
(18)
$$\begin{aligned} \delta_{\rm c} L&= \int_{\Gamma_{\rm O}} \frac{\partial \, j^\Gamma }{\partial \, c} \delta c \,\text{d}\Gamma \\&\quad + \int \int \delta c \left[ {\hat{c}} \, v_{\rm k} \, n_{\rm k} + \nu ^{\rm c} \frac{\partial \, {\hat{c}}}{\partial \, n} + {\hat{v}}_{\rm i} \left[ \frac{2}{3} k \, n_{\rm i} - 2 \, \frac{\partial \, \mu ^{\rm t}}{\partial \, \rho } S_{\rm ik} \, n_{\rm k} \right] \rho ^{\Delta} \frac{\partial m}{\partial c} - {\hat{v}}_{\rm i} \, 2 \, S_{\rm ik} \, n_{\rm k} \, \mu^{\Delta} \frac{\partial m}{\partial c} \right] \\&\quad - \frac{\partial \, \delta c}{\partial \,n} \left[ {\hat{c}} \, \nu ^{\rm c} \right]\text{d}\Gamma \,\text{d}t \quad \overset{!}{=} 0 \quad \forall \, \delta c \end{aligned}$$
(19)
$$\begin{aligned} \delta_{{v}_{\rm i}} L&= \int_{\Gamma^{\rm O}} \frac{\partial \, j^{\Gamma }}{\partial \, v_{\rm i}} \delta v_{\rm i} \,\text{d} \Gamma \\ & \quad + \int \int \delta v_{\rm i} \left[ v_{\rm k} \, \rho \, {\hat{v}}_{\rm i} \, n_{\rm k} + 2 \mu ^{\rm eff} {\hat{S}}_{\rm ik} \, n_{\rm k} -{\hat{p}} \, n_{\rm i} \right] - \delta S_{\rm ik} \left[ 2 \mu ^{\rm eff} \, {\hat{v}}_{\rm i} \, n_{\rm k} \right]\text{d}\Gamma\text{d}t \quad \mathop{=}\limits^{!} 0 \quad \forall \, \delta v_{\rm i} . \end{aligned}$$
(20)

The third part \((\delta_{\rm u}L=0)\) provides the sensitivity that guides the shape update.

All derivatives of material properties enter the adjoint concentration equation with the individual differences of the bulk properties \(\rho^{\Delta}\) and \(\mu^{\Delta}\), which are multiplied by the derivative \(\partial m/\partial c\) of the EoS. The linear EoS \(m^{(1)}\) offers a constant unit derivative \(\partial m/\partial c =1\), and its non-linear alternative reveals an intensified local contribution along the interfacial region that weakens noticeably towards the bulk phases. For a vanishing thickness parameter \(\gamma ^m\), the hyperbolic tangent in (4) turns into a Heaviside function, and the adjoint system experiences an abrupt (Dirac) impulse along the interface based on the EoS related source terms in (16). However, the integral impact does not change and exactly matches that of a linear approach, cf. Kühl (2021). Such thought experiments reveal the vulnerability of the discrete framework: The adjoint system conceptually pushes the phase transition below the grid resolution in practical applications. Hence, in adjoint mode we consequently apply a linear EoS, i.e. the use of \(\partial m/\partial c =1\) in (15)–(20), in order not to compromise the numerical robustness. Comparing the primal and the adjoint PDE systems, a few additional advection and cross-coupling terms occur in the adjoint PDE system. Above all, the adjoint concentration equation contains significantly more terms that scale with the two fluids’ bulk density or bulk viscosity difference. The last term of (16) is of particular importance since this additional diffusivity bridges the gap between an adjoint sharp vs. an under-resolved diffusive interface formulation. We would like to point out that the differentiation of the apparent viscosity \(\nu_{\rm c}\) was deliberately suppressed. This would yield an additional contribution to the adjoint concentrations equation, which is proportional to \(\sim (2c-1) \partial c/\partial x_k\) and is thus confined to two small regions along the phase transition regime which are separated in the vicinity of the interface, i.e., at \(c=0.5\). Moreover, the treatment of the adjoint apparent viscosity \(\nu_{\hat{\rm c}}\) is also simplified and assigned to a spatially constant, positive and thus stability-promoting value that follows from the bulk phase, i.e. \(\nu_{\hat{\rm c}} = 2 M \, C_1\), cf. Fig. 1 right. Boundary conditions to close the adjoint PDE system (15)–(17) aim at neutralizing the boundary integrals (18)–(20) and are listed in Table 2.

Table 2 Boundary conditions for the adjoint equations, where \(t_{\rm i}\) [\(n_{\rm i}\)] refer to the local boundary tangential [normal] vector

2.3.1 Adjoint turbulence treatment

The adjoint turbulence treatment follows from the suggestion published in Kühl et al. (2021c). Owing to the strong influence of the primal and adjoint near wall flows on the shape sensitivities (21), this publication suggests to analyze the near-wall boundary layer flow composed by the viscous sub-layer and the logarithmic layer, and subsequently apply the findings on the whole flow field.

The central idea is, that the near wall boundary layer turbulence could be described by an algebraic mixing length model. Although the actually employed turbulence model might use transport equations to compute the turbulent viscosity \(\mu ^t\), e.g. for the evolution of the turbulent kinetic energy k and a specific kinetic energy dissipation rate ω, the resulting turbulent viscosity, e.g. \(\mu ^t \sim k/\omega\), should agree with its counterpart obtained from a mixing length hypothesis in zero pressure gradient boundary layers. Bearing in mind that the turbulent viscosity is the essential information passed from the turbulence model to the primal flow, one could try to differentiate the mixing-length-based momentum equations and analyze the resulting adjoint momentum equation. The analysis reveals that the adjoint momentum equation basically reflects a diffusion term with doubled turbulent viscosity, i.e., for a simple unidirectional shear u(y) with y being the wall normal coordinate & wall distance, the relation between the primal and the adjoint diffusion reads

$$\begin{aligned}&\mathrm{Primal: } \; \frac{\partial }{\partial \, y} \left[\left( \mu + \rho (\kappa y)^2 \frac{\partial u}{\partial \, y} \right) \, \frac{\partial u}{\partial \, y} \right] \\&\qquad\quad\rightarrow \mathrm{adjoint: } \; \frac{\partial }{\partial \, y} \left[\left( \mu + 2 \rho (\kappa y)^2 \frac{\partial u}{\partial \, y} \right) \; \frac{\partial {{\hat{u}}}}{\partial \, y}\right], \\&\qquad\quad \mathrm{with \quad } \mu ^{\rm t} = \rho (\kappa y)^2 \frac{\partial u}{\partial \, y}. \end{aligned}$$

Here, \({\hat{u}}\) refers to the adjoint of u. The differentiation of mixing-length-based momentum equations simply results in doubling the turbulent viscosity in the adjoint momentum equations due to the non-linearity of the primal diffusion term. Mind that \(\beta = 2\) is consistent in the viscous sub-layer and the logarithmic region of a boundary layer. At the same time, it can only be hypothesized that the consistency improves compared to the classical frozen turbulence approach for other flows. Since shape optimization for resistance problems is by definition interested in the near-wall flow, a consistent adjoint near-wall formulation should be particularly relevant. Moreover, the robustness of the adjoint numerical procedure benefits from an augmented viscosity.

2.3.2 Adjoint sensitivity

If all respective optimality conditions are satisfied, sensitivity information is obtained from the final optimality condition in terms of a derivative of the Lagrangian in the direction of the control, i.e. \(\delta_u L\). The latter gives rise to the desired shape sensitivity derivative s, which follows from \((\partial \, v_{\rm i}/\partial \, n) \, n_{\rm i} = 0\) and reads

$$\begin{aligned} \delta_{\rm u} L&= - \int \int_{\Gamma ^{ D}} (\mu + \beta \, \mu ^{\rm t}) \frac{\partial \, v_{\rm i}}{\partial \, n} \left[ - \frac{\partial \, {\hat{v}}_{\rm i}}{\partial \, n} \right]\text{d}\Gamma\text{d}t \\&\rightarrow s = -(\mu + \beta \, \mu ^{\rm t}) \frac{\partial \, v_{\rm t}}{\partial \, n} \left[ \frac{\partial \, {\hat{v}}_{\rm t}}{\partial \, n} \right] , \end{aligned}$$
(21)

where only the normal (n) gradient of the tangential (t) primal and adjoint velocity is considered in line with a local Couette-flow assumption that stems from the primal solver and assumes negligible wall curvature.

2.3.3 Interpretation of primal vs. dual time horizon

Being primarily concerned with the drag reduction of ships cruising in calm water, the present research focuses on steady-state problems. Therefore, the primal and adjoint solutions are advanced in pseudo-time and converged to a steady-state. To this end, all adjoint time steps are solely linearized around the final (steady-state) primal flow solution. A pseudo-transient procedure also influences the identification of the floatation position outlined in Sect. 3 which does not need to consider inertia effects of the rigid body mechanics.

3 Shape and grid update

Both the adjustment of the floatation and the shape modification suggested by the optimizer employ the same template to update the numerical grid along the lines of a mesh morphing procedure to facilitate a restart from the previous design. In both cases, the grid update procedure is driven by the spatial change of the discretized vessel geometry.

3.1 Modeling of floatation

The paper considers an adjustment of the trim and sinkage during the integration to steady-state, using a rigid body motion model (Luo-Theilen and Rung (2017)) that is restricted to two degrees of freedom herein. Due to the pseudo-transient approach, inertia aspects are irrelevant for the final floatation, and a hydrostatic approach to adjust the floatation can be pursued, cf. Yang and Löhner (2002). The floating position is initialized in its hydrostatic rest position in this simplified approach. This rest position is associated with an initial displacement \(V^{\rm ini}\) and supplemented by centers of gravity \(x_{\rm k}^{\rm g}\) and rotation \(x_{\rm k}^{\rm r}\). The initial displacement corresponds to the gravity neutralizing buoyancy force and is associated with the vessel’s carrying capacity. The latter is conserved during the optimization in the present study, cf. Sect. 3.4. Once the flow develops, the related forces deviate from the initial or the previous iteration—possibly due to a modified shape—and the floatation is corrected. To this end, the surface grid of the hull, which refers to the interior boundary of the discrete domain, is rigidly displaced and rotated. In contrast, all exterior boundaries remain unmoved, as outlined in Sect. 3.2.

For the sake of simplicity, we assume the gravitation and heave force to act in the negative \(x_{3}\) (vertical) direction. Consequently, the trim moment is associated with the pitch-down positive \(x_{2}\) (span) rotation, perpendicular to the cruise direction (\(x_{1}\)) and the gravity vector \(g_{\rm k}\). An estimation of the required trim (pitch rotation) and sinkage (vertical motion) correction w.r.t. the initial hydrostatic floatation follows from the actual trim moment \(M^{\rm T}\) and the net heave force \(F^{\rm H}\), viz.

$$\begin{aligned} \Delta S_{\rm 3}[m] = - \frac{F^{\rm H}}{\rho ^{\rm b} \, |g_{\rm k}| \, A^{\rm w} } \quad \mathrm{and} \quad \Delta T_{2}[^\circ ] = \frac{M^{\rm T}}{\rho ^{\rm b} \, |g_{\rm k}| \, I^{\rm w}}. \end{aligned}$$
(22)

where \(A^{\rm w}\) and \(I^{\rm w}\) represent the water-plane area and its moment of inertia around the rotating axis in the present floating position. The respective net heave force and trim moment values follow the flow-induced forces along the wetted boundaries \(\Gamma^{\rm H}\) augmented by gravity forces, viz.

$$\begin{aligned} F^{\rm H}&= \frac{g_{\rm i}}{|g_{\rm k}|} \left[ \int_{\Gamma ^{\rm H}} f_{\rm i} \,\text{d}\Gamma + V^{\rm ini} \, \rho ^{\rm b} \, g_{\rm i} \right] \qquad \mathrm{and} \end{aligned}$$
(23)
$$\begin{aligned} M^{\rm T}&= \frac{\epsilon_{\rm ijk} \, g_{\rm j} \, v_{\rm k}^{\mathrm {bulk}}}{|\epsilon_{\rm ijk} \, g_{\rm j} \, v_{\rm k}^{\mathrm {bulk}}|} \left[ \int_{\Gamma ^{\rm H}} \epsilon_{\rm ilm} \big [ x_{\rm l} - x_{\rm l}^{\rm r} \big ] f_{\rm m} \,\text{d}\Gamma + V^{\rm ini} \, \rho ^{\rm b} \epsilon_{\rm ilm} \big [ x_{\rm l}^{\rm g} - x_{\rm l}^{\rm r} \big ] g_{\rm m} \right] , \end{aligned}$$
(24)

where \(f_{\rm i} = \left[ 2 \, \mu ^{\rm eff} \, S_{\rm ik} - p^{\rm eff} \, \delta_{\rm ik} \right] n_{\rm k}\) and \(v_{\rm k}^{\mathrm{bulk}}\) represent the surface specific fluid forces and the bulk velocity, respectively. Here \(\epsilon_{\rm ijk}\) refers to the Levi–Civita–Symbol used to compute an outer vector product. Once the flow field and the forces on the hull converge, the deviation from the hydrostatic floatation is evaluated according to Eq. (22). Subsequently, under-relaxed corrections are superimposed by means of a displacement vector \(d_{\rm i}^{\rm H}\) along each interior boundary surface element

$$\begin{aligned} d_{\rm i}^{\rm H} = \left[ \Delta S_{\rm 3} \, \delta_{\rm i3} + \Delta T_{2} \, R_{\rm i2} \right] \omega ^{\rm H}, \end{aligned}$$
(25)

where \(R_{\rm i2}\) refers to the entries of a rotation matrix around the trim axis. Robust convergence was experienced for \(0.2 \le \omega ^{\rm H} \le 0.6\).

Mind that the Lagrangian (14) could be augmented by residual versions of the floatation model (23) and (24) to implicitly account for the influence of the floatation on the control using entries of the floatation to the adjoint PDE system (15)–(17). As the floatation updates are, however, usually fairly small and simulations only aim at steady state floatation, we do not consider this approach.

3.2 Mesh deformation procedure

The interior boundary displacement and the fixed exterior boundaries serve as Dirichlet conditions for a mesh morphing routine which updates the interior cell centers from a Central-Differencing-Scheme (CDS)-based Finite-Volume (FV) approximation of a Laplace equation

$$\begin{aligned} \frac{\partial }{\partial x_{\rm k}} \left[ \mu ^{\rm d} \frac{\partial d_{\rm i}}{\partial x_{\rm k}} \right] = 0 \quad \mathrm {in} \quad \Omega \qquad \mathrm {with} \qquad {\left\{ \begin{array}{ll} d_{\rm i} = d_{\rm i}^{\rm H} \quad &{}\mathrm {on} \quad \Gamma \cap \Gamma^{\rm H} \\ d_{\rm i} = 0 \quad &{}\mathrm {on} \quad \Gamma \end{array}\right. }. \end{aligned}$$
(26)

In the present study, the diffusivity field \(\mu^{\rm d}\) refers to the inverse (non zero) distance to the nearest wall, which avoids a grid distortion in the vicinity of the hull. A subsequent deformation of the cell vertices follows from an averaged interpolation of all vertex-adjacent centers \(N^{\rm P(V)},\) viz.

$$\begin{aligned} d_{\rm i}^{\rm V} = \frac{1}{N^{\rm P(V)}} \sum_{\rm P=1}^{N^{\rm P(V)}} \left[ d_{\rm i}^{\rm P} + \frac{\partial \, d_{\rm i}^{\rm P}}{\partial \, x_{\rm k}} \left( x_{\rm k}^{\rm V} - x_{\rm k}^{\rm P} \right) \right] \, . \end{aligned}$$
(27)

After updating the grid vertices and Control Volumes (CV) centers, the geometric quantities are recalculated for each CV. Equations (26) and (27) are employed to update the volume grid in response to the change of the discrete hull, which in turn can alter on the basis of either the floating body motion (\(d_{\rm i} = d_{\rm i}^{\rm H}\), Sect. 3.1) or the computed sensitivities s of the optimization (\(d_{\rm i} \sim s \, n_{\rm i}\), cf. Sect. 3.3) that enter the mesh deformation approach through the boundary conditions. Different approaches to define the diffusivity field \(\mu^{\rm d}\) are conceivable, though we do consistently use an inverse distance-based approach in this study. Since the grid topology remains unaltered, the CFD simulation is continued from the previous result on the ”new” mesh.

Sections 3.3 and 3.4 outline the computation of a constraint compatible, cell center gradient field \(g_{\rm i}\) derived from the adjoint sensitivities. Using a step size \(\alpha^{\rm d}\) this is translated into an optimization-based relocation of cell centers and subsequently fed into (27).

3.3 Node-based shape gradient approximation

Non-parameterized, node-based shape optimizations disclose localized influences on optimal shapes down to the range of the discrete surface elements of the CFD grid. However, the strategy also suffers from a few well-known weaknesses. For example, the raw sensitivities provide comprehensive information on the normal deformation but lack any information on the associated tangential node motion, and the sensitivities are not necessarily smooth. These deficiencies yield rough/noisy shape updates, cf. Stück and Rung (2011), Kröger and Rung (2016), and lead to distorted near-wall meshes, which in turn hamper the preservation of numerical accuracy during the optimization procedure, e.g. Stavropoulou et al. (2014) and Bletzinger (2014).

The adjoint shape derivatives are usually regularized to obtain smooth meaningful technical shape updates. Different regularization strategies to determine the shape gradient exist, which can be distinguished by the surface- or volume-based habitat of the shape gradient. The most prominent example refers to a surface-based formulation using the Laplace-Beltrami (LB) metric, as initially proposed by Jameson and Vassberg (2000) and Vassberg and Jameson (2006a, b) in terms of an implicit, continuous smoothing operator based on an extended definition of the inner product, frequently labeled Sobolev-gradient. More recently, a volume-based Steklov-Poincaré (SP) metric was suggested as an alternative, e.g. Schulz and Siebenborn (2016), Haubner et al. (2021), which offers algorithmic and procedural benefits and shares features with the traction method introduced by Azegami and Wu (1996) and Azegami and Takeuchi (2006).

3.3.1 Steklov-Poincaré metric

The SP approach refers to a novel strategy on an industrial level that employs an elliptic volume-based formulation where smoothed results are subsequently projected on the boundary. The procedure essentially combines the 2D shape update with the 3D mesh update using the local flow sensitivities from Eq. (21) of all design boundary patches of the computational mesh. The algorithm exclusively operates in the fluid domain and is thus compatible with the CFD solver environment. Re-using standard high-performance-computing capable solver routines (assembling, solving, etc.) represents a major benefit of the SP procedure which refers to a standard Laplace-PDE to compute a gradient vector field \(g_{\rm i}\)

$$\begin{aligned} \frac{\partial }{\partial x_{\rm k}} \left[ \mu ^{\rm g} \frac{\partial g_{\rm i}}{\partial x_{\rm k}} \right] = 0 \;\mathrm{in}\; \Omega \quad \mathrm{with}\quad \left\{ \begin{array}{ll} \frac{\partial \, g_{\rm i}}{\partial \, n} = s \, n_{\rm i} & \quad \mathrm{on}\; \Gamma \cap \Gamma^{\rm D} \\ g_{\rm i} \, n_{\rm i} = 0, \frac{\partial \, g_{\rm i}}{\partial \, n} t_{\rm i} = 0 & \quad \mathrm{on} \;\Gamma ^{\rm Symm} \\ g_{\rm i} = 0 &\quad \mathrm {on}\; \Gamma \end{array}\right.. \end{aligned}$$
(28)

The gradient field \(g_{\rm i}\) is controlled by Neumann conditions that employ the raw sensitivity derivatives s. No boundary-based operations are necessary and modifications of the boundary conditions (28) support an intuitive introduction of additional geometry-related engineering constraints. Examples refer to fixed intersection lines along a symmetry plane via \(g_{\rm i} \, n_{\rm i} = 0\) and \((\partial \, g_{\rm i}/\partial \, n) t_{\rm i} = 0\) on \(\Gamma^{\rm Symm}\), or the realization of a mandatory flat ship transom obtained by \(g_{\rm i} \, n_{\rm i} = 0\). The SP approach involves only a single user-defined parameter, i.e. the diffusivity \(\mu ^{\rm g}\), which refers to the inverse (non zero) distance to the nearest wall in the present study, cf. Sect. 3.2. The method is the starting point for more sophisticated p-Laplacian descent strategies that employ a nonlinear diffusivity, e.g. \(\mu ^{\rm g} = [(\partial \, g_{\rm i}/\partial \, x_{\rm k}) (\partial \, g_{\rm i} / \partial \, x_{\rm k})]^{(p-2)/2}\), cf. Müller et al. (2021) and Deckelnick et al. (2021).

The SP approach is the preferred approach of this paper. A step in the steepest descent direction is performed once the field \(g_{\rm i}\) is computed from (28) and subsequently subjected to further technical constraints, cf. Sect. 4.1.

3.4 Geometrical constraints

The discussion of additional geometrical constraints is divided into local and global (integral) criteria.

3.4.1 Local constraints

Local constraints restrict the motion of the shape in Euclidean space. For example, marine engineering examples typically refer to a maximum length, a maximum width, or a plane transom stern. Various strategies are conceivable to meet local constraints. Superficially, all constraints can be incorporated on equation level to determine the field gradient, e.g. (28). However, this essentially resembles a sub-optimization problem and—for performance reasons—requires the availability of a suitable procedure, i.e., a Newton-type solver. Alternatively, augmented Lagrangian methods may be used, which relax the geometrical constraints by introducing additional Lagrangian multipliers, cf. Allaire et al. (2004, 2021), Andreani et al. (2008), and Müller et al. (2021). The latter serve as additional process parameters and usually result in more optimization cycles, especially if several geometrical constraints should be considered simultaneously.

The present procedure augments the flow sensitivity to comply with local constraints, is modularizable, and intuitive to use. By reference to an exemplary geometric inequality that constrains the maximum control-coordinate \({\tilde{u}}_{\rm i}\) in \(x_{\rm i}\)-direction, the optimization problem is augmented

$$\begin{aligned} \mathrm {min} \, J(\varphi (u_{\rm i}), u_{\rm i}) \qquad \mathrm {s.t.} \qquad R^{\varphi }(\varphi (u_{\rm i})) = 0 \qquad \mathrm{and} \qquad u_{\rm i} - {\tilde{u}}_{\rm i} \le 0, \end{aligned}$$
(29)

and the sensitivity of the shape w.r.t. the flow \(s \, n_{\rm i}\) is assumed to be available. As long as the shape remains below the upper bound \(u_{\rm i} - {\tilde{u}}_{\rm i} \le 0\), the constraint is inherently fulfilled. However, if the shape moves beyond the boundary, an additional compensating geometric sensitivity \(s_{\rm i}^{\rm u}\) is added to the flow sensitivity, viz.

$$\begin{aligned} s \, n_{\rm i} \rightarrow s \, n_{\rm i} + \beta ^{\rm u} \, s_{\rm i}^{\rm u} \quad \mathrm{with} \quad s_{\rm i}^{\rm u} = {\left\{ \begin{array}{ll} 0 \quad &{}: u_{\rm i} - {\tilde{u}}_{\rm i} \le 0 \\ {\tilde{u}}_{\rm i} - u_{\rm i} \quad &{}: u_{\rm i} - {\tilde{u}}_{\rm i} > 0 \end{array}\right. }. \end{aligned}$$
(30)

Compliance of dimensions and scaling of the geometric constraint is ensured by appropriate choices of the constant \(\beta ^{\rm u }\). A natural choice of the scaling refers to the inverse step size of the employed steepest descent approach, i.e., \(\beta ^{\rm u } =1/ \alpha^{\rm d}\). This constraint management strategy can be considered as implicit (the constraint is applied before a descent direction is computed) and does not lead to oscillations of the cost functional for the applications within this paper.

3.4.2 Global constraints

Global constraints require the preservation of integral quantities such as, e.g., the hydrostatic water displacement, a maximum wetted surface, or a fixed center of gravity. The displacement is particularly important in this work since drag optimizations often tend to eliminate the wetted surface and the hull.

Implicit SP procedures directly employ a field equation (28) using the sensitivity derivatives as Neumann conditions. This suggests solving an analog, volume-based sub-problem to preserve global constraints, e.g., plane transom surfaces or fixed mainframes, viz.

$$\begin{aligned} \frac{\partial }{\partial x_{\rm k}} \left[ \mu ^{\rm g} \frac{\partial {\tilde{g}}_{\rm i}}{\partial x_{\rm k}} \right] &= 0 \quad \mathrm {in} \quad \Omega \qquad \mathrm{with} \; \left\{\begin{array}{ll} \frac{\partial \, {\tilde{g}}_{\rm i}}{\partial \, n} = n_{\rm i} & \quad \mathrm{on} \; \Gamma \cap \Gamma^{\rm D} \\ {\tilde{g}}_{\rm i} \, n_{\rm i} = 0, \frac{\partial \, {\tilde{g}}_{\rm i}}{\partial \, n} t_{\rm i} = 0 & \quad \mathrm {on} \; \Gamma ^{\rm Symm} \\ {\tilde{g}}_{\rm i} = 0 & \mathrm{on} \; \Gamma. \end{array}\right. \end{aligned}$$
(31)

The approach shares ideas of a sub-optimization problem that aims minimizing the squared integral of the deformation flux through the wetted part of the shape constraint by the SP field gradient equation (28), viz. \(J^{\Gamma , D} = \left[ \int_{\Gamma ^{\rm W}} g_{\rm i} \, n_{\rm i} \,\text{d}\Gamma \right] ^2\). Following the numerical solution of (31) along the lines of (28), a superposition of the \(g_{\rm i}\) and \({\tilde{g}}_{\rm i}\) fields yields a displaced-fluid conservative volume-based shape gradient, viz.

$$\begin{aligned} g_{\rm i} \rightarrow g_{\rm i} + \beta ^{\rm g } \, {\tilde{g}}_{\rm i} \qquad \mathrm {with} \qquad \beta ^{\rm g} = -\frac{ \int_{\Gamma ^{\rm W}} g_{\rm i} \, n_{\rm i} \, {g} \Gamma }{ \int_{\Gamma ^{\rm W}} {\tilde{g}}_{\rm i} \, n_{\rm i} \,\text{d}\Gamma }. \end{aligned}$$
(32)

After a final scaling of the deformation field with a negative step size \(d_{\rm i} \rightarrow - \alpha^{\rm d}g_{\rm i}\), the cell centered deformation field is used to adjust the grid vertices from (27).

Some differences between the proposed SP approach and classical LB strategies from Vassberg and Jameson (2006a), Bletzinger (2014) and Kröger and Rung (2016) are discussed in the following.

The SP-approach inheres a challenge when the entire geometry is released for design: Due to the lack of Dirichlet conditions along the design boundary, the optimized geometry is free to perform a rigid-body motion type of deformation, e.g. gradually translate out of the domain. Hence, such SP-based strategies typically require to suppress such deformations and to fix the barycenter coordinates using additional constraints, cf. Schulz and Siebenborn (2016) and Müller et al. (2021). On the contrary, LB approaches operate with Dirichlet values obtained from smoothed, volume-preserving sensitivities, and the optimized geometry doesn’t perform undesired rigid body deformations, cf. Kröger and Rung (2016).

The habitat of the LB approach is a curved surface in space. Imposing constraints in the LB context is therefore rather inconvenient in a CFD environment. Moreover, updates of the field/volume mesh are not seamlessly obtained in parallel with the geometry update as in the SP approach. Since most geometries of practical relevance are not entirely accessible for design changes, they naturally feature Dirichlet conditions. The SP approach is therefore preferred for the 3D applications in Sect. 6, where hull parts above the water line as well as the transom are not completely free for design.

However, the validation studies in Sect. 5 employ the LB metric as the whole geometry is free for design.

4 Numerical procedure

The numerical procedure utilizes a FV approximation, dedicated to Single Instruction Multiple Data (SIMD) implementations on a distributed-memory parallel CPU machine. Algorithms employed by the inhouse procedure FresCo+ are described in Rung et al. (2009) and Yakubov et al. (2013). They ground on the integral form of a generic Eulerian transport equation for a scalar field \(\phi (x_{\rm k}, t)\) exposed to the influence of a possibly non-linear source term \(S_\phi\) in addition to a modeled (non-linear) gradient diffusion \(\Gamma^{\ast}\) in a control volume V bounded by the Surface S(V), viz.

$$\begin{aligned} \int_V \left[ \frac{\partial \phi }{\partial t} - S_\phi \right] \text{d}V +\oint_{S(V)} \text{d}S_{\rm i} \left[ v_{\rm i} \phi - (\Gamma + \Gamma^{\ast}) \frac{\partial \phi }{\partial x_{\rm i}} \right] = 0. \end{aligned}$$
(33)

The procedure uses the strong conservation form and employs a cell-centered, co-located storage arrangement for all transport properties. The spatial discretization employs unstructured grids based on arbitrary polyhedral cells, which connect to a face-based data structure. Various turbulence-closure models are available w.r.t. statistical (RANS) or scale-resolving (LES, DES) approaches. The numerical integration refers to the mid-point rule, diffusive fluxes are determined from second-order central differencing, and convective fluxes employ higher-order upwind biased interpolation formulae, e.g. Quadratic Upstream Interpolation for Convective Kinematics (QUICK) and High Resolution Interface Capturing Scheme (HRIC). Jacobi preconditioned Krylov-subspace solvers are used to solve the equation systems, and the global flow field is iterated to convergence using a pressure-correction scheme. Procedures are parallelized using a domain decomposition method and the Message Passing Interface (MPI) communication protocol.

4.1 Optimization procedure

After all engineering constraints are incorporated, either locally on sensitivity level or globally within the shape gradient computation, a descent procedure is employed to minimize the cost functional. For this purpose, the volume-based representation of the shape gradient is multiplied by a sufficiently small step size \(d_{\rm i} \rightarrow -\alpha^{\rm d}\,d_{\rm i}\) [\(d_{\rm i} = -\alpha^{\rm d} \, g_{\rm i}\)] for the SP [LB] metric that (a) ensures compliance of dimensions between the LB or SP-based shape gradient and (b) serves as an optimization step in the direction of steepest descent. The step size remains constant over the optimization process and is frequently estimated based on a maximum initial displacement, i.e. \(\alpha^{\rm d} = d^{\rm max}/\mathrm {max}(d_{\rm i}, g_{\rm i})\). Typical values for this maximum displacement refer to \(1/10^{4} \le d^{\rm max}/L \le 1/10^{3}\), where L denotes to a reference length of the underlying geometry, e.g. the ship length. Subsequent deformation of the cell vertices follows from an averaged interpolation of all vertex-adjacent centers \(N^{\rm P(V)}\) in line with Eq. (27). After updating the grid, geometric quantities are recalculated for each CV. Topological relationships remain unaltered, and the simulation is continued by a restart from the previous optimization step to evaluate the new objective functional value. Due to the employed steepest descent approach and comparably small step sizes, field solutions of two consecutive shapes are usually nearby. Compared to a simulation from scratch, a speedup in total computational time of about an order of magnitude is realistic for this papers’ applications. The optimization loop is terminated if a maximum number of optimization cycles \(N^{\rm O}\) is reached or if the relative cost functional decrease w.r.t. the initial shape falls below \(\epsilon ^{\rm J} [\%]\) during an optimization step, cf. Alg. 1.

figure a

5 Validation

This section assesses the credibility of the adjoint two-phase flow sensitivities against the results of a Finite Difference (FD) approach. Additionally, influences of the adjoint two-phase flow couplings are investigated. The considered example refers to the laminar flow around a two-dimensional submerged circular cylinder at fixed floatation and involves volume- and surface-based cost functionals. This helps to consider two-phase flow effects in isolation. Aspects of the employed adjoint turbulence treatment are discussed in Kühl et al. (2021c). Hence, the considered adjoint two-phase system refers to Eqs. (15)–(17) with \(\beta = 0\) (laminar) and \(\partial m/\partial c = 1\).

As illustrated in Fig. 2a, the origin of the cylinder is positioned two and a half diameters D underneath an initial calm-water free surface. The employed two-dimensional domain features a length and height of \(60 \, D\) and \(30 \, D\), where the inlet and bottom boundaries are located 20.5 diameters away from the cylinder’s origin. At the inlet, a homogeneous unidirectional (horizontal) bulk flow \(v_{\rm i} = v_{1} \delta_{i1}\) is imposed for both phases in conjunction with a calm water concentration distribution. Slip walls are used along the top and bottom boundaries, and a hydrostatic pressure boundary is employed along the outlet. The grid is stretched in the longitudinal direction (\(x_{1}\)) towards the outlet to suppress the outlet wave field and comply with the outlet condition.

The study is performed at \(\text{Re}_{\rm D} = v_{1} D/\nu ^{\rm b} = {20}\) and \(\text{Fn} = v_{1}/\sqrt{G \, 2 \, D} = {0.75}\), based on the gravitational acceleration G, the inflow velocity \(v_{1}\) and the kinematic viscosity of the water \(\nu ^{\rm b}\). The expected dimensionless wave length reads \(\lambda = \lambda / D = 2 \, \pi \, \mathrm {Fn}^2 = 3.534\). To ensure the independence of the objective functional value w.r.t. spatial discretization, a grid study was conducted prior to the optimization study. Part of the utilized structured numerical grid is displayed in Fig. 2b. It consists of approximately \({215\,000}\) control volumes where the cylinder shape is discretized with 500 surface elements along the circumference. The non-dimensional wall-normal distance of the first grid layer reads \(y^+ \approx {0.01}\) and the refined grid in the free surface region employs isotropic spacing with \(\Delta x_{1} =\Delta x_{2} \approx \lambda /100\). Convective primal [adjoint] momentum fluxes are approximated using the QUICK [QDICK] scheme, cf. Stück and Rung (2013). The approximation of the concentration equation has been outlined in Kühl et al. (2021a, b) where traditional VoF approaches follow from a compressive primal/hybridized continuous-discrete adjoint HRIC scheme and compressiveness of a CH-VoF is achieved through inherent phase separation capabilities outlined in Sect. 2.1.1. Using an Euler implicit approach, the simulations are advanced to a steady state in pseudo-time.

Fig. 2
figure 2

Illustration of the submerged 2D laminar cylinder validation case (\(\text{Re}_{\rm D} = 20,\text{Fn}=0.75\)): a schematic drawing of the initial configuration including the upper half of the cylinder \(u_{\rm i}\) (red) investigated in Sect. 5.1, and b structured-grid portion in the vicinity of the cylinder. (Color figure online)

5.1 Local validation

Three exemplary objectives are used to validate the adjoint two-phase model against FD results at selected positions along the circumference of the cylinder. Results are reported for two boundary-based force objectives into the direction \(r_{\rm i} = [\sqrt{(}2), \sqrt{2}]^{\rm T}/2\) (drift) and \(r_{\rm i} = [1, 0]^{\rm T}\) (drag), and a volumetric target-concentration objective with a habitat along \(\Omega ^{\rm O} = [-5D,D] \times [25 D,5 D]\). The credibility of the validation effort is ensured by verifying the linearity of the FD-analysis using three perturbation magnitudes \(\epsilon /D \in [10^{-2}, 10^{-5}, 10^{-6}]\). The control is restricted to the upper half of the cylinder (cf. Fig 2a), for which FD results are extracted at 21 discrete positions. To this end, 42 additional simulations were performed to obtain second-order accurate central differences.

A comparison of the sensitivities predicted by the adjoint (lines) and the FD (symbols) approaches is depicted in Fig. 3 for the force objectives (left) and the concentration objective (center) using \(\epsilon /D =10^{-5}\). As indicated by these figures, the adjoint sensitivities agree almost perfectly with the FD results. The linearity of the FD answer is demonstrated in Fig. 3 (right), which refers to the local sensitivities for the drift objective at an exemplary surface position \(x_{1}/D = 1/4\). Mind that the drift force objective deliberately promotes an interaction between the adjoint velocity and the gravity vector through the third RHS-term in (16) near the wall, where the boundary condition requires \({{\hat{v}}}_{\rm i} = - r_{\rm i}\) and therefore \({{\hat{v}}}_{\rm i} \, g_{\rm i} \ne 0\).

To analyze the sensitivity influence, especially from the individual contributions of the concentration equation (16) via selective term combinations, nine additional adjoint studies were performed, cf. Table 3. Formulations A1-A3 neglect either all four source terms (A1), only the adjoint transposed convection (ATC) term due to the nonlinear momentum convection (A2), or all coupling terms induced by the differentiation of the material properties (A3), respectively. The deficit of neglecting different property-change sources in combination with the ATC term is investigated in A4–A6. The benefit of the individual source terms related to the change of the properties is in the focus of A7–A9.

Table 3 Investigated adjoint source term configurations for the submerged cylinder validation case (\(\text{Re}_{\rm D} = 20\), \(\text{Fn}=0.75\)), where ’-’ indicates a neglect of the respective contribution

Results are displayed in Figs. 4 and 5 for the drag force and the inverse concentration objective, respectively. Comparing A2 with A1 and A3 for the drag objective (Fig. 4, left) reveals that ignoring convective, Reynolds, and Froude terms yields sign errors disregarding the ATC choice, which might be considered critical for gradient-based optimization. Significantly more pronounced sign errors are also observed for the concentration objective (Fig. 5, left) in conjunction with A1 and A3. The influence of the ATC term w.r.t. the total resistance objective resembles an overall sound influence while maintaining the qualitative characteristics. In line with the flat plate boundary-layer study from Kühl et al. (2021d), an amplification of the shape derivative is obtained in its most sensitive region if the ATC term is neglected, which in turn can be treated based on reduced step sizes within a steepest descent optimization procedure. The situation becomes more crucial in the case of the inverse concentration objective. Already the neglect of the ATC term (A2) shifts the roots of the shape derivative. The manipulation of the sensitivity is significantly increased by neglecting the adjoint concentration sources (A3).

A more detailed insight into the influence of the adjoint concentration sources is obtained by freezing selected terms (A4–A6). The resulting shape sensitivities are depicted in the central figures. The sensitivity deviations from the consistent formulation appear to be most significant when the contributions due to a variation of the density are neglected as only A5 reveals no sign errors. The variation of the Froude term seems to have the most extensive influence since A5 outperforms A4, which in turn improves on the results of A6. While a quantitative shift is observed for the surface-based functional, the deviations w.r.t. the volume-based cost functional are noticeably increased. Mind also the respective sign errors revealed by the center graph of Fig. 5.

Finally, configurations A4–A6 are reversed by neglecting all except one source in A7–A9, cf. right graphs of Figs. 4 and 5. Considering only the Froude term (A9) underlines its major relevance by driving the shape sensitivity of the inverse concentration objective comparably close to the consistent result or towards the results of A2. Moreover, all but the solution for A9 render critical sign errors.

Fig. 3
figure 3

Submerged cylinder validation case (\(\text{Re}_{\rm D} = 20\), \(\text{Fn}=0.75\)): Continuous as well as discrete finite-difference (FD, \(\epsilon /D =10^{-5}\))-based sensitivity derivative along the upper cylinder side for (left) a drag (\(r_{\rm i} = [1, 0]^{\rm T}\)) and drift (\(r_{\rm i} = [\sqrt{(}2), \sqrt{2}]^{\rm T}/2\)) functional, (center) the target concentration objective (\(\Omega ^{\rm O} = [-5D,D] \times [25 D,5 D]\)) as well as (right) three exemplary finite (force functional) system answers at \(x_{1}/D = 1/4\)

Fig. 4
figure 4

Submerged cylinder validation case (\(\text{Re}_{\rm D} = 20\), \(\text{Fn}=0.75\)): Continuous sensitivity derivative along the upper cylinder side using a drag functional (\(r_{\rm i} = [1, 0]^{\rm T}\)) for different adjoint systems A1-A9, cf. Table 3

Fig. 5
figure 5

Submerged cylinder validation case (\(\text{Re}_{\rm D} = 20\), \(\text{Fn}=0.75\)): Continuous sensitivity derivative along the upper cylinder side using an inverse concentration objective (\(\Omega_{\rm O} = [-5D,D] \times [25 D,5 D]\)) for different adjoint systems A1-A9, cf. Table 3

5.2 Global validation

Results presented in Sect. 5.1 demonstrate a fair agreement between adjoint-based sensitivities and FD results, provided that a consistent formulation is employed. On the other hand, manipulations based on the neglect of adjoint coupling terms reveal both qualitative and quantitative influences on the sensitivities. The below reported global validation compares the convergence of \((J - J^{\rm ini})/J^{\rm ini}\) for different adjoint systems. To this end, consistency influences on a complete optimization are assessed for ten formulations using either the consistent approach or one of the cases mentioned in Table 3 (A1-A9). The displacement of the cylinder was conserved during the optimization, and a constant maximum displacement \(d^{\rm max} = D/50\) was used to advance the shape. Mind that the entire geometry of the cylinder is subjected to the optimization.

Displayed results refer to the evolution of the normalized drag and the concentration objective as a function of the design candidate \(n^{\mathrm{opt}}\). Figure 6 reveals that the various adjoint formulations return similar final drag values. The optimization gain w.r.t. drag is maximized if the fully consistent adjoint formulation is employed. However, neglecting all four adjoint source terms (A1) decreases the gain by \(\approx 1\%\) only. The difference mostly arises within the last 20-30% of the optimization, and the initial reduction of the cost functional is often similar. Exceptions refer to results for A3 and A6, which both neglect the Froude term and underpin its relevance. When attention is directed to results obtained for the concentration-based objective depicted in Fig. 7, a more pronounced sensitivity to the formulation is observed. All adjoint systems that neglect the Froude term (A1-A2, A6-A8) perform a step into an ascent direction, and the optimization algorithm terminates. Moreover, the influence of the variation of the molecular viscosity (A5) appears to have a negligible impact.

Although the transfer of the results to turbulent marine engineering flows should be handled with caution, the validation results are indicative, particularly regarding the Froude term’s importance.

Fig. 6
figure 6

Submerged cylinder validation case (\(\text{Re}_{\rm D} = 20\), \(\text{Fn}=0.75\)): convergence of the drag objective (\(r_{\rm i} = [1, 0]^{\rm T}\)) for different adjoint systems A1-A9, cf. Table 3

Fig. 7
figure 7

Submerged cylinder validation case (\(\text{Re}_{\rm D} = 20\), \(\text{Fn}=0.75\)): Convergence of the inverse concentration objective (\(\Omega ^{\rm O} = [-5D,D] \times [25 D,5 D]\)) for different adjoint systems A1–A9, cf. Table 3

6 Application

The application study refers to an Offshore Supply Vessel (OSV, Fig. 8) in full-scale (FS). While such vessels frequently cruise at large speeds, their hull length is often small. Therefore an OSV typically operates at large Froude numbers (\(\text{Fn} > 0.3\)) and experiences large wave resistances based on, e.g., breaking waves. Minor modifications of the wave pattern might change the drag and substantially trigger a change of the floatation position. Thus the OSV case represents a challenging example for the present adjoint two-phase optimization framework under free floatation. Moreover, such vessels typically feature geometric constraints that affect the quality of the constraint management method, the related descent strategy, and the capabilities of the mesh deformation procedure.

We define the Reynolds and Froude numbers by reference to the length \(L^{\rm O}\) of the OSV, the cruising speed \(v_{1}\), the magnitude of the gravity vector G and the kinematic water viscosity \(\nu ^{\mathrm {b}}\). The investigated FS configuration yields \(\text{Re} = v_{1} L^{\rm O}/\nu ^{\mathrm {b}} = {2.81 } \cdot 10^8\), \(\text{Fn} = v_{1}/\sqrt{G L^{\rm O}} = 0.37\). Geometrical constraints considered in the present application refer to (a) the conservation of a plane transom that allows tangential-only deformation, (b) the preservation of the hydrostatic displacement, and (c) the adherence to a maximum length \(L^{\rm O}\) as well as a maximum permissible hydrostatic draught. The initial OSV consists of a hull, transom, bulkwark, and deck, as conceptually sketched in Fig. 8. The analysis is concerned with the steady-state in calm water conditions.

Fig. 8
figure 8

Perspective 3D representation of the initial Offshore Supply Vessel (OSV). Mind that the geometry used by the numerical studies employs a simplified deck model, cf. Fig. 9

As depicted in Fig. 9, the origin of the Cartesian coordinate system is located below the transom stern of the initial configuration, and the free surface is initialized in the \(x_{1}-x_{2}\) plane at \(x_{\rm 3}/L^{\rm O} = 1/16\).

Fig. 9
figure 9

a Schematic drawing of the initial configuration and b detail of the unstructured grid around the stern indicating the free surface behind the full scale Offshore Supply Vessel (OSV)

The simulation domain has a length, height and width of \(8 \, L^{\rm O}\), \(6 \, L^{\rm O}\) and \(4 \, L^{\rm O}\), where the outlet [bottom] boundaries are located four [two] OSV-lengths away from the origin. A dimensionless wave length of \(\lambda ^{\rm FS} = \lambda / L^{\rm O} = 2 \, \pi \, \mathrm {Fn}^2 = 0.852\) is expected and the total drag of the OSV should be minimized, viz. \(r_{\rm i} = -\delta_{\rm i 1}\) in (13). The utilized unstructured numerical grid around the transom is displayed in Fig. 9b and consists of approximately \({3} \cdot 10^6\) control volumes. Due to symmetry, only half of the geometry is modeled in lateral (\(x_{2}\)) direction. The fully turbulent simulations employ a wall-function-based kω SST model of Menter (1994) together with a non-dimensional wall-normal distance of \(y^+ \approx {50}\) for the first grid layer adjacent to the hull. The horizontal resolution of the free surface region is refined within a Kelvin-wedge to capture the wave field generated by the vessel, cf. Fig. 10. The free surface resolution employs approximately \(\Delta x_{1}/\lambda = \Delta x_{2}/\lambda = 1/50\) cells in the horizontal directions and \(\Delta x_{\rm 3}/\lambda = 1/500\) cells in the vertical direction. Convective primal [adjoint] fluxes are again approximated using the QUICK [QDICK] scheme, cf. Stück and Rung (2013). Only the respective approximation of the concentration equation follows again a different approach, cf. Sect. 5 and Kühl et al. (2021a, b). Simulations are advanced to a steady state in pseudo time at Courant numbers of \(\text{Co} \le 0.4\) using an Euler implicit approach. At the inlet, a homogeneous unidirectional (horizontal) bulk flow \(v_{\rm i} = v_{1} \delta_{i 1}\) is imposed for both phases in conjunction with a calm water concentration distribution. Slip walls are used along the top, bottom, and lateral boundaries, and a hydrostatic pressure boundary is employed along with the outlet. Similar to the validation study, the grid is stretched towards the outlet to suppress the outlet wave field and comply with the outlet condition. The boundary conditions are supplemented by a symmetry condition along the midship plane.

Fig. 10
figure 10

Top view on the numerical grid in the calm water plane of the Offshore Supply Vessel

Figure 11 displays results obtained for the computation of the initial geometry, i.e., the development of the normalized drag (left), normalized heave force \(F^{\rm H}\) and trim moment \(M^{\rm T}\) (center), as well as the non-dimensional sinkage \(S^{\rm O}/L^{\rm O}\) and pitch positions \(T^{\rm O}\) by reference to the initial hydrostatic floatation (right). As indicated by the evolution of the drag, the floatation is adjusted once every 5000-time steps, and the final floating position is found after approximately \(n^{\rm TS} = {40{,}000}\) steps.

Fig. 11
figure 11

Dynamic floating position and related forces for the initial OSV at full scale (\(\text{Re}_{\rm L} = {2.81} \times 10^8\), \(\text{Fn} = 0.37\)); (Left) Non-dimensional drag coefficient (\(p^{\infty} = 0.5 \, \rho^{\rm b} \, v_{1}^2\)), (center) non-dimensional lift and moment coefficient and (right) resulting dimensionless sinkage and trim angle over the number of time steps

All optimizations allow a tangential deformation of the lateral symmetry plane while maintaining the initial main dimensions of the OSV. Starting from the initial dynamic floating position, two sets of optimizations are performed, each using three different consistency levels for the considered adjoint PDE system. The first triplet neglects the floatation adjustment and requires a smaller number of steps \(n^{\rm TS}\) to converge the cost functional in pseudo time. The second triplet adjusts the floatation, which results in approximately twice the computational effort, cf. Table 4. The respective three adjoint systems are summarized as follows:

  1. E1

    Experiment 1 neglects both adjoint concentration contributions and adjoint turbulence effects within the adjoint momentum equation, i.e. \(\beta = 1\) and \({\hat{c}} \nabla_{\rm i}c \rightarrow 0\) in (17). The approach resembles a complete frozen concentration and a frozen turbulence approach, and no need arises to maintain a compressive adjoint concentration transport. The adjoint solution process is iterated in a steady-state manner which drastically reduces the computational time of the adjoint solver.

  2. E2

    The second experiment extends E1 only to improve the influence of adjoint turbulence effects, i.e. \(\beta = 2\) and \({\hat{c}} \nabla_{\rm i}c \rightarrow 0\) in (17). Therefore, E2 is more consistent w.r.t. adjoint turbulence but still corresponds to a frozen concentration approach, again allowing for a steady adjoint approximation.

  3. E3

    The third experiment maximizes the consistency of the adjoint system within the scope of this paper. Hence, the adjoint concentration transport is also coupled with the adjoint momentum balance, i.e. \(\beta = 2\) and \({\hat{c}} \nabla_{\rm i}c \ne 0\) in (17). Mind that this noticeably increases the computational effort, cf. Table 4.

Table 4 Measured computational effort in CPUh (\(n^{\rm opt} \cdot \overline{t^{\rm wc}} \cdot n^{\rm CPU}\)) for all six optimization studies, where \(\overline{t^{\rm wc}}\) refers to the mean wall clock time per optimization step and \(n^{\rm CPU}\) denotes the number of employed CPU cores

To ensure a fair comparison, all optimizations use different step sizes, which are scaled so that each first shape update has a maximum displacement of two per mil of the vessels length, i.e. \(d^{\rm max} = 2 L^{\rm O}/1000\) in Alg. 1.

Results of the optimizations are shown in Fig. 12 for triplet without (left) and with (center) floatation adjustment. All optimizations converge after 20-35 gradient steps while ensuring the prescribed geometrical constraints. In line with the results of the global validation study reported in Sect. 5.2, a clear trend towards a stronger cost functional decrease \((J - J^{\rm ini}) / J^{\rm ini}\) is observed for the more consistent formulations. While the resistance reduction observed in E1 is single digit (\(\approx\, 9\%\)) in both cases, already the algebraic turbulence model (E2) offers an improved drag reduction of about 2-3% w.r.t. E1. The largest decrease is obtained with the consistent approach E3, which provides an additional 1% drag reduction for the free floating vessel and even 3% for the fixed floatation case in comparison to E2. The additional optimization gain justifies the more cost intensive adjoint simulation which refers, to \({\mathcal{O}}\)(20,000) [\({\mathcal {O}}\)(30,000)] CPUh for the fixed [free] floating E3 case compared to \({\mathcal {O}}\)(10,000) [\({\mathcal {O}}\)(20,000)] CPUh for the respective E1 scenario, cf. Table 4. The E3 optimization with a fixed floating position provides the largest drag reduction of about 13.5%. Changes of the normalized hydrodynamic floatation for the E3 configuration with floatation adaption are given in the right graph of Fig. 12. The ship trims forward, but sinkage and—interestingly—displacement also increase.

Fig. 12
figure 12

Drag optimization of an Offshore Supply Vessel (OSV) at full scale (\(\text{Re}_{\rm L} = {2.81 }\times 10^8\), \(\text{Fn} =0.37\)): Convergences of the optimization for three different adjoint PDE systems (E1-E3) using fixed trim and sinkage (left) and adaptive trim and sinkage (center). Horizontal lines indicate the total resistance obtained with trim and sinkage adjustment after re-simulating the final design from scratch. Right) Relative hydrostatic data for the most consistent (E3) optimization from the center figure

After the optimization studies, the respective optimal shapes were re-computed from scratch while being free to adjust their floating position. This effort aims to assess (a) the credibility of the deformation procedure for the triplet that was optimized with an adjustment of the floating position and (b) the uncertainties introduced by neglecting the adjustment of the floating position during a shape optimization. Non-dimensional drag values obtained from these simulations are indicated by the horizontal lines in Fig. 12. As indicated in the center graph, the results of the re-computed optimized geometries are in fair agreement with the final results of the optimization study with an adjustment of the floating position. As expected, the re-computed drag results deviate from their respective companion results when the floating position is fixed during the optimization. In two cases (E2, E3) the gain decreases and in one case (E1) the result even improves, cf. Fig. 12 (left). Though the related drag modifications are limited, reliable predictions only follow optimizations that account for floatation, cf. below.

Figures 13, 14 and 15 display the optimized hull shapes using frame, water and buttock lines. The observed drag reductions follow from significant changes in the hull shapes. Figure 13 presents frames (top), water lines (middle), and buttocks (bottom) of the initial and the optimized geometry (E3) with the adaption of trim and sinkage. Above all, the S-twist is reduced, the displacement and thickness in the bow area are decreased, and the stern is raised.

Fig. 13
figure 13

Drag optimization of an Offshore Supply Vessel (OSV) at full scale (\(\text{Re}_{\rm L} ={2.81 } \times 10^8, \text{Fn} =0.37\)) with adjustment of floating position: Normalized (Top) frames, (center) waterlines and (bottom) buttocks for the initial (black) and optimized (blue, dashed) geometry. (Color figure online)

A comparison of optimized shapes obtained when adjusting the floatation is shown in Fig. 14 for the three consistency levels E1 (black), E2 (orange, dotted), and E3 (blue, dashed). Qualitatively, the shape changes are similar, but quantitative differences are most pronounced for case E3, particularly in the stern regime.

Fig. 14
figure 14

Drag optimization of an Offshore Supply Vessel (OSV) at full scale (\(\text{Re}_{\rm L} ={2.81 }\times 10^8\), \(\text{Fn} =0.37\)): Comparison of optimized normalized (Top) frames, (center) waterlines and (bottom) buttocks using different consistency levels, i.e. E1 (black), E2 (orange, dotted), and E3 (blue,dashed). (Color figure online)

Figure 15 compares the optimized geometries obtained from the two E3 configurations (fixed vs. adaptive floatation). The geometries reveal substantial differences regarding the bow and the stern region, with much more pronounced S-shaped outer water lines and a rear-shift of the displacement for the fixed floating position geometry. While this indicates discrepant descent directions, the differences—notably the surprisingly positive results returned by optimizing for a fixed floating position—might raise concerns about step size influences.

Fig. 15
figure 15

Drag optimization of an Offshore Supply Vessel (OSV) at full scale (\(\text{Re}_{\rm L} = {2.81 }\times 10^8\), \(\text{Fn} =0.37\)): Normalized (Top) frames, (center) waterlines and (bottom) buttocks for the most consistent (E3) optimized shapes with (blue, dashed) and without (black) floatation adjustment during the optimization

Therefore a supplementary study on step size influences was performed for a smaller scale configuration, i.e. \(\text{Re}^{\rm MS} = {8.92 }\times 10^6\), \(\text{Fn}^{\rm MS} = 0.32\). Three different maximum initial deformations, i.e. \(d^{\rm max} = L^{\rm O}/1000\), \(d^{\rm max} = 2 L^{\rm O}/1000\), \(d^{\rm max} = 4 L^{\rm O}/1000\), were investigated in combination with configuration E3. Results of this study are shown in Fig. 16. The left graph depicts results obtained from a fixed floating optimization and the center graph refers to optimizations with an adjusted floating position. The figure reveals that the step size has no influence on the optimization result. However, in conjunction with a fixed position, the optimization gain drops significantly once the final design is released to find its floating position, cf. horizontal lines in Fig. 16. The sensitive interplay between shape modification and floatation can be anticipated from the right graph of the figure. Therein, the free surface, including a breaking bow wave, is compared for two design candidates, i.e., \(n^{\rm opt}=17\) and \(n^{\rm opt}=20\). A decreased breaking wave amplitude arises during these three optimization steps. This reveals a strong nonlinearity in the design space and significantly influences the floatation—which has been neglected in this particular study—and finally yields a substantial trend reversal of the optimization.

As illustrated, the differences experienced from changing the floating position of a hull optimized in a fixed position can be fairly detrimental. Hence, adjusting the floating position is highly recommended to secure the optimization efforts and reduce uncertainties.

Fig. 16
figure 16

Drag optimization of an Offshore Supply Vessel (OSV) in model scale (\(\text{Re}_{\rm L}^{\rm MS} ={8.92 }\times 10^6\), \(\text{Fn}^{\rm MS} = 0.32\)); Convergence of the optimization using fixed (left) and adaptive (right) floating positions during the optimization. Dashed horizontal lines indicate the total resistance obtained with adaptive trim and sinkage adjustment after re-meshing and re-simulating the final designs for \(d^{\rm max} = L^{\rm O}/1000\) from scratch. Right) Wave field in the bow region displayed by design candidates 17 (left side) and 20 (right side)

7 Conclusion

The paper reports a node-based continuous adjoint two-phase flow procedure to optimize hull shapes of free-floating vessels. To this end, three topics were addressed that refer to: (1) An adequate two-phase flow model, (2) the relevance of floatation and consistency within the optimization framework, and (3) appropriate descent direction computations that obey local and global technical constraints.

It is seen that elements of a CH model should augment frequently employed VoF two-phase flow models to facilitate dual consistency. With attention being restricted to industrial flow simulations that do not resolve the interface physics, i.e. in the discrete sharp interface limit, related modifications are lucid and result in a nonlinear diffusion supplement to the primal/adjoint concentration transport. The authors are convinced that this is crucial for a robust primal/adjoint coupling in marine engineering applications, particularly when attention is devoted to full-scale optimizations at large Reynolds and Froude numbers.

The paper supports the endeavor for adjoint consistency. An algebraic augmentation of the adjoint eddy viscosity—which was recently suggested by reference to log-law physics—returns noticeable benefits with around 2% increased drag reduction for the optimal configuration. More importantly, the concentration contribution to the adjoint momentum equation should be considered to expose the full potential of the adjoint optimization. Furthermore, all density variation terms of the adjoint concentration equation must be considered to secure a gradient descent.

Load variations—induced by the shape update—alter the vessel’s floatation, particularly the trim and sinkage, which in turn yield modified loads. To mitigate the related uncertainties, adjusting the floating position during the optimization is highly recommended. The present study suggests that a “frozen adjoint floatation” approach is sufficient for steady-state resistance optimizations.

The Steklov–Poincaré metric offers an efficient gradient computation strategy that intensively re-uses the established coding infrastructure of a CFD algorithm. Its merits refer to the simultaneous update of the volume and the surface mesh of the optimized shape. Furthermore, the procedure can easily be customized to obey local and global technical constraints on the vessel’s displacement, extensions, and further design demands such as, e.g., a plane transom.