1 Introduction

This paper is concerned with the formulation of an adjoint Law of the Wall (LoW) serving the formulation of momentum boundary conditions in an adjoint analysis and a related algebraic treatment of turbulence in the adjoint framework. In the context of local fluid dynamic optimization, 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 (Giles and Pierce 1997, 2000; Papoutsis-Kiachagias and Giannakoglou 2016; Kröger et al. 2018; Kapellos et al. 2019). In continuous space, the dual or adjoint flow state can be interpreted as a co-state and always follows from the underlying primal Partial Differential Equation (PDE) governed model that describes the flow physics. However, the appropriate formulation of boundary conditions is often not intuitively clear in a PDE-based, continuous adjoint framework and the development of numerical strategies clearly lags behind the primal progress (Soto and Löhner 2004; Othmer 2008; Zymaris et al. 2010; Stück and Rung 2013; Othmer 2014).

Modelling equations for the turbulent closure appear comparatively complex already on the primal side. The latter is underlined by an unfavourable algorithmic complexity that contains possibly non-differentiable expressions making it unhandy for a continuous adjoint approach which has motivated the neglect of adjoint turbulence models in line with the frozen turbulence approach (Soto et al. 2004; Othmer 2008; Dwight and Brézillon 2006). However, the influence of the variation of the turbulence parameters is an open discussion (Marta and Shankaran 2013; Dwight and Brézillon 2006) which is why discrete adjoint approaches using automatic differentiation have been derived that aim at a synchronization of the primal and dual turbulent development states, cf. Nielsen et al. (2004), Nielsen et al. (2010), Nielsen and Diskin (2013). The discrete approach passes over the adjoint PDE and directly bridges the discrete linearized primal flow into a consistent discrete dual approach, cf. Giles and Pierce (1997), Giles and Pierce (2000) or Vassberg and Jameson (2006), Vassberg and Jameson (2006). Despite the various merits and drawbacks of the discrete vs. the continuous adjoint method, the latter is unique for its invaluable contribution to a physical understanding. The development of the continuous adjoint method w.r.t. adjoint turbulence modelling initially started with the derivation of adjoint one equation closures (Zymaris et al. 2009; Bueno-Orovio et al. 2012; Bagheri and Da Ronch 2020) followed by the complete linearization of prominent statistical closures, e.g. an adjoint \(k-\varepsilon\) (Papoutsis-Kiachagias et al. 2015; Zymaris et al. 2010) and \(k-\omega\) (Kavvadias et al. 2015; Hartmann et al. 2011; Manservisi and Menghini 2016a, b) model. All previously mentioned contributions share the idea of deriving adjoint turbulence modelling equations. Optimizations of complex engineering flows using fully consistent, differentiated turbulence transport models are comparatively rare and an overview of applications of continuous adjoint methods, including various differentiated turbulence models, is documented in Papoutsis-Kiachagias and Giannakoglou (2016). Primal turbulence transport models inhere multiple non-linearities and inter-parameter couplings, that might significantly hamper the robustness and the efficiency of a consistent adjoint framework and hinder their utilization in engineering applications. On the other hand, the continuous adjoint framework gives access to dedicated adjoint turbulence modelling at a lower level of adjoint consistency. Thus, one research question of the present effort is to investigate the potential of an improved frozen turbulence approach that retains the algorithmic and efficiency benefits.

In contrast to former studies, our study originates from analysing the adjoint complement to a simple unidirectional turbulent shear flow, which is the foundation of the universal Law of the Wall that governs virtually all wall function based turbulent boundary conditions using the mixing-length hypothesis (Prandtl 1925; Pope 2001). We believe that there is a fundamental interest into an analytical formulation for a continuous adjoint complement to the momentum law of the wall, since the concept is (and perhaps will be) intensively employed by turbulent flow simulations using wall functions. To this extent, the paper distinguishes between two adjoint turbulence formulations, i.e. an algebraic, mixing-length based approach and a simple frozen turbulence approach. With reference to the adjoint LoW, both formulations differ only in a single scalar coefficient in the logarithmic region and a simple scaling with the ratio of the friction velocities. The analysis suggests a surprisingly simple algebraic approximation for an adjoint turbulence treatment. Results obtained by this strategy are deemed consistent to LoW physics and indicate improvements over the frozen turbulence assumption when applied to more general flows without solving an adjoint turbulence transport model.

The remainder of the paper is organized as follows: Sections  2 and 3 are concerned with the derivation of the adjoint unidirectional shear flow equations for a frozen as well as a consistently linearized turbulent viscosity contribution. The subsequent Sect. 4 derives an adjoint complement to the primal LoW. In Sect. 5 we discuss our findings w.r.t. more sophisticated two-equation turbulence models. Verification studies are presented in the 6th section. Section 7 scrutinizes the performance of the suggested algebraic model for several internal and external shape optimization examples of engineering relevance. The final Sect. 8 provides conclusions and outlines future research. Within the publication, Einstein’s summation convention is used for lower-case Latin subscripts and vectors as well as tensors are defined with reference to Cartesian coordinates.

2 Primal Unidirectional Shear Flow

We start with a brief discussion of a simple—yet commonly used—incompressible primal flow description. The discussion is confined to plane wall flows, using a local orthogonal coordinate system as illustrated in Fig. 1, where y denotes the wall normal coordinate or distance and x refers to the wall tangential direction. The flow field is usually considered to be fully developed and assumed as uni-directional, i.e. u(y) in the vicinity of the wall. Extensions to more general curved near wall flows have been published in Zymaris et al. (2010), Lübcke et al. (2001) but are not considered here to save space. A key element of the concept—which is crucial for the formulation of boundary conditions for turbulent wall flows—is the constant shear stress hypothesis. The latter assumes \(\tau _\mathrm {eff} = \mathrm {const.}\) for the inner region of a wall boundary layer \(y/\Delta<<1\) where \(y = \Delta\) denotes the outer edge of the boundary layer. The simple relation substitutes the momentum equation above the wall and supports the derivation of both the primal and the adjoint LoW, viz.

$$\begin{aligned} \mathrm {R}^\mathrm {u}: \qquad \frac{\mathrm {d}\tau _\mathrm {eff}}{\mathrm {d} y} = \frac{\mathrm {d}}{\mathrm {d} y} \left[ \mu _\mathrm {eff} \frac{\mathrm {d} u}{\mathrm {d} y} \right] = 0 \, , \qquad \mathrm {with} \qquad \mu _\mathrm {eff} = \mu + \mu _\mathrm {t} \; . \end{aligned}$$
(1)

The validity of (1) is restricted to approximately the inner 20% of the boundary layer and widens with increasing boundary-layer thickness, cf. Pope (2001), Wilcox (1998). An isotropic Boussinesq-viscosity model (BVM) is frequently employed in the majority of Reynolds-averaged Navier-Stokes (RANS) or large-eddy simulation (LES) frameworks to supplement the laminar, molecular stress \(\tau _\mathrm {l}= \mu \; \mathrm {d} u/\mathrm {d} y\) by a companion turbulent stress \(\tau _\mathrm {t}= \mu _\mathrm {t} \; \mathrm {d} u/\mathrm {d} y\) and close the formulation. Mind that despite the particular turbulence model employed to determine \(\mu _\mathrm {t}\), e.g. the \(k-\epsilon\), \(k-\omega\) or \(\nu _\mathrm {t}\) formulation (Wilcox 1998; Spalart and Allmaras 1992), their values usually comply with the mixing length hypothesis in the logarithmic layer, i.e. \(\mu _\mathrm {t} = \rho \left( \kappa \, y \right) ^2 \mathrm {d} u/\mathrm {d} y\), where (\(\kappa y\)) denotes the mixing length and \(\kappa\) is the von-Karman constant.

3 Adjoint Unidirectional Shear Flow

The adjoint system studied herein should provide gradient information for a boundary-based objective \(j_{\Gamma }\) w.r.t a general control parameter, e.g. the shape of the wall (\(\delta _\mathrm {y} j_{\Gamma }\)). For this purpose, a variation of the fluid velocity will be attached to a perturbation in wall normal direction if the wall is examined for its optimization potential. Based on the concept of material derivative, a linear development of the local flow w.r.t. a perturbation in wall normal direction yields \(\delta u = - (\mathrm {d} u / \mathrm {d} y) \delta y\), cf. Soto and Löhner (2004), Othmer (2008), Schmidt and Schulz (2009), Stück and Rung (2013). A widely used exemplary objective refers to the flow induced shear force \(j_{{\Gamma }} = \mu _{\mathrm {eff}} [ \mathrm {d} u / \mathrm {d} y]\) along the wall. We would like to point out that there are different adjoint answers to the same question, e.g. regarding fluid flow-induced forces (Kühl et al. 2019, 2021). If attention is given to a boundary layer, e.g. the lower half of a channel outlined in Fig. 1, the constraint optimization problem is transformed into an unconstrained formulation based on a Lagrangian L

$$\begin{aligned} \mathrm {min} \quad J = \mu _\mathrm {eff} \frac{\mathrm {d} u}{\mathrm {d} y} \bigg \vert _\mathrm {w} \quad \mathrm {s.t.} \quad \mathrm {R}^\mathrm {u} = 0 \qquad \rightarrow \qquad L = J + \int _{{\mathrm {w}}}^{{\Delta }} {\hat{u}} \, \mathrm {R}^\mathrm {u} \, \mathrm {d} y \, , \end{aligned}$$
(2)

where the index \((\cdot )_\mathrm {w}\) denotes to a wall value. Equation (2) inheres a Lagrangian multiplier \({\hat{u}}\) which is frequently labeled as the dual or adjoint velocity. Its dimension depends on the underlying objective, e.g. \([{\hat{u}}] = [J]/( [R^\mathrm {u}] \, m^2)\) where \([J] = [j_{\Gamma }] \, m\) represents the units of the boundary-based objective. The total variation of the Lagrangian leads to the adjoint equation. Using \(\rho \, \nu _\mathrm {eff} = \mu _\mathrm {eff}\) together with a constant density \(\rho\), we obtain

$$\begin{aligned} \delta L = (\delta \nu _\mathrm {eff}) \frac{\mathrm {d} u}{\mathrm {d} y}\bigg \vert _\mathrm {w} + \nu _\mathrm {eff} \frac{\mathrm {d} (\delta u)}{\mathrm {d} y}\bigg \vert _\mathrm {w} + \int _{{\mathrm {w}}}^{{\Delta }} {\hat{u}} \left[ \frac{\mathrm {d}}{\mathrm {d} y} \left[ (\delta \nu _\mathrm {eff}) \frac{\mathrm {d} u}{\mathrm {d} y} + \nu _\mathrm {eff} \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} \right] \right] \, \mathrm {d} y \, . \end{aligned}$$
(3)

The frozen turbulence assumption neglects the variation of the turbulent viscosity, i.e. \(\delta \nu _\mathrm {eff} = 0\). An isolation of \(\delta u\) allows the formulation of first order optimality conditions, viz.

$$\begin{aligned} \delta _\mathrm {u} L \cdot \delta u&= \nu _\mathrm {eff} \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} \bigg \vert _\mathrm {w} + \left[ \nu _\mathrm {eff} \left( {\hat{u}} \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} - \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} (\delta u) \right) \right] _\mathrm {w}^{\Delta }\nonumber \\&\quad + \int _{{\mathrm {w}}}^{{\Delta }} \delta u \left[ \frac{\mathrm {d}}{\mathrm {d} y} \left[ \nu _\mathrm {eff} \frac{\mathrm {d} {\hat{u}} }{\mathrm {d} y} \right] \right] \, \mathrm {d} y \qquad \overset{!}{=} 0 \qquad \forall \, \delta u \, . \end{aligned}$$
(4)

Here \(y = \Delta\) marks the position of the outer boundary. The adjoint equation to (1) follows from the integral expression in (4) and reads

$$\begin{aligned} {{\hat{R}}}^{{\hat{u}}, F}&: \qquad \frac{\mathrm {d}}{\mathrm {d} y} \left[ (\nu + \nu _\mathrm {t}) \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} \right] = 0 \, . \end{aligned}$$
(5)

The asterisk (F) indicates the adjoint equation based on the frozen turbulence assumption that resembles its primal counterpart in a self-adjoint manner. The boundary conditions along the wall as well as the outer boundary follow from the remaining terms, viz.

$$\begin{aligned} y = {\Delta }&: \qquad \left[ \hat{u} \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} - \frac{\mathrm {d} \hat{u}}{\mathrm {d} y} (\delta u) \right] \qquad \mathrm {with} \qquad \delta \left( \frac{\mathrm {d} u}{\mathrm {d} y} \right) = \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} = 0 \qquad&\rightarrow \qquad \frac{\mathrm {d} \hat{u}}{\mathrm {d} y} \bigg \vert _{\Delta } = 0 \end{aligned}$$
(6)
$$\begin{aligned} y={\mathrm {w}}&: \qquad \left[ (1+\hat{u}) \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} - \frac{\mathrm {d} \hat{u}}{\mathrm {d} y} (\delta u) \right] \qquad \mathrm {with} \qquad \delta u = 0 \qquad&\rightarrow \qquad \hat{u} \big \vert _{\mathrm {w}} = -1. \end{aligned}$$
(7)

A consistent approach also considers the variation of the turbulent viscosity. Thanks to the employed mixing length hypothesis, the turbulent viscosity exclusively depends on the tangential mean velocity and the related variation reads \(\delta \nu _\mathrm {eff} = (\kappa y)^2 \, (\mathrm {d} (\delta u) / \mathrm {d} y)\). The latter augments (4) towards a consistent total variation

$$\begin{aligned} \delta _\mathrm {u} L \cdot \delta u&= (\nu _\mathrm {eff} + \nu _\mathrm {t}) \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} \bigg \vert _\mathrm {w} + \left[ (\nu _\mathrm {eff} + \nu _\mathrm {t})\left( {\hat{u}} \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} - \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} (\delta u) \right) \right] _\mathrm {w}^{\Delta }\nonumber \\&\quad + \int _{{\mathrm {w}}}^{{\Delta }} \delta u \left[ \frac{\mathrm {d}}{\mathrm {d} y} \left[ (\nu _\mathrm {eff} + \nu _\mathrm {t}) \frac{\mathrm {d} {\hat{u}} }{\mathrm {d} y} \right] \right] \, \mathrm {d} y \qquad \overset{!}{=} 0 \qquad \forall \, \delta u . \end{aligned}$$
(8)

Interestingly, (8) resembles (4) by doubling the turbulent contribution. Hence, the consistent (C) adjoint to (1) reads

$$\begin{aligned} {{\hat{R}}}^{{\hat{u}}, C}: \qquad \frac{\mathrm {d}}{\mathrm {d} y} \left[ \left( \nu + 2 \nu _\mathrm {t}\right) \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} \right] = 0 . \end{aligned}$$
(9)

The asterisk (C) serves to separate the adjoint formulation based on the consistent algebraic turbulence model from the frozen turbulence framework. Necessary boundary conditions follow again from the boundary parts in (8) and agree with Eqs. (6)-(7).

A sensitivity rule of the objective w.r.t. a general control variable depends on the definition as well as on the nature of the control. E.g. the relation \(\delta u = 0\) (cf. Eq. (7)) along the channel wall holds as long as the wall is not subjected to control. However, if the wall is examined for its optimization potential, further variational contributions follow from a general shape calculus and are available based on a linear development of the local flow w.r.t. a perturbation in wall normal direction \(\delta u = - (\mathrm {d} u / \mathrm {d} y) \delta y\). The latter yields a shape sensitivity derivative expression

$$\begin{aligned} y&={\mathrm {w}}: \qquad \delta _\mathrm {y} L \cdot \delta y = \delta _\mathrm {y} j_{\Gamma } \cdot \delta y + \nu _\mathrm {eff} \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} \frac{\mathrm {d} u}{\mathrm {d} y} \delta y \quad \overset{!}{=} 0 \quad \forall \, \delta y \qquad \rightarrow \qquad \delta _\mathrm {y} j_{\Gamma } = - (\nu + \beta \nu _\mathrm {t}) \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} \bigg \vert _\mathrm {w} \frac{\mathrm {d} u}{\mathrm {d} y} \bigg \vert _\mathrm {w} \end{aligned}$$
(10)

along the controlled part of the channel boundary and we refer to Soto et al. (2004), Soto and Löhner (2004), Othmer (2008), Kühl et al. (2019) for a detailed discussion. The coefficient \(\beta = 1\) [\(\beta = 2\)] accounts for a frozen [consistent] algebraic formulation.

4 Law of the Wall

The primal flow description (1) refers to a unidirectional shear flow and assumes a constant near wall stress. According to its units, the constant stress \(\tau _\mathrm {eff}\) is anticipated to be proportional to the square of a friction velocity \(U_{\tau }\), viz. \(\tau _\mathrm {eff} := \rho \, U_{\tau }^2\). The two-layer model assumes a vanishing turbulent stress in the immediate vicinity of the turbulence damping wall (\(\mu _\mathrm {t}/\mu \rightarrow 0\)), frequently labeled as viscous sub-layer, and the opposite behavior beyond a certain wall-normal distance, i.e. inside the logarithmic-layer, where \(\mu /\mu _\mathrm {t} \rightarrow 0\). Using \(\nu = \mu / \rho\) and \(\nu _\mathrm {t} = \mu _\mathrm {t} / \rho\), Eq. (1) is usually integrated separately for both limit cases

$$\begin{aligned} y < \tilde{y}:&\qquad U_{\tau }^2 = \nu \frac{{\mathrm {d}} u}{{\mathrm {d}} y} \qquad&\rightarrow \qquad u = \frac{U_{\uptau }^2}{\nu } y + C_1 \, , \end{aligned}$$
(11)
$$\begin{aligned} y \ge \tilde{y}:&\qquad U_{\tau }^2 = (\kappa y)^2 \left| \frac{{\mathrm {d}} u}{{\mathrm {d}} y} \right| \frac{{\mathrm {d}} u}{\mathrm {d} y} \qquad&\rightarrow \qquad u = \frac{U_{{\uptau }}}{\kappa } {\mathrm {ln}}(y) + C_2 \, , \end{aligned}$$
(12)

where \({\tilde{y}}\) represents the (theoretical) intersection of the sub- and the logarithmic-layer solution. The use of a no-slip condition along the wall, i.e. at \(y = \mathrm {w}\), returns \(u_\mathrm {w} = C_1 = 0\). The integration constant \(C_2\) is chosen such that the desired transition point is realized and thereby hinges on the choice of \(\kappa\). Using non-dimensional parameters based on inner scaling, i.e. \(y^+ = U_{\tau } y / \nu\) and \(u^+ {:}{=}u / U_{\tau }\), yields a more compact form of the LoW (12), viz.

$$\begin{aligned} u^+ = {\left\{ \begin{array}{ll} y^+ &{} \text {for} \, y^+ < {\tilde{y}}^+ \\ \frac{1}{\kappa } \ln {(y^+)} + B &{} \text {for} \, y^+ \ge {\tilde{y}}^+ \; , \end{array}\right. } \end{aligned}$$
(13)

where the former constant \(C_2\) is turned into a non-dimensional constant B. Frequently used parameter combinations refer to \(\kappa =0.4\) and \(B = 5\) to match \({{\tilde{y}}}^+ \approx 11\). In reality the transition from the near-wall to the logarithmic-layer solution spreads over a small region labeled as buffer-layer.

The adjoint complement to the LoW (13) also follows the two-layer ansatz. In line with (1), (4) and (9), the adjoint shear flow also features a constant adjoint shear stress, viz.

$$\begin{aligned} \frac{\mathrm {d} {\hat{\tau }}_\mathrm {eff}}{\mathrm {d} y} = 0 \; , \qquad \rightarrow \qquad {\hat{\tau }}_\mathrm {eff} = {\hat{\tau }}_\mathrm {l} + {\hat{\tau }}_\mathrm {t} = (\mu + \beta \mu _{\mathrm {t}}) \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} = \mathrm {const.} =: \rho \, {\hat{U}}_{\tau }^2 \; \; . \end{aligned}$$
(14)

Equation (14) utilizes a coefficient \(\beta\) to switch between the frozen (F; \(\beta = 1\)) and the consistent (C; \(\beta = 2\)) algebraic approach. Along the route of the primal flow, the adjoint stress \({\hat{\tau }}_\mathrm {eff}\) is anticipated to behave proportional to the square of an adjoint friction velocity \({\hat{U}}_{\tau }\). The two-layer model inherited from the primal flow restricts the effective viscosity of the viscous layer (\(\mu _\mathrm {t}/\mu \rightarrow 0\)) and the log-layer (\(\mu /\mu _\mathrm {t} \rightarrow 0\)). Analogue to the primal derivation, Eq. (14) is integrated separately for both cases

$$\begin{aligned} y \le \tilde{y}:&\qquad \hat{U}_{\tau }^2 = \nu \frac{\mathrm {d} \hat{u}}{\mathrm {d} y} \qquad&\rightarrow \qquad \hat{u} = \frac{\hat{U}_{\tau }^2}{\nu } y + \hat{C}_\mathrm {1}, \end{aligned}$$
(15)
$$\begin{aligned} y \ge \tilde{y}:&\qquad \hat{U}_{\tau }^2 = \beta (\kappa y)^2 \frac{\mathrm {d} u}{\mathrm {d} y} \frac{\mathrm {d} \hat{u}}{\mathrm {d} y} \qquad&\rightarrow \qquad \hat{u} = \frac{1}{\beta } \left( \frac{\hat{U}_{\tau }}{U_{\tau }} \right) \frac{\hat{U}_{\tau }}{\kappa } \mathrm {ln}(y) + \hat{C}_\mathrm {2} \, . \end{aligned}$$
(16)

Note that the primal velocity gradient in the logarithmic regime \(\mathrm {d} u / \mathrm {d} y\) was replaced by \(U_{\tau } / (\kappa y)\) to solve for the adjoint tangential velocity. Applying a similar velocity normalization, i.e. \({\hat{u}}^+ {:}{=}{\hat{u}} / {\hat{U}}_{\tau }\), yields a compact form of the adjoint LoW similar to (13), viz.

$$\begin{aligned} {\hat{u}}^+ = {\left\{ \begin{array}{ll} y^+ \frac{{\hat{U}}_{\tau }}{U_{\tau }} + \frac{{\hat{u}}_\mathrm {w}}{{\hat{U}}_{\tau }} &{} \text {for} \, y^+ < {\tilde{y}}^+ \\ \frac{1}{\beta \, \kappa } \ln {(y^+)} \left( \frac{{\hat{U}}_{\tau }}{U_{\tau }} \right) + {\hat{B}} &{} \text {for} \, y^+ \ge {\tilde{y}}^+ \end{array}\right. }. \end{aligned}$$
(17)

Despite a possible shift due to non-intuitive boundary conditions, the adjoint LoW resembles the primal counterpart scaled by the friction velocity ratio \(({\hat{U}}_{\tau } / U_{\tau })\) and employs half the logarithmic inclination by the parameter \(\beta\) for the consistent approach.

Since the adjoint field quantities are mathematically motivated, their adjoint boundary conditions enter the integration constants in Eqs. (15)–(16). Depending on the objective under investigation, the adjoint velocity potentially experiences a non-zero boundary condition along no-slip walls, hence \({\hat{C}}_\mathrm {1} = {\hat{u}}_\mathrm {w}\), e.g. \({\hat{C}}_\mathrm {1} = -1\) if the shear stress objective from Sect. 2 is considered. The piece-wise continuous transition from the sub- towards the logarithmic-layer is ensured by an appropriate value of \({\hat{C}}_\mathrm {2}\). The latter is reformulated into \({\hat{B}}\) as an adjoint counterpart of the primal B. Using

$$\begin{aligned} {\tilde{y}}^+ \frac{{\hat{U}}_{\tau }}{U_{\tau }} + \frac{{\hat{u}}_\mathrm {w}}{{\hat{U}}_{\tau }} \, \overset{!}{=} \, \frac{1}{\beta \, \kappa } \ln {({\tilde{y}}^+)} \frac{{\hat{U}}_{\tau }}{U_{\tau }} + {\hat{B}} \qquad \mathrm {and} \qquad {\tilde{y}}^+ \, \overset{!}{=} \, \frac{1}{\kappa } \ln {({\tilde{y}}^+)} + B \end{aligned}$$
(18)

we conclude that the adjoint \({\hat{B}}\) follows from the primal B, where the latter is augmented by a constant shift in line with the prescribed boundary condition for the adjoint velocity, viz.

$$\begin{aligned} {\hat{B}} = \frac{{\hat{u}}_\mathrm {w}}{{\hat{U}}_{\tau }} + \frac{{\hat{U}}_{\tau }}{U_{\tau }} \left[ \frac{B}{\beta } + {\tilde{y}}^+ \left( 1 - \frac{1}{\beta } \right) \right] . \end{aligned}$$
(19)

5 Adjoint Two-Equation Wall Functions

This section tries to convey the notion that the simple manipulation of adjoint turbulence viscosity also supports more general BVM. We refer to the frequently used baseline \(k-\varepsilon\) model (Jones and Launder 1972) as an exemplary turbulence closure of the primal flow equations. The employed wall boundary conditions are of significance. They refer to standard approaches, used by most engineering finite volume methods, and employ a prescribed shear stress \(\tau _\mathrm {w} =\tau _\mathrm {eff}\) as well as pressure load on the wall face of the wall adjacent elements to close the primal momentum equations. Zero wall-normal gradients for the turbulent kinetic energy (TKE) k and a prescribed near wall value of the energy dissipation \(\varepsilon\), including the assurance of the local turbulence equilibrium \(P_\mathrm {k} = \varepsilon\) in the wall adjacent node / cell / element, serve to close the primal turbulence model equations, cf. Wilcox (1998). The study resembles the investigation already performed in Sect. 2 by directly imposing either the primal low-Re or high-Re formulation.

The algorithmic structure for the low- and the high-Re situation is identical. The only difference refers to assigned specific values for the wall shear in line with either of the two solutions (13), and the near wall value of \(\epsilon\) which accommodates to the low- (\(\epsilon = 2 \nu k/y^2\)) or the high-Re situation (\(\epsilon = u_{\tau }^3 / (\kappa y) = (\sqrt{C_{\mu }}k)^{3/2}/(\kappa y)\)). As regards the adjoint approach, we only consider the adjoint momentum. The wall value \({\hat{u}}_\mathrm {w}\) does—of course—not differ for the low- and the high-Re situation. However, when attention is given to high-Re simulations, the resolution of \({\hat{u}}\) in the very near-wall region is deemed computationally expensive and it is more convenient to follow the same implementation strategy as for the primal flow.

In the following, our exemplary objective again refers to the fluid flow induced shear force.

Employing a low-Re approach, one frequently imposes

$$\begin{aligned} k = 0, \quad \epsilon = 2 \nu \frac{k}{y^2} \qquad \text { and thus } \qquad \nu _\mathrm {t} = 0 \end{aligned}$$
(20)

for the turbulent quantities in the very near-wall regime. This allows for the construction of a Lagrangian, viz.

$$\begin{aligned} L = \left[ \nu \frac{\mathrm {d} u}{\mathrm {d} y} \right] _\mathrm {w} + \int _{{\mathrm {w}}}^{{\Delta }} \left[ {\hat{u}} \frac{\mathrm {d}}{\mathrm {d} y} \left[ \nu \left( \frac{\mathrm {d} u}{\mathrm {d} y}\right) \right] + {\hat{k}} \left[ k \right] + {\hat{\epsilon }} \left[ \epsilon - 2 \nu \frac{k}{y^2} \right] \right] \mathrm {d} y \, . \end{aligned}$$
(21)

The variation of (21)reads

$$\begin{aligned} \delta L = \left[ \nu \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} \right] _\mathrm {w} + \int _{{\mathrm {w}}}^{{\Delta }} \left[ {\hat{u}} \frac{\mathrm {d}}{\mathrm {d} y} \left[ \nu \left( \frac{\mathrm {d} (\delta u)}{\mathrm {d} y}\right) \right] + {\hat{k}} \left[ \delta k \right] + {\hat{\epsilon }} \left[ \delta \epsilon - 2 \nu \frac{\delta k}{y^2} \right] \right] \mathrm {d} y \end{aligned}$$
(22)

and can be rearranged to apply first order optimality conditions, viz.

$$\begin{aligned} \delta L&= \left[ \nu \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} \right] _\mathrm {w} + \nu \left[ {\hat{u}} \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} - \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} (\delta u) \right] _\mathrm {w}^\Delta + \int _{{\mathrm {w}}}^{{\Delta }} \left[ (\delta u) \, \frac{\mathrm {d}}{\mathrm {d} y} \left[ \nu \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} \right] \nonumber \right. \\&\left. \quad + \delta k \left[ {\hat{k}} -{\hat{\epsilon }} \, \frac{2 \nu }{y^2} \right] + \delta \epsilon \left[ {\hat{\epsilon }} \right] \right] \mathrm {d} y \quad \overset{!}{=} 0 \quad \forall \, (\delta u, \delta k, \delta \epsilon ) \, . \end{aligned}$$
(23)

The adjoint low-Re formulation follows from the integral in (23) and yields

$$\begin{aligned} {\hat{\epsilon }} = 0 \quad \mathrm {and} \quad {\hat{k}} = 0 \qquad \rightarrow \qquad \int _{{\mathrm {w}}}^{{\Delta }} \left[ \frac{\mathrm {d}}{\mathrm {d} y} \left[ \nu \; \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} \right] \right] \mathrm {d} y = 0 \end{aligned}$$
(24)

and agrees with the observations already documented in the frozen turbulence part of Sect. 2, cf. Eq. (5). Mind that (23) is also fulfilled if \(\partial k / \partial y\) is employed, hence \(\partial (\delta k) / \partial y = 0 \rightarrow \partial {\hat{k}} / \partial y = 0\). The boundary conditions for the low-Re formulation follow from the remaining terms in (23) that can be collected in a compact form and subsequently eliminated, viz.

$$\begin{aligned} y&= {\Delta }: \qquad \left[ \hat{u} \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} - \frac{\mathrm {d} \hat{u}}{\mathrm {d} y} (\delta u) \right] \qquad \mathrm {with} \qquad \delta \left( \frac{\mathrm {d} u}{\mathrm {d} y} \right) = \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} = 0 \qquad&\rightarrow \qquad \frac{\mathrm {d} \hat{u}}{\mathrm {d} y} \bigg \vert _{\Delta } = 0 \end{aligned}$$
(25)
$$\begin{aligned} y&= {\mathrm {w}}: \qquad \left[ (1+\hat{u}) \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} - \frac{\mathrm {d} \hat{u}}{\mathrm {d} y} (\delta u) \right] \qquad \mathrm {with} \qquad \delta u = 0 \qquad&\rightarrow \qquad \hat{u} \big \vert _\mathrm {w} = -1 \; . \end{aligned}$$
(26)

This again confirms the findings of Sect. 2 and Eqs. (6)–(7). Equation (26) is fulfilled if either

$$\begin{aligned} \delta u = 0 \qquad \mathrm { or } \qquad \delta u = -\frac{\mathrm {d} u}{\mathrm {d} y} \delta y \qquad \rightarrow \qquad \delta _\mathrm {y} j_{\Gamma }^\mathrm {LR} = - \nu \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} \bigg \vert _\mathrm {w} \frac{\mathrm {d} u}{\mathrm {d} y} \bigg \vert _\mathrm {w} \end{aligned}$$
(27)

holds that allows for a low-Re (LR) shape derivative expression (cf. Eq. (10)) if a linear development of the local flow w.r.t. a perturbation in wall normal direction is applied.

Employing a high-Re \(k-\epsilon\) formulation, one frequently imposes

$$\begin{aligned} k = \frac{U_{\tau }^2}{\sqrt{C_{\mu }}} \qquad \mathrm{and} \qquad \epsilon = \frac{U_{\tau }^3}{\kappa y} \qquad \rightarrow \qquad \nu _\mathrm {t} = C_{\mu } \frac{k^2}{\epsilon } = U_{\tau } \; \kappa y = (\kappa y )^2 \frac{\mathrm {d} u}{\mathrm {d} y}. \end{aligned}$$
(28)

Hence, a possible Lagrangian, that is valid within the logarithmic layer [or in the first node / cell / element] from a continuous [discrete] perspective, reads

$$\begin{aligned} L = \left[ U_{\tau } (\kappa y) \frac{\mathrm {d} u}{\mathrm {d} y} \right] _\mathrm {w} + \int _{{\mathrm {w}}}^{{\Delta }} \left[ {\hat{u}} \frac{\mathrm {d}}{\mathrm {d} y} \left[ (\kappa \, y)^2 \left( \frac{\mathrm {d} u}{\mathrm {d} y}\right) ^2 \right] + {\hat{k}} \left[ k - \frac{U_{\tau }^2}{\sqrt{C_{\mu }}} \right] + {\hat{\epsilon }} \left[ \epsilon - \frac{U_{\tau }^3}{\kappa y} \right] \right] \mathrm {d} y \, . \end{aligned}$$
(29)

Substituting \(\epsilon = U_{\tau }^3/(\kappa y)= (k \sqrt{C_{\mu }})^{3/2}/(\kappa y)\) as well as \((\kappa y) \mathrm {d} u/ \mathrm {d} y = U_{\tau } = (k \sqrt{C_{\mu }})^{1/2}\) we end up with

$$\begin{aligned} L&= \left[ U_{\tau } (\kappa y) \frac{\mathrm {d} u}{\mathrm {d} y} \right] _\mathrm {w} + \int _{{\mathrm {w}}}^{{\Delta }} \left[ {\hat{u}} \frac{\mathrm {d}}{\mathrm {d} y}\left[ (\kappa \, y) \left( \frac{\mathrm {d} u}{\mathrm {d} y} \right) \cdot (k \sqrt{C_{\mu }})^{1/2} \right] \nonumber \right. \\&\left. \quad + {\hat{k}} \left[ k - \frac{U_{\tau }^2}{\sqrt{C_{\mu }}} \right] + {\hat{\epsilon }} \left[ \epsilon - \frac{(k \sqrt{C_{\mu }})^{3/2}}{\kappa y} \right] \right] \mathrm {d} y \, . \end{aligned}$$
(30)

A subsequent total variation reads

$$\begin{aligned} \delta L&= \left[ (\delta U_{\tau }) (\kappa y) \frac{\mathrm {d} u}{\mathrm {d} y} + (U_{\tau } \kappa y) \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} \right] _\mathrm {w}\nonumber \\&\quad + \int _{{\mathrm {w}}}^{{\Delta }} \bigg [ {\hat{u}} \frac{\mathrm {d}}{\mathrm {d} y} \left[ (\kappa \, y) \left( \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} \right) \cdot (k \sqrt{C_{\mu }})^{1/2} +(\kappa \, y) \left( \frac{\mathrm {d} u}{\mathrm {d} y}\right) \delta k \frac{C_{\mu }^{1/4}}{2 \sqrt{k}} \right] \nonumber \\&\quad + {\hat{k}} \left[ \delta k - 2 \frac{U_{\tau }}{\sqrt{C_{\mu }}} (\delta U_{\tau }) \right] + {\hat{\epsilon }} \left[ \delta \epsilon - \delta k \frac{3 \sqrt{k} C_{\mu }^{1/4}}{2 \kappa y} \right] \bigg ] \mathrm {d} y. \end{aligned}$$
(31)

The variations of primal velocity and the TKE are isolated to

$$\begin{aligned} \delta L&= \bigg [ (\delta U_{\tau }) (\kappa y) \frac{\mathrm {d} u}{\mathrm {d} y} + (U_{\tau } \kappa y) \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} \bigg ]_\mathrm {w} \nonumber \\&\quad + \bigg [ {\hat{u}} \bigg ( \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} \; (\kappa y) (k \sqrt{C_{\mu }})^{1/2} + \delta k \; \frac{\kappa y }{2} \frac{\mathrm {d} u}{\mathrm {d} y} \frac{C_{\mu }^{1/4}}{\sqrt{k}} \bigg )\nonumber \\&\quad - (\delta u) \bigg ( \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} \; (\kappa y) (k \sqrt{C_{\mu }})^{1/2} + 2 {\hat{k}} \frac{U_{\tau } \kappa y}{\sqrt{C_{\mu }}}\bigg ) \bigg ]_\mathrm {w}^\Delta \nonumber \\&\quad + \int _{{\mathrm {w}}}^{{\Delta }} \bigg [ (\delta u) \, \frac{\mathrm {d}}{\mathrm {d} y} \bigg [\bigg (\frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y}\bigg ) (\kappa \, y) \cdot (k \sqrt{C_{\mu }})^{1/2} + 2{\hat{k}} \, \frac{U_{\tau } \kappa y}{\sqrt{C_{\mu }}} \bigg ]\nonumber \\&\quad + \delta k \bigg [ {\hat{k}} -{\hat{\epsilon }} \frac{3 \sqrt{k} C_{\mu }^{1/4}}{2 \kappa y} - \frac{C_{\mu }^{1/4}}{2 \sqrt{k}} \, (\kappa \, y) \bigg (\frac{\mathrm {d} u}{\mathrm {d} y}\bigg ) \bigg (\frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y}\bigg ) \bigg ] + \delta \epsilon \left[ {\hat{\epsilon }} \right] \bigg ] \mathrm {d} y \, . \end{aligned}$$
(32)

Rewriting (32) by expressing everything in terms of the primal friction velocity \(U_{\tau }\) yields

$$\begin{aligned} \delta L&= \bigg [ (\delta U_{\tau }) (\kappa y) \frac{\mathrm {d} u}{\mathrm {d} y} + (U_{\tau } \kappa y) \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} \bigg ]_\mathrm {w} \nonumber \\&\quad + \bigg [ {\hat{u}} \bigg ( \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} \; (U_{\tau } \kappa y) + \delta k \; \frac{\sqrt{C_{\mu }} }{2} \bigg ) - (\delta u) \bigg ( U_{\tau } \kappa y \bigg ( \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} \; + \frac{2 {\hat{k}}}{\sqrt{C_{\mu }}} \bigg ) \bigg ) \bigg ]_\mathrm {w}^\Delta \nonumber \\&\quad + \int _{{\mathrm {w}}}^{{\Delta }} \bigg [ (\delta u) \, \frac{\mathrm {d}}{\mathrm {d} y} \bigg [ U_{\tau } \kappa \, y \bigg ( \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} + \frac{2{\hat{k}}}{\sqrt{C_{\mu }}} \bigg ) \bigg ] + \delta k \left[ {\hat{k}} -{\hat{\epsilon }} \, \frac{3 U_{\tau } }{2 \kappa y} - \frac{\sqrt{C_{\mu }}}{2} \, \bigg (\frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y}\bigg ) \right] \nonumber \\&\quad + \delta \epsilon \left[ {\hat{\epsilon }} \right] \bigg ] \mathrm {d} y \quad \overset{!}{=} 0 \quad \forall \, (\delta u, \delta k, \delta \epsilon ) \; . \end{aligned}$$
(33)

Ensuring a vanishing Lagrangian for all possible variations finally yields the adjoint wall functions, viz.

$$\begin{aligned} {\hat{\epsilon }}&= 0 \quad \mathrm {and} \quad {\hat{k}} = \frac{\sqrt{C_{\mu }}}{2} \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} \\ \quad &\rightarrow \quad \int _{{\mathrm {w}}}^{{\Delta }} \left[ \frac{\mathrm {d}}{\mathrm {d} y} \left[ 2 (U_{\tau } \kappa \, y) \; \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} \right] \right] \mathrm {d} y= 0 \quad \mathrm {with} \quad U_{\tau } \; \kappa y = \nu _\mathrm {t} \end{aligned}$$
(34)

Interestingly, the adjoint dissipation rate is identical zero whereas the adjoint TKE remains as a passive scalar that enters the adjoint shear to form the same expression as in Eq. (8) w.r.t. a doubled turbulent viscosity. The boundary conditions for the high-Re formulation follow from the remaining terms in (33) that can be collected in a compact form and subsequently eliminated, viz.

$$\begin{aligned} y&= {\Delta } : \qquad \delta k \; \frac{\sqrt{C_{\mu }}}{2} \frac{(\kappa y)}{U_{\tau }} \frac{\mathrm {d} u}{\mathrm {d} y} \hat{u} + \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} U_{\tau } (\kappa y) \hat{u} - (\delta u) \; \bigg [ 2 (\kappa y) U_{\tau } \frac{\mathrm {d} \hat{u}}{\mathrm {d} y} \bigg ] \quad \overset{!}{=} 0 \quad \forall \, (\delta k, \delta u)&\nonumber \\&\qquad \qquad \qquad \qquad \mathrm {with} \qquad \delta k = 0 \qquad \mathrm {and} \qquad \frac{ \mathrm {d} (\delta u)}{\mathrm {d} y} = 0 \qquad&\rightarrow \qquad \frac{ \mathrm {d} \hat{u}}{\mathrm {d} y} \bigg \vert _{\Delta } = 0 \end{aligned}$$
(35)
$$\begin{aligned} y&= {\mathrm {w}}: \qquad \delta k \bigg [ \frac{\sqrt{C_{\mu }}}{2} \frac{(\kappa y)}{U_{\tau }} \frac{\mathrm {d} u}{\mathrm {d} y} \bigg [ 1 + \hat{u} \bigg ] \bigg ] + \frac{\mathrm {d} (\delta u)}{\mathrm {d} y} \bigg [ U_{\tau } (\kappa y) \bigg [ 1 + \hat{u} \bigg ] \bigg ] - (\delta u) \; \bigg [ 2 (\kappa y) U_{\tau } \frac{\mathrm {d} \hat{u}}{\mathrm {d} y} \bigg ] \qquad&\overset{!}{=} 0 \qquad \forall \, (\delta k, \delta u) \nonumber \\&\qquad \qquad \qquad \qquad \mathrm {with} \qquad \delta k = 0 \qquad \mathrm {and} \qquad \delta u = 0 \qquad&\rightarrow \qquad \hat{u} \big \vert _\mathrm {w} = -1 \end{aligned}$$
(36)

in line with Eq. (10) resulting from the fully continuous derivation in Sect. 2. Similar to the low-Re formulation, Eq. (36) is again fulfilled if either

$$\begin{aligned} \delta u = 0 \qquad \mathrm {or} \qquad \delta u = -\frac{\mathrm {d} u}{\mathrm {d} y} \delta y \qquad \rightarrow \qquad \delta _\mathrm {y} j_{\Gamma }^\mathrm {HR} = - 2 (\kappa y) U_{\tau } \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} \bigg \vert _\mathrm {w} \frac{\mathrm {d} u}{\mathrm {d} y} \bigg \vert _\mathrm {w} = -2 \nu _\mathrm {t} \frac{\mathrm {d} {\hat{u}}}{\mathrm {d} y} \bigg \vert _\mathrm {w} \frac{\mathrm {d} u}{\mathrm {d} y} \bigg \vert _\mathrm {w} \end{aligned}$$
(37)

holds that allows for a high-Re (HR) shape derivative expression based on twice the turbulent viscosity (cf. Eq. (10)). We thus use stress conditions and prescribe \({\hat{\tau }}_\mathrm {w} = {\hat{\tau }}_\mathrm {eff}\) and \({\hat{p}}\) instead of a simple Dirichlet condition \({\hat{u}}(y = \mathrm {w}) ={\hat{u}}_\mathrm {w}\), which helps to match with the wall function (17). Mind that, due to the employed objective function, the adjoint flow often features moving walls, cf. Kühl et al. (2019).

We conclude that there is no need for further adjoint turbulent equations in the range of validity of the adjoint LoW if the above presented wall function based two-equation closure is employed, except a volumetric objective is considered that explicitly depends on the turbulent quantities. The reason for this is the algebraic scaling of all mean flow and turbulence parameters with the friction velocity \(U_{\tau }\) within the logarithmic-layer.

6 Verifications

The verfication study refers to a 2D turbulent channel flow at Reynolds-numbers between \(10^6 \le \mathrm {Re}_\mathrm {H} = U H / \nu \le 10^8\) based on the channel height H, the bulk velocity U and the kinematic fluid viscosity \(\nu\), cf. Fig. 1.

Fig. 1
figure 1

Investigated turbulent channel flow. Sketch of the considered geometry (a) and computational grid (b) for an exemplary Reynolds-number of \(\mathrm {Re}_\mathrm {H} = 10^7\)

For the sake of clarity, we explicitly state the complete underlying primal and adjoint balance equations used for all verification and application cases. The mean fluid velocity \(v_\mathrm {i}\) and pressure p follow from the steady incompressible RANS equations

$$\begin{aligned} R_\mathrm {i}:&\qquad \rho \, v_\mathrm {k} \frac{\partial v_\mathrm {i}}{\partial x_\mathrm {k}} + \frac{\partial }{\partial x_\mathrm {k}} \left[ \left( p + \frac{2}{3} \rho k \right) \delta _\mathrm {ik} - 2 \left( \mu + \mu _\mathrm {t} \right) S_\mathrm {ik} \right]&= 0 \end{aligned}$$
(38)
$$\begin{aligned} Q:&\qquad -\frac{\partial v_\mathrm {k}}{\partial x_\mathrm {k}}&= 0 . \end{aligned}$$
(39)

where \(S_\mathrm {ik} = 1/2 ( \partial v_\mathrm {i} / \partial x_\mathrm {k} + \partial v_\mathrm {k} / \partial x_\mathrm {i} )\) and \(\delta _\mathrm {ik}\) represent the symmetric strain rate tensor as well as the Kronecker delta, respectively. Mind that we switch the notation compared to the unidirectional setting, viz. \(u {:}{=}v_\mathrm {1}\) and \({\hat{u}} {:}{=}{\hat{v}}_\mathrm {1}\) from now on. Corresponding boundary conditions are given in Stück and Rung (2013), Kröger et al. (2018), Kühl et al. (2019), Kühl et al. (2021). As already mentioned, wall function expressions often involve singularities at the wall and/or high-order polynomial behaviour beyond the capabilities of the numerical discretization. Thus—rather than using wall values—wall function expressions often replace the governing equations in the wall adjacent discrete node / cell / element. The verification involves two turbulence closures for the primal flow. The low-Re study aims to verify the predictive agreement with the adjoint LoW (17) and therefore employs a mixing-length model supplemented by a van-Driest (Van Driest 1956)) damping function \(f_\mathrm {vD} = 1 - \mathrm {exp}(-y^+ / A^+)\), i.e. \(\nu _\mathrm {t} = (\kappa \, y_\mathrm {w} \, f_\mathrm {vD})^2 (\mathrm {d} u / \mathrm {d} y)\). Here \(y_\mathrm {w}\) represents the normal distance to the nearest wall and \(A^+\) was assigned to \(A^+ =27\). A standard \(k - \epsilon\) model (Jones and Launder 1972) serves as a closure for the high-Re study. In the absence of volume based objective functional, the adjoint equations to (38)–(39) read:

$$\begin{aligned}&\hat{R}_\mathrm {i}: - \rho v_\mathrm {k} \frac{\partial \hat{v}_\mathrm {i}}{\partial x_\mathrm {k}} + \rho \hat{v}_\mathrm {k} \frac{\partial v_\mathrm {k}}{\partial x_\mathrm {i}} + \frac{\partial }{\partial x_\mathrm {k}} \left[ \hat{p} \delta _\mathrm {ik} - 2 \left( \mu + \beta \mu _\mathrm {t} \right) \hat{S}_\mathrm {ik} \right] = 0 \; \end{aligned}$$
(40)
$$\begin{aligned}&\hat{Q}: - \frac{\partial \hat{v}_\mathrm {k}}{\partial x_\mathrm {k}} = 0 . \end{aligned}$$
(41)

It should be noted that the adjoint equations possibly experience twice the primal turbulent viscosity since \(\beta = 2\) [\(\beta = 1\)] is chosen in the consistent [frozen] case. Strictly speaking, the suggested approach is only consistent in the immediate wall vicinity. Hence, only the sub-layer and the logarithmic region of the channel flow correspond to a truly consistent adjoint turbulence model. The consistency is lost for the outer layer, while all applications in Sect. 7 can only refer to a formulation that is deemed to feature an enhanced consistency compared to the frozen turbulence approach. Mind that shape optimization problems are by definition interested in the primal / adjoint near wall flow, hence a consistent adjoint formulation is particularly relevant in this region. Using a two-equation model the consistency is restricted to the momentum equation and assumes the eddy-viscosity distribution to agree with the mixing-length results. Figure 2 validates the compliance of both approaches for high-Re simulations over the normalized wall distance.

Fig. 2
figure 2

Comparison of field values for the normalized mean flow (left), turbulent viscosity (center) and Reynolds stresses \({(\overline{u^\prime v^\prime })}^+ = (\overline{\left| u^\prime v^\prime \right| }) / U_{\tau }^2\) (right) predicted by a mixing-length (open symbols) and a \(k - \varepsilon\) (closed symbols) BVM

A boundary based objective functional is considered that accounts for the fluid flow induced force \(J^\mathrm {F}\), viz.

$$\begin{aligned} J^\mathrm {F} = \int _{\Gamma _\mathrm {W}} \left( p \delta _\mathrm {ik} - 2 \mu _\mathrm {eff} S_\mathrm {ik} \right) n_\mathrm {k} r_\mathrm {i} \mathrm {d} \Gamma \; . \end{aligned}$$
(42)

Hence, the local objective reads \(j_{\Gamma }^\mathrm {F} = ( p \delta _\mathrm {ik} - 2 \mu _\mathrm {eff} S_\mathrm {ik} ) n_\mathrm {k} r_\mathrm {i}\) which in turn enters the adjoint boundary conditions and we refer to Stück and Rung (2013), Kühl et al. (2019) for a detailed overview. The force objective coincides with the pure shear objective (cf. Sect. 2) augmented by a pressure contribution projected into a certain spatial direction \(r_\mathrm {i}\). After a successfully approximation of the primal and adjoint field equations, a shape sensitivity can be derived along the controlled design wall (Stück and Rung 2013; Kühl et al. 2019, 2021)

$$\begin{aligned} \delta _\mathrm {u} J = \int _{\Gamma _\mathrm {D}} \delta _\mathrm {u} j_{\Gamma } \, \mathrm {d} \Gamma _\mathrm {O} \quad \mathrm { with } \quad \delta _\mathrm {u} j_{\Gamma } = - \beta \nu _\mathrm {eff} \frac{\partial v_\mathrm {i}}{\partial x_\mathrm {j}} \frac{\partial \hat{v_\mathrm {i}}}{\partial x_k} n_\mathrm {j} n_\mathrm {k} . \end{aligned}$$
(43)

Equations (38)–(41) are approximated using the Finite-Volume procedure FreSCo+ (Rung et al. 2009). Analogue to the use of integration-by-parts in deriving the continuous adjoint equations, summation-by-parts is employed to derive the building blocks of the discrete (dual) adjoint expressions. A detailed derivation of this hybrid adjoint approach can be found in Stück and Rung (2013), Kröger et al. (2018), Kühl et al. (2021). The segregated algorithm uses a cell-centered, collocated storage arrangement for all transport properties. The implicit numerical approximation is second order accurate and supports polyhedral cells. Both, the primal and adjoint pressure-velocity coupling is based on a SIMPLE method and possible parallelization is realized by means of a domain decomposition approach (Yakubov et al. 2013, 2015). In all cases, the convective term for primal [adjoint] momentum is approximated using the QUICK [QU(D)ICK] scheme. Periodic boundary conditions are employed between the inlet and the outlet. A friction condition is used along the top and bottom boundaries in conjunction with low-Re and high-Re grids. The numerical grids consist of \(4 \times 250\) finite volumes and the wall normal resolutions reach down to \(y^+ = {\mathcal {O}}(10^{-1})\) for the low-Re cases and \(y^+ \approx 50\) for the high-Re cases.

Fig. 3
figure 3

Comparison of predicted primal and adjoint velocity profiles using the frozen turbulence (F) as well as the LoW-consistent (C) approach for a turbulent channel flow at Reynolds-numbers between \(10^6 \le \mathrm {Re}_\mathrm {H}\le 10^8\) increasing from left to right (low-Reynolds formulation)

Figure 3 depicts the result of the low-Re studies. For all investigated Reynolds numbers, the results are in remarkably fair predictive agreement with the respective LoW (13) and (17). All results feature a narrow buffer-layer region triggered by the employed van-Driest term. Figure 4 depicts the results obtained for the high-Re simulations. It is seen, that the log-layer branch of the two solutions (13) and (17) is again matched fairly accurate in combination with a \(k-\epsilon\) BVM and we conclude, that the adjoint LoW for momentum is compatible with the above suggested approach. These results encourage us to scrutinize the performance of the simple adjoint algebraic turbulence closure for more complex cases beyond the limits of unidirectional attached shear flows in the following section.

Fig. 4
figure 4

Comparison of predicted primal and adjoint velocity profiles using the frozen turbulence (F) as well as the LoW-consistent (C) approach for a turbulent channel flow at Reynolds-numbers between \(10^6 \le \mathrm {Re}_\mathrm {H}\le 10^8\) increasing from left to right (high-Reynolds formulation)

7 Applications

The application part of the manuscript reports the predictive performance of the algebraic LoW-consistent closure in more relevant engineering-type flows. Examples included exclusively refer to \(k-\varepsilon\) primal flow turbulence modelling in combination with high-Re wall functions. Hence, the wall normal resolutions reach down to \(y^+ \approx 50\) for all considered studies. The upcoming studies investigate precisely Eq. (43) and it is distinguished whether the respective study aims at the local integrand or the global integral of the sensitivity derivative. The focal points of interest are (a) a comparison of initial (local) shape sensitivities predicted by the adjoint frozen (F) and the LoW-consistent (C) adjoint turbulence closure, and (b) their respective influence on a (global), complete, gradient (steepest descent) based shape optimizations using a CAD-free (aka node-based) optimization framework. The shape optimization approaches herein operate in the design space of the discrete CFD surface that allows to access local features and shape optima on the level of the discrete CFD resolution. The "raw" adjoint shape derivatives suffer from a few well-known weaknesses, e.g. they only describe the normal deformation but do not provide tangential information and the shape derivatives are not necessarily smooth. These deficiencies yield rough/noisy shape updates (cf. Stück and Rung (2011), Kröger and Rung (2015)) 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). As a consequence, the adjoint shape derivatives have to be regularized to obtain meaningful technical shape updates based on the inherently smooth shape gradient. In general, the habitat of the shape gradient—surface versus volume based—depends on the underlying surface metric and prominent examples refer to Laplace-Beltrami (LB) or Steklov-Poincaré (SP) type metrics, e.g. Schulz and Siebenborn (2016). The optimizations in this manuscript employ the LB (Stück and Rung 2011; Kröger and Rung 2015) [SP (Schulz and Siebenborn 2016; Haubner et al. 2021; Kühl et al. 2021)] type approach for the external [internal] flows. Initial applications refer to two-dimensional investigations ranging from external to internal flows. The final application refers to the optimization of a three-dimensional ducted geometry.

7.1 2D External: Pointed Oval

Fig. 5
figure 5

Pointed oval (\(\mathrm {Re}_\mathrm {L} = 10^6\)): (a) Illustration of the considered geometry and (b) computational grid for the flow around a pointed oval. Red lines indicate the design region

The first test case examines a two dimensional elliptic, pointed oval geometry of length [height] L [L/2] under a Reynolds-number of \(\mathrm {Re}_\mathrm {L} = U \, L / \nu = 10^6\) where U and \(\nu\) refer to the bulk velocity and kinematic viscosity, respectively, cf. Fig. 5a and 6 (left). The investigated oval employs a height h to length ratio of \(h/L = 1/2\). The structured numerical grid consists of 11 600 control volumes and the obstacle is discretized with 200 surface elements as depicted in Fig. 5b. A homogeneous velocity is imposed along the inlet, a zero pressure value is prescribed at the outlet and slip-walls are employed along the top and bottom boundary. The obstacle is optimized w.r.t. the total resistance \(J^\mathrm {F}\) (cf. Eq. (42)). In line with the habitat of the objective (42), the adjoint velocity reads \({\hat{v}}_\mathrm {i} = -r_\mathrm {i} = -\delta _\mathrm {1i}\) along the design surface.

The initial shape sensitivities along the upper side resulting from both employed adjoint formulations (F vs. C) are shown in Fig. 6 (center). Notable quantitative differences are observed in the maximum absolute sensitivity. Moreover, qualitative differences occur due to the deviating signs in the vicinity of the leading and trailing edge. While the former should primarily result in an accelerated optimization, the latter points to possibly different optimal solutions. For this reason, two optimizations were performed, i.e. one for a convex problem, that should exclusively reveal convergence speed differences, and one for a non-convex problem.

The first study uses an identical step size in combination with a Laplace-Beltrami surface metric, which extracts the inherently smooth shape gradient out of the possibly rough shape derivative, viz. \(g - h^{2} \Delta _{\Gamma } g = s\) where g and \(\Delta _{\Gamma } = \partial ^2 / \partial x_\mathrm {k}^{2} - \partial ^2 / \partial n^{2}\) represent the shape gradient as well as the Laplace-Beltrami operator, respectively (Stück and Rung 2011; Kröger and Rung 2015). The utilized step size was chosen to ensure a maximum first displacement d of \(d / L = 1/1000\) for the consistent optimization. The mathematically convex problem should physically converge to a flat plate boundary layer flow. The convergence of the drag objective is documented in Fig. 6 (right) where both strategies yield almost the same optimal value that drops by approximately 85%. However, the LoW-consistent approach converges approximately 30% faster compared to the frozen turbulence approach. Note that an increased effective viscosity within the consistent adjoint wall functions also affects the sensitivity derivative, cf. Eqs. (10), (27), (37) and (43). The optimized shapes are depicted in Fig. 6 (left) and the deviation of their optimal drag value is below 2% w.r.t. the non-dimensional drag coefficient of a turbulent flat plate boundary layer, e.g. \(c_\mathrm {d} \approx 0.074 \, \mathrm {Re}_\mathrm {L}^{(-1/5)} = 4.7 \times 10^{-3}\), cf. Hucho (2002).

Fig. 6
figure 6

Pointed oval (\(\mathrm {Re}_\mathrm {L} = 10^6\)): (Left) initial and optimized shapes, (center) initial upper wall shape sensitivities predicted by the frozen (F) and consistent (C) approach, and (right) objective convergence for the geometrically unconstrained optimization of the flow around

Subsequently, an additional optimization study was carried out, whereby the sensitivity is modified in such that the flow displacement of the initial shape is conserved using a projection method, viz. \(s \rightarrow s - \int s \, \mathrm {d} \Gamma / \int 1 \mathrm {d} \Gamma\). Analogous to the previous optimization, the same constant step size was specified for both optimizations, which was chosen to ensure a maximum first displacement of \(d / L = 1 / 1000\) for the consistent optimization. The convergence of the objective function is documented in the center graph of Fig. 7. Again, the LoW-consistent approach converges almost 30% faster, while absolute [relative] improvements of \(\approx\)3% [\(\approx\)10%] are observed for the resistance reduction compared to the frozen turbulence approach. The profit follows mainly from the slightly more bulbous [slimmer] front [rear] region (cf. Fig. 7). The formal correctness of the gradient procedure is validated by comparing the achieved cost functional \(J^\mathrm {a}\) change with the predicted change \(J^\mathrm {p}\) based on the adjoint solution (not be confused with the power loss functional \(J^\mathrm {P}\) of upcoming internal flow studies) . Following (Jameson and Vassberg 2000; Vassberg and Jameson 2006), each new cost functional value is predicted based on \(J^\mathrm {p, n+1} (u^\mathrm {n+1}) \approx J^\mathrm {a, n} (u^\mathrm {n}) - \alpha \, \delta J^\mathrm {a, n}(u^\mathrm {n}),\) where \(\delta J^\mathrm {a, n} (u^\mathrm {n}) = \int _{\Gamma ^\mathrm {D}} g^\mathrm {n} \, s^\mathrm {n} \, \mathrm {d} \Gamma\) follows from the gradient operation as described above, cf. Stück and Rung (2011) for further details. Here u, \(\alpha\) and n refer to the control variable (shape contour), a step-size value of unit length and an incremental (shape) optimization counter, respectively. The estimated functional decreases based on an identical step-size value \(\alpha\) are shown on the right in Fig. 7 and are consistent with the achieved decreases as documented in the middle figure. For better comparability, the latter are transparently included.

Fig. 7
figure 7

Pointed oval (\(\mathrm {Re}_\mathrm {L} = 10^6\)): (Left) initial and optimized shapes, (center) achieved drag objective convergence [\((J^\mathrm {a}-J^{\mathrm {ini}})/J^{\mathrm {ini}} \times 100\)] based on the frozen (F) and the LoW-consistent (C) approaches for the volume conserving optimization, and (right) the predicted change of the cost functional [\((J^\mathrm {p}-J^{\mathrm {ini}})/J^{\mathrm {ini}} \times 100\)] based on the frozen (F) and the LoW-consistent (C) adjoint sensitivity, which should be compared against the achieved changes

An interesting aspect follows from a comparison of the optimal resistance reduction observed with different adjoint algebraic turbulence models. Lifting the ratio between the primal and the adjoint eddy-viscosity from the LoW-consistent value of 2 to similar values—e.g. 3, 4 or 5—inside the field does marginally change the computed optimum and the related behaviour is equivocal. More drastic changes are detrimental to the accuracy and robustness. Hence, we would recommend to retain the LoW-consistent value.

7.2 2D T-Junction Flow

The second test case examines a two-dimensional T-junction at a bulk Reynolds-number of \(\mathrm {Re}_\mathrm {D} = U \, D / \nu = 5 \times 10^4\) where U, D and \(\nu\) refer to the bulk velocity, inlet diameter as well as the kinematic viscosity, respectively, cf. Fig. 8a. The structured numerical grid models half of the geometry and consists of 10 000 control volumes. The upper/flat [inner/curved] boundary is free for design and discretized with 105 [210] surface elements as depicted in Fig. 8b. The grid is refined towards the transition between fixed and designed wall.

Fig. 8
figure 8

T-junction (\(\mathrm {Re}_\mathrm {D} = 5 \times 10^4\)): (a) Sketch of the considered symmetric geometry and (b) computational grid for the turbulent. Red lines indicate the design region

Along the inlet, a homogeneous velocity is imposed together with turbulent quantities that follow from the empirical relation

$$\begin{aligned} k = \frac{3}{2} \mathrm {Tu}^2 U^2 \, , \quad \epsilon = \sqrt{\frac{3}{2}} \frac{\mathrm {Tu} \, U}{0.07 D} C_{\mu }^{3/4} k \qquad \mathrm {and} \qquad \mathrm {Tu} = 0.16 \, \mathrm {Re}_\mathrm {D}^{-1/8} \; . \end{aligned}$$
(44)

A zero pressure value is prescribed at the outlet. The ducted geometry is optimized w.r.t. the total power loss \(J^\mathrm {P}\)

$$\begin{aligned} J^\mathrm {P} = - \int _{\Gamma _\mathrm {in,out}} n_\mathrm {k} v_\mathrm {k} \left( p + \frac{\rho }{2} v_\mathrm {i}^2 \right) \mathrm {d} \Gamma \; . \end{aligned}$$
(45)

which yields \(j_{\Gamma }^\mathrm {P} = -n_\mathrm {k} v_\mathrm {k} ( p + \frac{\rho }{2} v_\mathrm {i}^2 )\). In line with the habitat of the objective (45), the adjoint pressure is prescribed to ensure \({\hat{p}} n_\mathrm {i} = \rho v_\mathrm {k} n_\mathrm {k} {\hat{v}}_\mathrm {i} + \mu _\mathrm {eff} (\partial {\hat{v}}_\mathrm {i} / \partial x_\mathrm {k}) n_\mathrm {k} - 0.5 \rho v_\mathrm {k}^2 n_\mathrm {i} - \rho v_\mathrm {k} n_\mathrm {k} v_\mathrm {i}\) along the outlet whereas the adjoint velocity is defined as \({\hat{v}}_\mathrm {i} = v_\mathrm {i}\) at the inlet, cf. Stück and Rung (2013).

Fig. 9
figure 9

T-junction (\(\mathrm {Re}_\mathrm {D} = 5 \times 10^4\)): Local shape derivatives w.r.t. a power loss objective predicted by the LoW-consistent (C) and frozen (F) turbulence approach along (left) the upper/flat and (center) the inner/curved boundary. The right graph documents the convergence of objective functional over the optimization cycles

The initial flow field is depicted in Fig. 10 (left) where the re-circulation zone is deemed to be responsible for a large portion of the total power loss. The resulting initial shape sensitivity along the upper/flat [inner/curved] boundary is depicted in Fig. 9 (left) [(center)] for both proposed adjoint formulations. Basically, the sensitivities along the two design walls appear affine to each other but a noticeable increase in the sensitivity magnitude arises along the curved design region. The latter is pronounced in the direction of the narrowed region (\((x_\mathrm {1} - x_\mathrm {2})/D \approx 4\)) immediately after the bend. Its influence on a gradient based optimization process is documented in Fig. 9 (right). Assuming an equal step size for both optimizations—which follows from the LoW-consistent approach with an initial maximum displacement of \(d/D = 1/1000\)—the consistent approach finds a minimum that is absolutely [relatively] \(\approx\)3.3% [\(\approx\)22.2%] smaller compared to the optimal shape w.r.t. the frozen turbulence approach based on an—albeit minimal—increased convergence. The optimal shape of the consistent approach is depicted in Fig. 10 (center) and (right). In line with the absolute sensitivity values, cf. Fig. 9, the modification of the initially flat part appears to be pronounced, which finally returns a visible reduction of the re-circulation.

Fig. 10
figure 10

T-junction (\(\mathrm {Re}_\mathrm {D} = 5 \times 10^4\)): Comparison of streamlines for the (left) initial and (center) optimized geometry which was returned by the LoW-consistent (C) approach. The (right) graph displays a detailed comparison of the design changes

7.3 3D Double Bent Pipe Flow

The final test case examines a three-dimensional double-bent pipe at a bulk Reynolds-number of \(\mathrm {Re}_\mathrm {D} = U \, D / \nu = 10^5\), where U, D and \(\nu\) refer to the bulk velocity, inlet diameter as well as the kinematic viscosity, respectively, cf. Fig. 11. A structured numerical grid of 820 000 control volumes was used to mesh the internal flow field. Three diameters downstream of the inlet, the curved area is free for design in a CAD-free optimization environment and discretized with 16,000 surface elements as depicted in Fig. 12. The grid is refined towards the transition between fixed and designed wall. Along the inlet, a homogeneous velocity is imposed together with turbulent quantities that follow from the empirical relations (44). A zero pressure value is prescribed at the outlet. The ducted geometry is optimized w.r.t. the total power loss \(J^\mathrm {P}\) outlined in Eq. (45). Hence, the adjoint boundary conditions coincide with those from the two-dimensional study in Sect. 7.2. Figure 13 shows the difference in initial sensitivities between the LoW-consistent and frozen turbulence approach for three different perspectives. Analogous to the previous two-dimensional test case, widespread differences arise between the two methods. As illustrated by Fig. 14, the LoW-consistent framework (C) provides better convergence to an improved optimum when compared to the frozen turbulence approach (F). The respective differences are both significant and approximately amount to 22% improvements.

Fig. 11
figure 11

Double bent pipe (\(\mathrm {Re}_\mathrm {D} = 10^5\)): Divers views on the initial geometry where red areas indicate the design region

Fig. 12
figure 12

Double bent pipe (\(\mathrm {Re}_\mathrm {D} = 10^5\)): Initial geometry (a) as well as (b) employed numerical grid where red areas indicate the design region

Fig. 13
figure 13

Double bent pipe (\(\mathrm {Re}_\mathrm {D} = 10^5\)): Difference in initial sensitivities between the Low-consistent and frozen turbulence approach for three different perspectives

Fig. 14
figure 14

Perspective view on the consistently optimized turbulent double bent pipe (\(\mathrm {Re}_\mathrm {D} = 10^6\)) (a) as well as the evolution of the power loss objective (b) for the frozen turbulence (F) and the LoW-consistent (C) optimization framework. Red [green] areas indicate the initial [optimized] shape

8 Conclusions

The paper discussed the adjoint complement to the universal Law of the Wall (LoW) for fluid dynamic momentum boundary layers. The latter typically follows from a strongly simplified, unidirectional shear flow assumption. We first derived the adjoint companion of the simplified shear flow while distinguishing between two frequently used adjoint formulations. It is seen that both, the frozen turbulence strategy as well as a (differentiated) approach consistent to a mixing length model provide nearly the same adjoint equations. Moreover, the adjoint LoW essentially resembles the primal LoW, and the differences refer to a simple scaling with the ratio between the primal and the adjoint friction velocity and the inclination in the logarithmic region, which reduces for the LoW-consistent approach. As a consequence, no finer/coarser numerical grid is necessary for adjoint simulations. The analysis displays that the LoW-consistent approach is compatible with prominent RANS-type two-equation turbulence models, which ground on the mixing-length hypothesis. Hence, an algebraic adjoint momentum closure can be formulated for the LoW which hooks up to any primal Boussinesq viscosity model due to the assumed universal scaling of primal mean flow and turbulence quantities with the friction velocity. The latter motivates a surprisingly simple algebraic turbulence treatment for the adjoint momentum equation, which is admittedly inconsistent outside the LoW regime, if turbulence transport equation models are employed. However, if algebraic models are utilized, e.g. by wall-function based LES, the adjoint formulation is consistent. The LoW-consistent formulation is expressed by halving the velocity inclination entering a wall function boundary condition in the logarithmic region and doubling the turbulent viscosity. Comparing to the frozen turbulence approach, the LoW-consistent method is deemed a better approximation for adjoint flow optimization efforts. Results obtained by the LoW-consistent algebraic closure come at negligible extra cost and indicate an acceleration of the optimization process as well as improved optimal solutions for shape optimizations of external and internal engineering flows. A hidden benefit of the suggested LoW-consistent approach refers to the enhanced stability of the numerical framework due to the augmented viscosity.

Future studies should compare the demonstrated improvement of the frozen turbulence strategy against fully-differentiated one- and two-equation turbulence models. Both qualitative and quantitative aspects should be considered. E.g., the former should assess the local [global] shape derivative w.r.t. changes in the sign [magnitude]. The latter should focus on the trade-off between an expected convergence acceleration and possibly increased computational efforts due to additional adjoint transport equations and/or additional coupling relations.