1 Introduction

In this study, we consider a class of expanding channel flows in which the inflow is non-uniform. Expanding channels, known as diffusers, have the function of converting high-speed low-pressure flow to low-speed high-pressure flow. Diffusers have numerous applications, from turbines in aerospace to hydropower [1,2,3] to automotive design [4]. There is a large body of literature on diffusers in the case where the inflow is uniform (see [5]), but only a limited literature available for non-uniform inlet flows [6].

In the case where the inflow is uniform, diffusers are usually designed to be straight sided, and the expansion angle is critical to performance [5]. The optimal angle strikes a balance between not being too shallow, since thin channels have larger wall drag, and not being too wide, since wide expansion angles result in boundary layer separation and poor consequent pressure recovery [7]. The optimum angle varies slightly, depending on the inflow boundary layer thickness, and whether the diffuser is two-dimensional or axisymmetric.

In the case where the inflow is non-uniform, there have been some experimental studies which have investigated diffuser performance for specific inflow profiles. Horlock and Lewis [8] studied an asymmetric shear flow and a symmetric wake flow in a linearly expanding two-dimensional diffuser using a simple inviscid model and experiments. They found that both of these non-uniform flow profiles became accentuated by the diffuser. The experiments of Wolf and Johnston [9] studied several non-uniform inlet flows for a two-dimensional diffuser. They considered an asymmetric flow profile with uniform shear, an asymmetric step-shear profile, a symmetric jet profile, and a symmetric wake profile. For each case, they studied straight sided diffusers with linearly expanding walls, using several different expansion angles and non-dimensional lengths. They found that these non-uniform inflows resulted in poorer diffuser performance than for a uniform inflow. They attributed this to the early onset of diffuser stall observed for these non-uniform inflows due to the accentuation of the flow profile. Other experimental studies are given by [10,11,12,13,14,15,16].

As is shown by Wolf and Johnston [9], the development of the non-uniform flow profile is strongly affected by the shape of the diffuser. An important feature in understanding non-uniform flows is the interplay between changes in the pressure and the kinetic energy flux factor, which is a normalised measure of how non-uniform a flow is [5]. A decrease in kinetic energy flux factor corresponds to a more uniform flow, and a rise in pressure. As shown by [8, 9], diffusers with wide angles have the tendency to accentuate non-uniform flows and, in some extreme cases, create a jet-like outflow. In such cases, the outflow has a high-kinetic energy flux and, hence, a low-pressure recovery. On the other hand, diffusers with shallow angles have longer, narrower profiles, which create a lot of wall drag and consequently a larger drop in pressure. Optimal diffuser shapes, therefore, must strike a balance between mixing the flow in a narrow section and then widening the flow to decrease wall drag.

In this paper, we identify the optimal diffuser shape which satisfies these criteria. In contrast to diffusers with uniform inflow, where the channel shape is only restricted due to boundary layer separation, diffusers with non-uniform inflow have a shape which is also restricted due to the effect of accentuating the non-uniform flow. We find that in some cases, the optimal diffuser angle for non-uniform flow is smaller than that typically used for diffusers with uniform inflow. Furthermore, we show that, unlike for uniform flow, optimal diffuser shapes for non-uniform flow may contain an initial straight section that helps mix the flow before diffusing. Therefore, from a design perspective, the effect of the inflow profile cannot be ignored. In our analysis, we show how to optimise diffuser design based on the nature of the non-uniform inflow.

We investigate three different classes of non-uniform inflow, with the axial velocity varying across the width of the diffuser entrance. The first case has inner and outer streams of different speeds, with a velocity jump between them that evolves into a shear layer downstream, and the shear layer eventually interacts with the channel walls. The second case is the limit where the speeds of the streams are similar, creating a thin, slowly growing shear layer. In the third case, the inflow is a pure shear profile, with linear velocity variation between the centre and outer edge of the diffuser. These flow profiles are motivated by a low-head hydropower application, where the inner and outer streams are formed by a Venturi pipe which accelerates part of the flow in order to amplify the pressure drop across a turbine.

For these non-uniform flows which we consider, the development of the flow profile, which is fundamental to pressure recovery, can be described using a simple model for turbulent shear layers in confining channels [6]. The model assumes that the flow is composed of uniform streams separated by a linear shear layer. Wall drag is incorporated into the model with a friction factor, and the growth of the shear layers is modelled with a spreading parameter. As was shown by Benham et al. [6], the model predictions have good agreement with both CFD and experimental work for a range of channel shapes and Reynolds numbers. We restrict our attention to slender diffuser shapes, since our model, which is based on integrated equations of mass and momentum, applies to long and thin domains which are slowly varying. In this way, we avoid situations where there is boundary layer separation, which is not included in our model.

The effects of boundary layer separation have been described analytically in several recent studies [17,18,19,20,21,22]. Smith et al. [20] used a streamfunction formulation and asymptotic analysis to study the complex boundary layer structures that arise for a breakaway separation, and they calculated the corresponding separation point. Furthermore, for such separated flows, the analytical results of Kluwick and Scheichl [19] described how the velocity deficit between the outer flow and the flow in the boundary layer is related to the Reynolds shear stress. These studies are useful in determining the near-wall behaviour of the flow when there are strong adverse pressure gradients that cause separation. However, for the flows we consider in this study, we restrict our attention to diffuser shapes that are sufficiently slender that there is no risk of separation. Instead, we focus on the relationship between the diffuser shape and the development of the non-uniform bulk flow away from the walls.

The simple model which we use to describe the flow, was applied by Benham et al. [6] to investigate pressure recovery of a simple class of diffuser shapes by exhaustively searching a restricted design space. When we widen the parameter space and treat the diffuser shape as a continuous control, it is necessary to seek more complex tools to solve the problem. In this paper, we use the model as the basis for numerical optimisation of the diffuser shape, where the governing equations form the optimisation constraints. Such problems, as well as PDE-constrained optimisation problems, often arise in the field of flow control. With the advancement of computational power, these problems have become more feasible to solve. There are many different approaches to solving such problems which are discussed by Gunzburger [23].

In our approach, we exploit the fact that the model is one-dimensional and, upon discretisation, there are relatively few decision variables. This, in combination with the use of automatic differentiation to calculate gradients, allows us to use an interior point Newton method with relatively low computational effort [24]. In certain limiting cases, we solve the optimal control problem analytically using Pontragin’s maximum principle [25] and these analytical results aid interpretation of the results from the numerical optimisation. We show that some of the optimal diffuser shapes look approximately like they are composed of piecewise linear sections. This motivates a low-dimensional parameterisation of the diffuser shapes, for which we use more detailed and computationally intensive CFD models to search for optima under more realistic flow behaviours. The two CFD models we use are a k\(\epsilon \) [26] and a k\(\omega \) Shear Stress Transport (SST) [27] turbulence model. We find that the optimal diffuser shapes for both these CFD models are very similar to those found using our reduced model.

Section 2 outlines the model for the non-uniform flow profiles we consider and sets up the optimal control problem, discussing the choice of objective, the constraints, the number of parameters, and the optimisation approaches. In Sect. 3, we use a numerical optimisation approach to solve the optimal control problem and find optimal diffuser shapes in three different cases. In Sect. 4, we find analytical solutions to the optimal control problem in the last two of these cases. In Sect. 5, we present some CFD calculations and compare them to the results of the optimisation. Sect. 6 summarises the results of the paper and discusses the dependence of the optimal shapes on parameter choices.

Fig. 1
figure 1

Schematic diagram of the different flow cases. a Developing shear layer case, where the inflow has inner and outer streams of different speeds, with a velocity jump between them that develops into a shear layer. The channel length is sufficiently large such that the growing shear layer reaches across the channel. b Small shear limit case, which is the limiting case where the speeds of the streams are similar, such that the thin, slowly growing shear layer never reaches across the channel. c Pure shear limit, where the velocity varies linearly between the centre and the outer wall of the diffuser

2 The model and optimal control problem

2.1 Modelling turbulent shear layers in confining channels

In this section, we describe the flow scenarios which we consider and outline the simple model, previously presented by Benham et al. [6], which we use to describe these flows. This model is based on integrated conservation of mass and momentum equations in a long and thin geometry, as well as Bernoulli’s equation, which govern an idealised time-averaged flow profile. A friction factor is used to parameterise the effect of wall drag, whilst a spreading parameter models the growth of shear layers. We restrict our attention to slender diffuser shapes with a small expansion angle, such that boundary layer separation is avoided.

There are three different types of non-uniform channel flow we consider, all of which are symmetric about the channel centreline. In Fig. 1, we display each case, illustrating the axial velocity varying across the width of the diffuser. The first, which we call the Developing shear layer case, is an inflow composed of inner and outer streams of different speeds, with a velocity jump in between. In this case, a shear layer forms between the streams and grows downstream, eventually interacting with the channel walls. We restrict our attention to situations where the inner stream is slower than the outer stream. In other situations where the outer stream is slower than the inner stream, there is a greater risk of boundary layer separation, since the slowest region of flow is next to the wall [5]. Furthermore, it is well known that asymmetric flow instabilities, such as the Coanda effect [28], can occur in these situations, which we do not try to model here. The second case, called the Small shear limit, is similar to the first case, except the inner and outer streams have near-identical velocities, such that the shear between the flows is small and the thin shear layer grows slowly. In the third case, called the Pure shear limit, we consider a pure shear profile with linear velocity variation between the centre and outer edge of the diffuser. This corresponds to the first case in the downstream limit, where the shear layer has reached across the entire channel.

Fig. 2
figure 2

Schematic diagram of symmetric flow in a half channel. We model the flow as plug flow regions separated by a linear turbulent shear layer. The model governs a reduced number of variables \(U_1\), \(U_2\), \(h_1\), \(h_2\), \(\delta \), \(\varepsilon _y\) and p, which are all functions of x. The aspect ratio is exaggerated for illustration purposes

The simple model, presented by Benham et al. [6], is used to describe the idealised flow profiles for each of the three cases. The first two cases share the same formulation, whilst the third case is slightly different. Thus, we start by describing the governing equations for the first and second cases. Initially, we consider two-dimensional flow in a half channel \(0<y<h(x)\) and, later, we extend the model to axisymmetric channels (see Fig. 1a, where we indicate our coordinate axes). The inflow for the first two cases is composed of a slower moving central stream with speed \(U_2\) and a faster outer stream with speed \(U_1\). A turbulent shear layer forms at the place where the parallel streams meet. We approximate the flow profile by decomposing it into two plug regions separated by a shear layer in which the velocity varies linearly between \(U_1\) and \(U_2\) (see Fig. 2). The approximate velocity profile is

$$\begin{aligned} {u(x,y)={\left\{ \begin{array}{ll} U_{2} (x)&{}: 0<y<h_2(x),\\ U_2 (x)+\varepsilon _y (x) \left( y-h_2 (x)\right) &{}: h_2 (x)<y<h (x)-h_1 (x),\\ U_{1} (x) &{}: h (x)-h_1 (x)<y<h (x), \end{array}\right. }} \end{aligned}$$

where \(h_1\) and \(h_2\) are the widths of the two plug regions, \(\delta =h-h_1-h_2\) is the width of the shear layer, and \(\varepsilon _y = (U_1-U_2)/\delta \) is the shear rate. In the small shear limit, the plug flow speeds \(U_{1}\) and \(U_{2}\) are similar, such that the shear layer grows slowly. Whilst in the developing shear layer case, the shear layer may grow and interact with the channel walls, in the small shear limit, the channel is chosen to be sufficiently short that the slowly growing shear layer remains thin. However, in both cases, the shear rate decays with x as the shear layer grows [29]. We assume that the shear rate decays according to

$$\begin{aligned} \frac{U_1+U_2}{2}\frac{\mathrm{d} \varepsilon _y}{\mathrm{d}x}=-S\varepsilon _y^2, \end{aligned}$$

where S is a non-dimensional spreading parameter which must be determined from experiments or by comparison with CFD. Equation (2) can be derived from an entrainment argument (see Appendix in [6]), or by analogy with the growth of free shear layers. Assuming that the channel is long and thin, boundary layer theory [29] indicates that, to good approximation, the pressure does not vary across the channel width \(p=p(x)\). Averaged across the channel, conservation of mass and momentum equations are

$$\begin{aligned}&\int _0^h u\, \mathrm{d}y = Q, \end{aligned}$$
$$\begin{aligned}&\frac{\mathrm{d}}{\mathrm{d} x}\left( \int _0^h \rho u^2\, \mathrm{d}y \right) +h\frac{\mathrm{d} p}{\mathrm{d} x}=\tau _\mathrm{w}, \end{aligned}$$

where \(\rho \) is the density, Q is the constant flow rate (per unit depth), and \(\tau _\mathrm{w}\) is the wall shear stress. We parameterise the wall stress term with a friction factor f, such that \(\tau _\mathrm{w}=-1/8f\rho U_1^2\). We model the friction factor with the Blasius relationship, \(f=0.316Re^{-1/4}\), for flow in smooth pipes [30, 31]. For all the examples we consider in this study, we use a finite value for the Reynolds number. For example, if \(Re=10^6\), then \(f=0.01\). Although this friction factor is small, over the long diffuser length scales we consider, the effect of wall drag on pressure variations is significant.

Finally, we ignore viscous dissipation in the plug flow regions, since it is small compared to that at the walls and in the shear layer. Hence, in the plug regions, we assume Bernoulli’s equation holds [32]. In certain cases, especially when the diffuser angle is wide, the speed of the slower plug region \(U_2\) may decrease and reach zero. This has been observed in CFD simulations, which we display in Appendix A. In such cases, there is a portion of recirculating flow in the central part of the diffuser. We do not resolve the recirculation in these regions but since velocities are small, as observed in CFD, we treat the regions as stagnant zones with zero velocity (see Fig. 3).

Bernoulli’s equation in each plug region holds along streamlines, ignoring transverse velocity components since they are small, and is implemented in a complementarity format for convenience

$$\begin{aligned}&h_1\left( p-p(0)+\frac{1}{2}\rho (U_1^2- U_{1}(0)^2)\right) =0,\quad \mathrm {and}\quad h_1\ge 0, \end{aligned}$$
$$\begin{aligned}&U_2h_2\left( p-p(0)+\frac{1}{2}\rho (U_2^2- U_{2}(0)^2)\right) =0,\quad \mathrm {and}\quad h_2\ge 0, \quad U_2\ge 0. \end{aligned}$$

The complementarity format of Eqs. (5) and (6) ensures that when either of the plug regions disappears, or if the slower plug region stagnates, Bernoulli’s equation ceases to hold in that region. We find good comparison between our model predictions of the stagnant region and CFD calculations, which we discuss in Appendix A.

Fig. 3
figure 3

Schematic diagram of stagnated flow in a diffuser, where the slower plug region decelerates and reaches zero velocity. This can occur if the inflow is sufficiently non-uniform, or if the diffuser angle is sufficiently large

To summarise the first and second cases, the simple model describes the evolution of the non-uniform velocity profile u(xy), given by (1), and pressure p(x) in a symmetric confining channel. Equations (2)–(6) govern the variables \(U_1\), \(U_2\), \(h_1\), \(h_2\), \(\delta \), \(\varepsilon _y\) and p, which are all functions of x. These equations can be solved for all x given inflow conditions at \(x=0\). Since the shear layer forms at \(x=0\), the inflow conditions for \(\delta \) and \(\varepsilon _y\) are \(\delta (0)=0\) and \(\varepsilon _y(0)=\infty \). Pressure is measured with reference to the value at the inlet so we can take \(p(0)=0\) without loss of generality. All other inflow conditions form part of the set of parameters which we discuss in Sect. 2.2.

In the pure shear limit, the plug regions are non-existent, such that \(h_1=h_2=0\) and \(\delta =h\). Then the velocity profile takes the form

$$\begin{aligned} u(x,y)=U_2(x)+\varepsilon _y(x)y. \end{aligned}$$

In this case, the governing equations of the model reduce to (2)–(4) and (7), which govern the variables \(U_1\), \(U_2\), \(\varepsilon _y\) and p.

We can extend the model to account for axisymmetric flows simply. For axisymmetric flow in a cylindrical channel \(0\le r\le h\), we assume that that the velocity profile is identical to Eq. (1) in the first two cases, and (7) in the third case, except with y replaced by r. In the axisymmetric version of the model, Eqs. (2) and (5)–(6) remain unchanged, but Eqs. (3) and (4) are altered to account for radial symmetry

$$\begin{aligned}&2 \pi \int _0^h u r\, \mathrm{d}r = Q, \end{aligned}$$
$$\begin{aligned}&2\pi \frac{\mathrm{d}}{\mathrm{d} x}\left( \int _0^h \rho u^2 r\, \mathrm{d}r \right) +\pi h^2 \frac{\mathrm{d} p}{\mathrm{d} x}=2\pi h\tau _\mathrm{w}. \end{aligned}$$

The results of the axisymmetric and two-dimensional cases are compared in Sect. 3.

2.2 Formulation of the optimal control problem

In this section, we describe the optimal control problem by choosing an optimisation objective and formulating the control variables and contstraints. Starting with the objective, we note that diffuser performance can be measured in a number of different ways, for example using a pressure recovery coefficient or a loss coefficient [5]. The pressure recovery coefficient \(C_p\) is a measure of the pressure gain in the diffuser from inlet to outlet, relative to the kinetic energy flux at the inlet. The loss coefficient \(K_l\) is a measure of the total energy lost from inlet to outlet, relative to the kinetic energy flux at the inlet. For our optimal control problem, we could choose either of these coefficients as the objective. Maximising \(C_p\), for a given inflow, would produce the diffuser that converts the greatest amount of inflow kinetic energy into static pressure at the outflow. Minimising \(K_l\), for a given inflow, would produce the diffuser with the maximum amount of energy at the outflow.

For this paper, we choose the pressure recovery coefficient as the objective. There are several ways to define the coefficient, but we shall use the so-called “mass-averaged” pressure recovery [11], which is defined as

$$\begin{aligned} C_p=\frac{\int _0^h u p \,\mathrm{d}y |_{x=L} - \int _0^h u p \,\mathrm{d}y |_{x=0}}{\int _0^h \frac{1}{2}\rho u^3 \,\mathrm{d}y |_{x=0} } \end{aligned}$$

for the two-dimensional case and

$$\begin{aligned} C_p=\frac{\int _0^h u p r\,\mathrm{d}r |_{x=L} - \int _0^h u p r\,\mathrm{d}r |_{x=0}}{\int _0^h \frac{1}{2}\rho u^3 r \,\mathrm{d}r |_{x=0} } \end{aligned}$$

for the axisymmetric case. The pressure recovery coefficient can take values \(C_p\in (-\infty ,1]\), where \(C_p=1\) when all the kinetic energy of the inlet flow is converted into static pressure. For a given area ratio h(L) / h(0) and inflow, there is a maximum possible pressure recovery \(C_{p_I}\le 1\) [5]. For uniform inviscid flow this ideal limit is \(C_{p_I}=1-\left( h(0)/h(L)\right) ^2\) in the two-dimensional case and \(C_{p_I}=1-\left( h(0)/h(L)\right) ^4\) in the axisymmetric case, but for non-uniform flow it is not known what the limit is.

Now that we have chosen a suitable objective for the optimisation, we need to define a control. The diffuser shape is ultimately the control of the problem, but there are several different ways to formulate it. For example, we could use the shape function h(x) as the control, or we could use its derivative, or even the second derivative. To aid our choice of control, we consider the regularity requirements of the final shape. If the minimum requirement is that the shape be continuous, it will be convenient to choose the derivative of h as the control. If we also require smoothness (i.e. existence of the first derivative of h), then it will be convenient to choose the second derivative of h as the control. However, if no such requirements exist, then it is satisfactory to use h itself as the control. For this paper, we restrict ourselves to continuous but non-smooth shapes, and so we choose the shape derivative, or diffuser angle,

$$\begin{aligned} \alpha (x)=\frac{\mathrm{d}h}{\mathrm{d}x}, \end{aligned}$$

as the control for optimising the diffuser shape. In reality, sudden expansions and sharp corners, if severe enough, can cause flow separation which is detrimental to pressure recovery [5]. Therefore, any such sharp corners must be rounded off with a suitable radius of curvature, upon construction. However, we neglect this concern from our mathematical analysis. An additional possible control of the problem is the channel length L. For now, we consider this fixed, but later we discuss the possibility of including L as a free parameter.

After defining both the objective and the control of the optimisation, we now discuss the constraints. The most obvious constraints on the variables are the governing equations and inflow conditions. In addition, we may also want some constraints on the outflow. As mentioned earlier, constraining h(L) / h(0) gives us a fixed maximum value for the pressure recovery. If h(L) / h(0) is unconstrained, then the pressure recovery will be maximised with \(h(L)/h(0)=\infty \) [5]. However, this is impractical for construction and, due to Bernoulli’s equation, we see that pressure recovery decays rapidly with h (like \(\sim 1/h^2\) for two-dimensional flows and like \(\sim 1/h^4\) for axisymmetric flows) so that a large majority of pressure is recovered for relatively small values of h(L) / h(0). For example, if \(h(L)/h(0)=3\) in uniform inviscid axisymmetric flow, the pressure recovery is \(C_{p_I}\approx 0.99\). Therefore, for practical considerations, we constrain the channel width at the outflow

$$\begin{aligned} h(L)=h_L. \end{aligned}$$

Another important constraint we need to consider is the boundedness of the control \(\alpha \). In particular, we note that for large values of the diffuser angle, boundary layers at the channel walls have the tendency to separate [7]. This phenomenon, which is often called ‘diffuser stall’, is not something that we attempt to capture with our model. However, it is known that diffuser stall has a detrimental effect on pressure recovery (because the flow does not slow down). Considering this, we give the control \(\alpha \) an upper bound corresponding to the smallest diffuser angle which causes stall. The first appreciable stall of a straight walled diffuser is at \(\alpha \approx \tan 7^\circ \) for the two-dimensional case and \(\alpha \approx \tan 3.5^\circ \) for axisymmetric diffusers [5]. Furthermore, due to engineering constraints, it might not always be possible to construct channel shapes which contract more than a certain angle. Therefore, a lower bound on the control may also be necessary. If we denote the upper and lower bounds \(\alpha _\mathrm{max}\) and \(\alpha _\mathrm{min}\), respectively, then \(\alpha \) satisfies the box constraints

$$\begin{aligned} \alpha _\mathrm{min}\le \alpha \le \alpha _\mathrm{max}. \end{aligned}$$

It should be noted that, whilst Eq. (14) applies, the optimal control might not necessarily attain these bounding values. In such cases, Eq. (14) may be considered irrelevant.

To summarise the formulation of the optimal control problem, we seek to maximise the pressure recovery by manipulating the control \(\alpha (x)\) within its bounds:

$$\begin{aligned} \max _{\alpha _\mathrm{min}\le \alpha (x)\le \alpha _\mathrm{max}} C_p, \end{aligned}$$

with the constraints that Eqs. (2)–(6) hold, together with inlet conditions for all variables at \(x=0\), and the end constraint (13).

Before moving on to the optimisation approaches, we note that there are several parameters which affect the solution. We list these parameters in Table 1 and discuss them in more detail in Sect. 6.

Table 1 List of the parameters of the optimal control problem. We treat the first 5 of these parameters as problem-specific, whereas the last 2 parameters are considered fixed. We also make use of the shorthand \(h_0=h(0)\) and \(U_0=U_1(0)\)

2.3 Optimisation approaches

Here, we describe the two main approaches we use to solve the optimisation problem. The first is a numerical approach, and the second is an analytical approach which uses Pontryagin’s maximum principle. In each case, we give a brief description of the background theory, without going into depth. For a more thorough discussion, the reader is directed to the references in the text.

2.3.1 Numerical optimisation approach

For the numerical optimisation approach, we solve the optimisation problem (15) by discretising space, introducing values of the variables \(U_1\), \(U_2\), \(h_1\), \(h_2\), \(\delta \), \(\varepsilon _y\) and p at each spatial point, and treating each discretised value as a degree of freedom. We use an interior point Newton method [24] (with the IpOpt library [33]) for nonlinear-constrained optimisation problems. Gradients are calculated using automatic differentiation in the JuMP package [34] of the Julia programming language [35]. The equality constraints we need to impose are Eqs. (2)–(6), inlet conditions and the terminal condition (13). There are also the inequality constraints (14) and those listed in the complementarity condition (5)–(6). As is often done, we impose the equality constraints using the quadratic penalty method [24], where we subtract their residual squared from the objective. For example, if our objective is to maximise the function g(x) subject to the equality constraint \(c(x)=0\), then we replace the objective with

$$\begin{aligned} \max _{x} \quad \left( g(x)-\mu c(x)^2\right) , \end{aligned}$$

where \(\mu \) is a penalty parameter. The interpretation of (16) is that by maximising \(g-\mu c^2\), we try to find the value of x that makes g as large as possible (to increase the objective value) and \(c^2\) as small as possible (to impose the constraint equation). The value of \(\mu \) must be chosen to be sufficiently large that the constraint equation is imposed accurately, but not too large that the problem becomes numerically ill-conditioned. Our inequality constraints are simple box constraints. These are dealt with by the interior point method using logarithmic barrier functions. More details, including how to choose the penalty parameter \(\mu \) and barrier functions, are discussed by Nocedal and Wright [24].

It is not known whether this optimisation problem is convex so there may exist multiple solutions. In order to have confidence about the optimal solutions that are found, we use many different initial guesses to initialise the interior point method (although we have not yet found any multiple solutions).

The governing equations of the model consist of the algebraic equations, which are (3), (5)–(6) and inflow conditions, and the differential equations which are (2) and (4). We discretise space into n points and impose the algebraic equations exactly at every point. The differential equations are imposed using a second order backward finite difference scheme. It should be noted that whilst the complementarity conditions enforce a switch in the governing equations and may produce non-smooth behaviour in the solution, the equations themselves are smooth and can therefore be differentiated. Computation time is fast, owing to the use of automatic differentiation to calculate gradients (as opposed to finite differencing, for example). With 8 variables \(U_1, U_2,h_1,h_2,\delta ,\varepsilon _y,p,h\) and one control \(\alpha \), the total number of degrees of freedom is 9n. For a discretisation of \(n=100\) grid points, and therefore 900 degrees of freedom, computation time is of the order of less than 10 s on a laptop computer.

2.3.2 Analytical optimisation approach

In the case of the small shear limit and the pure shear limit, we use an analytical optimisation approach. In this approach, we simplify the governing equations of our model (which are (2)–(6) for the small shear limit and (2)–(4), (7) for the pure shear limit), and we solve the simplified optimal control problem using Pontryagin’s maximum principle [25, 36].

Here, we briefly outline the mathematical details of Pontryagin’s maximum principle which we will use later in Sects. 4.1 and 4.2. For the purpose of this outline, we consider a simplified optimal control problem in which a variable y(x) is controlled by a control \(\alpha (x)\) and the domain is defined by \(0\le x\le L\). We consider an objective functional

$$\begin{aligned} \max _{\alpha (x)}\,J\left( \alpha (x)\right) :=\int _0^L F\left( x,y(x),\alpha (x)\right) \,\mathrm{d}x+\varPhi \left( y(L)\right) , \end{aligned}$$

for some given functions F and \(\varPhi \), subject to the ordinary differential equation

$$\begin{aligned} \frac{\mathrm{d}y}{\mathrm{d}x}=G\left( x,y(x),\alpha (x)\right) , \end{aligned}$$

and initial/terminal conditions. We assume that the control \(\alpha (x)\) is piecewise continuous, y(x) is absolutely continuous and F and G are of class \(C^2\) in y and \(\alpha \), and piecewise continuous in x [36]. The Hamiltonian is defined as

$$\begin{aligned} H=F+\lambda G, \end{aligned}$$

where \(\lambda (x)\) is the adjoint variable (or Lagrange multiplier). The set of equations which govern the state variable y, the adjoint variable \(\lambda \) and the control \(\alpha \), are known as Pontryagin’s maximum principle, and these equations are

$$\begin{aligned}&\frac{\mathrm{d}y}{\mathrm{d}x} - \frac{\partial H}{\partial \lambda } =0, \end{aligned}$$
$$\begin{aligned}&\frac{\mathrm{d}\lambda }{\mathrm{d}x} +\frac{\partial H}{\partial y} =0,\end{aligned}$$
$$\begin{aligned}&\frac{\partial H}{\partial \alpha } =0, \end{aligned}$$

The governing equations (20)–(22) are accompanied by the boundary conditions

$$\begin{aligned}&\mathrm {either}\quad y(0)=y_0 \quad \mathrm {or}\quad \lambda (0)=0,\end{aligned}$$
$$\begin{aligned}&\mathrm {either}\quad y(L)=y_L \quad \mathrm {or}\quad \lambda (L)=\frac{\partial \varPhi }{\partial y}\left( y(L)\right) . \end{aligned}$$

where \(y_0\) and \(y_L\) are initial and terminal conditions on the state variable y, where appropriate.

If we treat the length of the domain L as a control variable, as well as \(\alpha (x)\), then in addition to (20)–(24), there is the condition

$$\begin{aligned} H(x=L)=0. \end{aligned}$$

For both the small shear limit and the pure shear limit in Sects. 4.1 and 4.2, we find that \(F=0\) and both \(\varPhi \) and G are linear functions of the control \(\alpha \). As described by Pitcher [36] and McDanell and Powers [37], if in addition to the problem being linear in \(\alpha \), the control is also bounded above and below, as in (15), then (20) and (21) are exactly as before but (22) is replaced by

$$\begin{aligned} {\alpha }(x)={\left\{ \begin{array}{ll} \alpha _\mathrm{min}\quad &{}\mathrm {if} \quad H_\alpha <0,\\ \alpha ^*(x) \in \left[ \alpha _\mathrm{min},\alpha _\mathrm{max}\right] \quad &{}\mathrm {if} \quad H_\alpha =0,\\ \alpha _\mathrm{max}\quad &{}\mathrm {if} \quad H_\alpha >0, \end{array}\right. } \end{aligned}$$

where we have introduced the shorthand notation \(H_\alpha =\partial H/\partial \alpha \). When \({\alpha }(x)\) only takes its extreme values, then the control is said to be “bang-bang”. If \({\alpha }(x)=\alpha ^*(x)\) satisfies \(H_\alpha =0\) for a finite interval, then this is called a “singular arc”. Robbins [38] showed that during the singular arc, \(\alpha ^*\) is determined by solving

$$\begin{aligned} \frac{\mathrm{d}^q H_\alpha }{\mathrm{d}x^q}(x,y(x),\alpha ^*(x))=0, \end{aligned}$$

where q is the smallest even number for which \(\mathrm{{d}}^q H_\alpha /\mathrm{{d}}x^q\) is not independent of \(\alpha \).

Note that, if instead of a single-state variable y there are multiple state variables \(y_i\), as is the case in the examples in Sects. 4.1 and 4.2, then the analysis of this section still applies but with a Hamiltonian defined as

$$\begin{aligned} H=F+\sum _i \lambda _i G_i. \end{aligned}$$

Furthermore, (20), (21) and boundary conditions (23), (24) apply for each state variable and corresponding adjoint variable.

3 Numerical optimisation

This section, in which we solve the optimal control problem numerically using the approach outlined in Sect. 2.3.1 for several different cases, is divided into subsections for clarity. Firstly, we study the solution in the developing shear layer case (see Fig. 1a). In this case, we find that optimal diffuser shapes look approximately like they are composed of piecewise linear sections. This observation motivates us to introduce a low-dimensional parameterisation of the shapes that can be explored with contour plots, which is useful when comparing with CFD calculations later in Sect. 5. The small shear limit and the pure shear limit (see Fig. 1b, c) are discussed in Sects. 3.2 and 3.3, respectively.

3.1 The developing shear layer case

Having discussed the optimisation routine in Sect. 2.3.1, we use it to optimise channel shapes in several different cases, starting with the developing shear layer case. For plotting purposes, we maintain all variables in non-dimensional form with reference to typical length scales and velocity scales. We use the initial channel half-width as a typical length scale \(h_0=h(0)\) and the speed of the faster plug region at the inlet as a typical velocity scale \(U_0=U_1(0)\).

In the developing shear layer case, we look at two-dimensional flow and choose parameter values \(U_2(0)/U_0=0.3\), \(h_2(0)/h_0=0.5\), \(h(L)/h_0=1.5\), \(L/h_0=30\), \(\alpha _\mathrm{min}=0^\circ \) and \(\alpha _\mathrm{max}=\tan 7^\circ \). The other parameters are taken as \(S=0.11\) (which we determine from comparison with CFD in Sect. 5) and \(f=0.01\) (which corresponds to a Reynolds number of \(Re=10^6\) and hydraulically smooth walls, using the Blasius relationship [30, 31]). The number of grid points for discretising the simple model is \(n=100\). Simultaneously, we also investigate axisymmetric flow with the same parameter values, except with \(\alpha _\mathrm{max}=\tan 3.5^\circ \). We plot the optimal diffuser angle for the two-dimensional case in Fig. 4a, the corresponding optimal diffuser shape and velocity colour map in Fig. 4c, and pressure plot in Fig. 4g. The axisymmetric case is plotted in Fig. 4b, d, h.

Fig. 4
figure 4

Optimal diffuser shape for the developing shear layer case, in two dimensions (a, c, e, g) and in the axisymmetric case (b, d, f, h). The optimal shapes found using 100 degrees of freedom (100 DOF) (c, d) can be well approximated by three constant-angle sections with divisions at \(x=x_1\) and \(x=x_2\) (2 DOF), as shown by comparisons of diffuser angle (a, b), velocity (e, f) and pressure (g, h). The parameter values used are given in the main text

In both cases, we observe that the optimal shape looks approximately like a piecewise linear function, which is divided into a straight part, followed by a widening part, followed by another straight part. In the two-dimensional case, the length of the first straight section aligns with the length it takes for the shear layer to spread completely across the channel. This suggests that mixing the flow to a more uniform profile is advantageous for the widening part to perform well. This is as expected because, as mentioned earlier, diffusers tend to accentuate non-uniform flow, producing an outflow with large kinetic energy flux (and therefore a low-pressure recovery). However, as discussed earlier, long thin channels cause large loss in pressure due to wall drag. Therefore, the optimal shape must have a straight section which is sufficiently long that the shear layer reaches across the channel, making the flow more well mixed, but no longer than that because of wall drag.

Interestingly, the widening part of the channel widens at a shallower angle than the maximum value (around \(\tan 2.3 ^\circ \) compared to \(\tan 7^\circ \)). So the upper bound on \(\alpha \) is not needed in this case. This behaviour is unexpected since diffusers are usually designed with a widening angle as close to \(\tan 7^\circ \) as possible, regardless of the inflow. These results suggest that there is an optimal widening angle which is determined by the non-uniform inflow, rather than the risk of boundary layer separation.

Since we observe that the optimal shape in Fig. 4a–d looks approximately piecewise linear with three sections, we also try restricting the control \(\alpha \) in this way to see if we can attain a near optimal solution with a piecewise linear shape. We parameterise \(\alpha \) by splitting it into three parts: a straight part with \(\alpha =0\) for \(0\le x <x_1\); a widening part with constant \(\alpha >0\) for \(x_1\le x <x_2\), and a final straight part with \(\alpha =0\) for \(x_2\le x\le L\). We treat \(x_1\) and \(x_2\) as control parameters and the value of \(\alpha \) in the middle section is determined by the condition

$$\begin{aligned} \alpha =\frac{h_L-h_0}{x_2-x_1}. \end{aligned}$$

We optimise pressure recovery, using the same algorithm as before, but with \(\alpha \) having only 2 degrees of freedom (DOF), the two parameters \(x_1\) and \(x_2\), instead of 100 DOF. We plot the optimal diffuser angle in Fig. 4a, which is nearly identical to that obtained with 100 DOF. Moreover, the velocity colour map and pressure plot displayed in Fig. 4e, g both show a very close match. The pressure recovery coefficient for 2 DOF is \(C_p=0.5205\), which is the same as for 100 DOF (up to 4 decimal places), suggesting that piecewise linear diffuser shapes are a very good approximation in this case. In Fig. 5a, we display a contour plot of \(C_p\) for all possible values of \(x_1\) and \(x_2\) (we cut out part of the contour plot corresponding to \(\alpha >\tan 7^\circ \)). This indicates that there is a clear unique optimum at \(x_1/h_0=12.3\) and \(x_2/h_0=24.3\). Note that an unoptimised shape, say with \(x_1=0\) and \(x_2=5\), gives a value of \(C_p=0.4254\), which is \(22\%\) worse than the optimal shape.

Fig. 5
figure 5

Contour plots of pressure recovery \(C_p\) (10), (11), using the low-dimensional parameterisation of the diffuser shapes, as shown in Fig. 4a, b, for all permissible values of \(x_1\) and \(x_2\), such that \(\alpha \le \alpha _\mathrm{max}\). a Two-dimensional case with \(\alpha _\mathrm{max}=\tan 7^\circ \). b Axisymmetric case with \(\alpha _\mathrm{max}=\tan 3.5^\circ \), indicating where the inner stream stagnates. The widening middle section has constant angle given by Eq. (29)

For the axisymmetric case, we find that the optimal shape has a similar structure and can also be well approximated by parameterisation with \(x_1\) and \(x_2\). We find that the optimal value of \(x_1/h_0=6.3\) is a little bit shorter than the two-dimensional case. In fact, we can see in Fig. 4d, f that the shear layer has not reached all the way across the channel by \(x=x_1\). Instead, \(x_1\) corresponds to the point where the shear layer reaches the centre of the channel. It reaches the outer wall of the channel slightly further downstream, during the widening section. This could be explained by the fact that pressure gradients due to wall drag are stronger (per unit flux) in the axisymmetric case (e.g. Poiseuille flow [32]), and therefore the optimal shape cannot afford a longer section of straight, narrow channel. Figure 4b, d, f, h shows a close comparison between the diffuser angle, velocity and pressure in the 2 DOF case and the 100 DOF case. The contour plot in Fig. 5b shows the optimal parameter values \(x_1/h_0=6.3\) and \(x_2/h_0=19.8\). The pressure recovery coefficient for 2 DOF is \(C_p=0.6886\) compared to \(C_p=0.7018\) for 100 DOF, suggesting that axisymmetric piecewise linear diffuser shapes are also a good approximation, but slightly less so than in the two-dimensional case.

The contour plot in Fig. 5b has a steep gradient for small \(x_1/h_0\), indicating that diffuser performance is poor in this case. This corresponds to situations in which the inner stream stagnates, and we model this with a zone which has zero velocity, as described earlier. We indicate all diffuser shapes where we do this by plotting a black line on top of the contours (there is no stagnation for the two dimensional case in Fig. 5a). The phenomenon of stagnation is particularly an issue when the inner stream is slow, and this analysis shows that the way to avoid such poor performance is to have a longer straight section in which the inner stream is accelerated before diffusing.

Fig. 6
figure 6

Optimal diffuser shapes, velocity colour maps, pressure plots and diffuser angle plots for the small shear limit and the pure shear limit. a, c, e Two-dimensional flow where the plug regions have similar speeds \(U_2(0)/U_0=0.8\) and the channel length \(L/h_0=20\) is sufficiently short such that the shear layer never reaches across the channel. b, d, f Two-dimensional flow where the shear layer has already reached across the channel at the inflow so that there are no plug regions. The inflow velocity ratio is \(U_2(0)/U_0=0.35\)

3.2 Small shear limit

For the small shear limit, we consider two-dimensional flow and choose parameter values \(U_2(0)/U_0=0.8\), \(h_2(0)/h_0=0.5\), \(h(L)/h_0=2.3\), \(L/h_0=20\), \(\alpha _\mathrm{min}=0\) and \(\alpha _\mathrm{max}=\tan 7^\circ \). The other parameters S and f are taken at the same values as the previous cases. We display the optimal shape, velocity colour map and pressure plot in Fig. 6a, c, e. In this case, the optimal shape widens at the maximum angle \(\alpha _\mathrm{max}\) until it reaches the exit width h(L) and then stays straight. Since the shear is small and the flow is almost uniform, there is no risk of accentuating the flow profile drastically. Therefore, wide angles initially are not penalised much, allowing the control to take its maximum value. This design is typically what is built in the diffuser industry for uniform inflow [5], where the maximum diffuser angle is set by the limit where boundary layer separation occurs. The optimal control only takes its extremal values, which is sometimes referred to as bang-bang control (see Sect. 2.3.2). In Sect. 4.1, we discuss analytical results for this limiting case and prove that the control must be bang-bang.

3.3 Pure shear limit

For the pure shear limit, we consider two-dimensional flow and choose parameter values \(U_2(0)/U_0=0.35\), \(h_L/h_0=2.3\), \(L/h_0=40\), \(\alpha _\mathrm{min}=0^\circ \) and \(\alpha _\mathrm{max}=\tan 7^\circ \). Parameters S and f are taken as the same as before. The optimal channel, velocity colour map, pressure and control are displayed in Fig. 6b, d, f. The optimal shape is similar to those in Fig. 4, with a natural decomposition into two straight sections separated by a widening section. The widening section has an angle that increases from \(\alpha \approx \tan 2.5^\circ \) to \(\alpha \approx \tan 3^\circ \) and is nowhere greater than \(\tan 7^\circ \), showing that the upper bound \(\alpha \) was not needed in this case. The optimal shape, like in Fig. 4, exhibits the balance between the necessity of a straight section that is long enough to allow some mixing, but not too long that wall drag dominates. In this case, which does not involve any of the switching behaviour that occurs when plug regions reach the wall, we derive some analytical results (discussed in Sect. 4.2) which support and help interpret the numerical optimisation. In particular, we investigate the nature of the optimal widening angle which lies in the interval \((\alpha _\mathrm{min},\alpha _\mathrm{max})\). This is of great interest because it indicates that the optimal design is unaffected by the conventional widening angle limit that exists due to boundary layer separation.

4 Analytical results

The numerical optimisation routine outlined in Sect. 2.3.1 can be applied to find optimal shapes for any choice of the parameters listed in Table 1. We have seen several examples of these in Figs. 4 and 6. In this section, we show that in the two limiting cases displayed in Fig. 6, the small shear limit and the pure shear limit, it is possible to make some analytical progress which aids our understanding and interpretation of the optimal control. Furthermore, the results discussed in this section include simple relationships that may be of instructive use for the purpose of diffuser design in industry. In both cases, we derive a reduced set of equations describing the dynamics, that is amenable to optimal control analysis using Pontryagin’s maximum principle [25].

4.1 Small shear limit

To start with, we consider a two-dimensional diffuser where the inflow, given by (1), is almost uniform. We study this situation because it illustrates the limiting case of the earlier developing shear layer examples in Fig. 4, except where the inner and outer plug regions are of similar speeds. In such situations, the shear rate \(\varepsilon _y\) is small, such that the shear layer develops slowly between the plug flow regions (see Eq. (2)). Furthermore, we restrict our attention to situations where the channel is sufficiently short that the shear layer never reaches across the channel (see Fig. 1b). Therefore, we consider an inflow given by (1) with small \(U_1-U_2\), which is a perturbation to a uniform velocity profile. Then, we asymptotically expand our governing equations (1)–(6) about the leading order uniform flow solution, resulting in a reduced set of equations which are amenable to analysis using Pontryagin’s maximum principle.

Hence, let us introduce the small parameter \(\epsilon \ll 1\), which is defined by the difference in speed between the two plug regions at the inflow

$$\begin{aligned} \epsilon V=U_1(0)-U_2(0)=U_0-U_2(0), \end{aligned}$$

where V is a dimensional velocity scale. If the plug regions always exist, with positive width \(h_1>0\), \(h_2>0\), and we assume that the slower flow never stagnates \(U_2>0\), then we need not consider the complementarity format for Bernoulli’s equation. Therefore, we replace Eqs. (5) and (6) with

$$\begin{aligned} p+\frac{1}{2}\rho U_i^2=\frac{1}{2}\rho U_{i}(0)^2 \quad \mathrm {for}\quad i=1,2. \end{aligned}$$

We consider the distinguished limit where the friction factor f is small such that \(f=\epsilon S F \), where \(F=O(1)\). Note that, whilst f is small, over the long diffuser length scales we consider, friction has a significant effect on the pressure variations. For a Reynolds number of \(Re=10^6\) and hydraulically smooth walls, the friction factor is calculated as \(f=0.01\), using the Blasius relationship [30, 31]. Therefore, if \(\epsilon = 0.1\) and \(S=0.11\), then \(F=0.91\). Choosing these parameter values and setting \(V/U_0=2\), we achieve the small shear limit example in Fig. 6a, c, e.

By considering perturbations to uniform flow, we expand variables in powers of the small parameter \(\epsilon \),

$$\begin{aligned}&U_1=U_{1_0}+\epsilon \hat{U}_1+\cdots , \end{aligned}$$
$$\begin{aligned}&U_2=U_{2_0}+\epsilon \hat{U}_2+\cdots ,\end{aligned}$$
$$\begin{aligned}&h_1=h_{1_0}+\epsilon \hat{h}_1+\cdots ,\end{aligned}$$
$$\begin{aligned}&h_2=h_{2_0}+\epsilon \hat{h}_2+\cdots ,\end{aligned}$$
$$\begin{aligned}&p=p_0+\epsilon \hat{p}+\cdots ,\end{aligned}$$
$$\begin{aligned}&\delta =\delta _0+\epsilon \hat{\delta }+\cdots ,\end{aligned}$$
$$\begin{aligned}&\varepsilon _y=\varepsilon _{y_0} +\epsilon \hat{\varepsilon }_y+\cdots . \end{aligned}$$

In the limit \(\epsilon \rightarrow 0\), Eqs. (2)–(4) and (31) are satisfied by

$$\begin{aligned}&p_0=\frac{1}{2}\rho U_0^2\left( 1-\frac{h_0^2}{h^2}\right) ,\end{aligned}$$
$$\begin{aligned}&\delta _0=0,\end{aligned}$$
$$\begin{aligned}&\varepsilon _{y_0}=\frac{h_0U_0}{S\int _0^x h(\hat{x})\,\mathrm{d}\hat{x}}. \end{aligned}$$

The function \(h_{1_0}\), which represents the location of the centre of the shear layer to leading order, is determined at order \(O(\epsilon )\). Bernoulli’s equation (31) for each plug region, at order \(O(\epsilon )\), is

$$\begin{aligned} \hat{p}+\rho \hat{U}_1 U_{1_0}&=0, \end{aligned}$$
$$\begin{aligned} \hat{p}+\rho \hat{U}_2 U_{1_0}&=-\rho U_0 V. \end{aligned}$$

From the relationship \(h_1+h_2+\delta =h\) at order \(O(\epsilon )\), we find that

$$\begin{aligned} \hat{h}_1 +\hat{h}_2 + \hat{\delta }=0. \end{aligned}$$

Thus, the conservation of mass equation (3) is

$$\begin{aligned} \hat{U}_1h_{1_0} + \hat{U}_2 (h - h_{1_0}) = -V h_2(0), \end{aligned}$$

and the momentum equation (4) is

$$\begin{aligned} h\frac{d\hat{p}}{\mathrm{d}x}+\rho \frac{\mathrm{d}}{\mathrm{d}x}\left( 2 U_{1_0}\hat{U}_1 h_{1_0} +2 U_{1_0}\hat{U}_2 (h-h_{1_0}) \right) =-\frac{1}{8}SF\rho U_{1_0}^2. \end{aligned}$$

Thus, using Eqs. (44)–(46), we can simplify Eq. (48) to an equation purely involving \(h_{1_0}\) and h

$$\begin{aligned} V h^2 \frac{\mathrm{d}h_{1_0}}{\mathrm{d}x} -V h h_{1_0} \frac{\mathrm{d}h}{\mathrm{d}x} =-\frac{1}{8}F Sh_0^2 U_0. \end{aligned}$$

Equation (49) has solution

$$\begin{aligned} h_{1_0}=h\left( \frac{h_1(0)}{h_0} -\int _0^x \frac{SFh_0^2U_0}{8V h(\hat{x})^3}\,\mathrm{d}\hat{x} \right) . \end{aligned}$$

Combining (47) and (48), we obtain a differential equation for the pressure correction \(\hat{p}\) in terms of the channel shape and its derivative \(\alpha =h'(x)\),

$$\begin{aligned} \frac{\mathrm{d}\hat{p}}{\mathrm{d}x}=-\frac{\rho U_0^2 h_0^2 }{h^{3}} \left( \frac{2 V}{U_0} \left( 1- \frac{h_1(0)}{h_0}\right) \alpha + \frac{S F}{8} \right) . \end{aligned}$$

We now solve the optimal control problem outlined in Sect. 2.2, using the approach outlined in Sect. 2.3.2. Since the inflow conditions are fixed and we take \(p(0)=0\), maximising \(C_p\) is equivalent to maximising pressure at the outlet p(L). Furthermore, the constraint equations have been reduced to (51). Therefore the optimal control problem, including terms up to and including order \(O(\epsilon )\), and written as a system of first order differential equations, is as follows:

$$\begin{aligned} \max _{\alpha _\mathrm{min} \le \alpha (x)\le \alpha _\mathrm{max}}\quad \varPhi : = p(L), \end{aligned}$$

such that

$$\begin{aligned}&\frac{\mathrm{d}p}{\mathrm{d}x}=\frac{\rho U_0^2 h_0^2 }{h^{3}} \left( \left( 1- \epsilon \frac{2 V}{U_0} \left( 1- \frac{h_1(0)}{h_0}\right) \right) \alpha -\epsilon \frac{S F}{8} \right) , \end{aligned}$$
$$\begin{aligned}&\frac{\mathrm{d}h}{\mathrm{d}x}=\alpha ,\end{aligned}$$
$$\begin{aligned}&p(0)=0, \end{aligned}$$
$$\begin{aligned}&h(L)=h_L. \end{aligned}$$

We now solve this reduced problem using Pontryagin’s maximum principle [25], as outlined earlier. The Hamiltonian for this system is

$$\begin{aligned} H=\lambda _p \frac{\mathrm{d}p}{\mathrm{d}x}+\lambda _h \frac{\mathrm{d}h}{\mathrm{d}x}, \end{aligned}$$

where \(\lambda _p\) and \(\lambda _h\) are the adjoint variables which satisfy the adjoint equations

$$\begin{aligned} \frac{\mathrm{d}\lambda _p}{\mathrm{d}x}&=-\frac{\partial H}{\partial p},\end{aligned}$$
$$\begin{aligned} \frac{\mathrm{d}\lambda _h}{\mathrm{d}x}&=-\frac{\partial H}{\partial h}. \end{aligned}$$

From (24), since the objective function only depends on pressure at the outlet \(\varPhi =p(L)\), we have the natural boundary condition

$$\begin{aligned} \lambda _p(L)=\frac{\partial \varPhi }{\partial p}=1. \end{aligned}$$

Considering Eq. (61) and the fact that there is no dependance of the Hamiltonian (58) on the pressure p, Eq. (59) tells us that \(\lambda _p=1\) for all values of x. There is no natural boundary condition for \(\lambda _h\) since we are enforcing a condition on h at the outlet \(x=L\) (see (24)). The last condition from Pontryagin’s maximum principle is the optimality condition, and since the Hamiltonian is linear in the control \(\alpha \), this takes the form of Eq. (26).

Next we investigate whether the optimal control is bang-bang, or whether any singular arcs exist (see Sect. 2.3.2). Using (58) with (53), (54) and (60), and noting that \(\lambda _p=1\), we see that

$$\begin{aligned} \frac{\mathrm{d}H_\alpha }{\mathrm{d}x}=-\frac{3 \epsilon \rho S F U_0^2 h_0^2 }{8h^{4}}, \end{aligned}$$

which is negative for all values of x. Hence, it is impossible for singular arcs to exist in this case. Therefore the control is bang-bang with

$$\begin{aligned} \alpha (x)={\left\{ \begin{array}{ll} \alpha _\mathrm{max} &{} \mathrm {for} \quad x\in [0,\gamma ], \\ \alpha _\mathrm{min} &{} \mathrm {for} \quad x\in [\gamma ,L], \\ \end{array}\right. } \end{aligned}$$

where the switching point \(\gamma \) is given by

$$\begin{aligned} \gamma =\frac{h_L-h_0-\alpha _\mathrm{min} L}{\alpha _\mathrm{max} - \alpha _\mathrm{min} }. \end{aligned}$$

In Fig. 6c, e, we plot the solution to the optimal control problem found using the Hamiltonian approach on top of the solution found using the numerical optimisation routine outlined in Sect. 2.3.1. It is clear that the numerical optimisation routine has correctly found the bang-bang control which we have derived here, with \(\gamma /h_0=10.59\) (the small discrepancy is probably due to the finite value of \(\epsilon \)).

It should be noted that the adjoint variable \(\lambda _h\) is only solved for up to a constant of integration C (from integrating Eq. (60)) since it has no boundary condition. Instead, C is determined by the condition that

$$\begin{aligned} H_\alpha (x=\gamma )=0. \end{aligned}$$

In the case where we also allow the channel length L to be a control as well as \(\alpha \), as described in Sect. 2.3.2, we have the additional constraint on the Hamiltonian at the final point (25). By calculating H (58), it is straightforward to show that (65) and (25) are inconsistent unless \(\gamma =0\) or \(\gamma =L\). For the case in Fig. 6a, c, e, it is clear that \(\gamma =0\) is impossible, so we conclude that the optimal diffuser length is \(L=\gamma \). Therefore, including L as a control and taking \(\alpha _\mathrm{min}=0^\circ \), the optimal diffuser shape for the small shear limit is one which expands at the maximum angle until h reaches \(h_L\), at which point the channel terminates (i.e. conventional diffuser design for uniform flow).

4.2 Pure shear limit

The next limiting case we investigate is the pure shear limit, in which the shear layer has already reached across the channel at the inflow, such that there are no plug regions (see Fig. 1c). The velocity profile is given by Eq. (7). For this velocity profile, conservation of mass and momentum equations (3), (4) reduce to

$$\begin{aligned}&h\frac{\mathrm{d}p}{\mathrm{d}x}+\frac{1}{3}\rho \frac{\mathrm{d}}{\mathrm{d}x}\left( h\left( U_1^2+U_1U_2+U_2^2\right) \right) =-\frac{1}{8}\rho f U_1^2. \end{aligned}$$

We now solve the optimal control problem outlined in Sect. 2.2. As in Sect. 4.1, we maximise pressure at the outlet p(L). Furthermore, it is convenient to introduce a new variable, the scaled velocity difference between maximum and minimum velocities \(\tilde{U}=(U_1-U_2)/(U_1+U_2)\). Using (66) and this new variable we can simplify Eqs. (2) and (67), which are the reduced system of constraint equations. Therefore, the optimal control problem is as follows:

$$\begin{aligned} \max _{\alpha _\mathrm{min} \le \alpha (x) \le \alpha _\mathrm{max}} \quad \varPhi :=p(L), \end{aligned}$$

such that

$$\begin{aligned}&\frac{\mathrm{d}\tilde{U}}{\mathrm{d}x}=\frac{2\tilde{U}(\alpha -S\tilde{U})}{h},\end{aligned}$$
$$\begin{aligned}&\frac{\mathrm{d}p}{\mathrm{d}x}=\frac{\rho Q^2\left( 32 S \tilde{U}^3 -3 f (1 + \tilde{U})^2 + 24 \alpha (1 - \tilde{U}^2)\right) }{24 h^3}, \end{aligned}$$
$$\begin{aligned}&\frac{\mathrm{d}h}{\mathrm{d}x}=\alpha ,\end{aligned}$$
$$\begin{aligned}&h(L)=h_L, \end{aligned}$$

where \(\tilde{U}_0=(1-U_2(0)/U_0)/(1+U_2(0)/U_0)\). Similarly to Sect. 4.1, the Hamiltonian for the system is constructed as

$$\begin{aligned} H=\lambda _{\tilde{U}} \frac{d\tilde{U}}{dx}+\lambda _p \frac{dp}{dx}+\lambda _h \frac{dh}{dx}, \end{aligned}$$

which is linear in the control \(\alpha \). The adjoint equations are

$$\begin{aligned}&\frac{\mathrm{d}\lambda _{\tilde{U}}}{\mathrm{d}x}=-\frac{\partial H}{\partial {\tilde{U}}},\end{aligned}$$
$$\begin{aligned}&\frac{\mathrm{d}\lambda _p}{\mathrm{d}dx}=-\,\frac{\partial H}{\partial p},\end{aligned}$$
$$\begin{aligned}&\frac{\mathrm{d}\lambda _h}{\mathrm{d}x}=-\,\frac{\partial H}{\partial h}, \end{aligned}$$

which have the natural boundary conditions

$$\begin{aligned} \lambda _{\tilde{U}}(L)&=\frac{\partial \varPhi }{\partial \tilde{U}}=0, \end{aligned}$$
$$\begin{aligned} \lambda _p(L)&=\frac{\partial \varPhi }{\partial p}=1. \end{aligned}$$

There is no natural boundary condition for \(\lambda _h\) since h is already prescribed at \(x=L\) (see (24)). Finally, as in Sect. 4.1, the optimality condition is (26). As described in Sect. 2.3.2, in order for there to be a singular arc, we must have \(H_\alpha =0\) and \(dH_\alpha /dx=0\) for a finite interval, where during this interval the value of the control is given by (27). In this case, we find that \(q=2\), such that (27) becomes

$$\begin{aligned} \frac{\mathrm{d}^2H_\alpha }{\mathrm{d}x^2}(\alpha =\alpha ^*)=0. \end{aligned}$$

Setting \(H_\alpha =\mathrm{d}H_\alpha /\mathrm{d}x=0\), and using Eq. (82), we find that there will only be a singular arc when

$$\begin{aligned} \alpha ^*= \frac{2 S \tilde{U}^2 (8 S \tilde{U}^2 - f)}{ 3 f + f \tilde{U} + 8 S \tilde{U}^3} \quad \mathrm {for}\quad x \in [x_1,x_2], \end{aligned}$$

for some \(x_2>x_1\). We can solve the coupled system (26), (69)–(83) numerically for the optimal control and corresponding solution. There are, however, very special cases where the singular arc value \(\alpha ^*\) is constant, when we can find analytical solutions, which we discuss at the end of this section. In practice, these solutions appear to be close to the behaviour observed in normal conditions, as can be seen in Fig. 6f where \(\alpha \) is approximately constant during the widening section of the diffuser.

In Fig. 6b, d, f, we plot the solution to the optimal control problem found using the Hamiltonian approach over the solution found using the numerical optimisation routine outlined in Sect. 2.3.1. It is clear that both approaches have found the same solution, with the singular arc lying between \(x_1/h_0=2.9\) and \(x_2/h_0=32.9\). The singular arc represents the balance between mixing and widening effects in the diffuser. Mixing reduces the non-uniformity of the flow, whilst widening tends to accentuate the non-uniform profile, and such non-uniformity can produce a high-kinetic energy, low-pressure outlet. Therefore, the control initially takes its minimum value \(\alpha =0^\circ \) to create good mixing. However, a straight section which is too long is detrimental to pressure recovery because of wall drag. Hence, a widening section is required after a critical length.

The optimal value of \(\alpha \) in the widening section represents a balance between mixing and widening the flow. If \(\alpha \) is too large, then the flow profile will become too non-uniform at the outlet. Conversely, if \(\alpha \) is too shallow, wall drag losses are enhanced. The singular arc is interesting from both a mathematical point of view, but also from an engineering point of view. It clearly shows that diffuser designs for non-uniform inflow should take into account the nature of the non-uniform inflow profile. The optimal widening angle for manufacture is given by Eq. (83). Calculating \(\alpha ^*(x)\) from (83) is difficult in general (\(\tilde{U}\) is a variable), but we find that for certain parameter values, it takes a simpler and more useful form.

In general, during the singular arc \(\alpha ^*(x)\) is not constant, yet in certain cases, such as Fig. 5b, it does not vary much over the singular arc interval. This raises the question of whether it is possible to find constant \(\alpha ^*\) solutions. Noticing how the only variable in Eq. (83) is \(\tilde{U}\), we seek solutions with constant \(\tilde{U}\). Furthermore, we restrict our attention to solutions which begin on the singular arc. From Eq. (69), we see that constant \(\alpha ^*\) solutions only exist if

$$\begin{aligned} \alpha ^*=S\tilde{U}. \end{aligned}$$

Therefore, reconciling Eqs. (83) and (84), it can be shown that constant singular arc solutions exist for parameters which satisfy

$$\begin{aligned} S \tilde{U} (8 S \tilde{U}^3 - 3 f(1+ \tilde{U} ) )=0. \end{aligned}$$

Excluding \(\tilde{U}=0\), and assuming that f and S are fixed, we are left with solving Eq. (85) for \(\tilde{U}\). Substituting \(U_2(0)\) and \(U_0\) back into (85), we rewrite the equation in terms of the inlet velocity ratio \(U(0)=U_2(0)/U_0\), so that we require the parameters to satisfy

$$\begin{aligned} 4 S (U(0) -1 )^3 + 3 f (U(0)+ 1 )^2=0. \end{aligned}$$

Similarly, (84) then indicates that

$$\begin{aligned} \alpha ^*=S\left( \frac{1-U(0)}{1+U(0)}\right) . \end{aligned}$$

For \(U(0)=0.35\), as in Fig. 6b, d, f, we find \(\alpha ^*=\tan 2.76^\circ \), which is very close to the solution from the numerical optimisation, indicating that (87) is also a good approximation for non-constant singular arcs.

Fig. 7
figure 7

Constant singular arc solution displaying velocity colour map and a plot of \(H_\alpha =\partial H/\partial \alpha \), where the Hamiltonian H is given by (76), for parameter values \(S=0.11\) and \(f=0.01\). The inflow velocity ratio \(U(0)=0.471\) is given by (86) and the singular arc value \(\alpha ^*=\tan 2.26^\circ \) is given by (87)

Considering that in typical situations \(f/S\approx 0.1\), and this is small, we expand (86) and (87) about f / S and ignore imaginary solutions, giving the approximate solution

$$\begin{aligned}&U(0)=1 - 3^{1/3}\left( \frac{f}{S}\right) ^{1/3}+ \frac{1}{3^{1/3}}\left( \frac{f}{S}\right) ^{2/3}+\cdots , \end{aligned}$$
$$\begin{aligned}&\frac{\alpha ^*}{S} = \frac{3^{1/3}}{2} \left( \frac{f}{S}\right) ^{1/3}+ \frac{1}{4 \cdot 3^{1/3}}\left( \frac{f}{S}\right) ^{2/3}+\cdots . \end{aligned}$$

For the constant singular arc solution (87), we can solve the system (26), (69)–(83) analytically, though we do not include the details here. Note, we also need to ensure that both \(H_\alpha =0\) and \(dH_\alpha /dx=0\) for all values of x during the singular arc. This will enforce a further constraint on the other parameters of the problem. We do not include the details of this here, but instead, we simply state the constraint, written in terms of the rescaled non-dimensional channel length \(L/(S h_0)\), and both \(h_L/h_0\) and f / S. Written in an asymptotic expansion in powers of f / S (similarly to before) this constraint takes the approximate form

$$\begin{aligned} \frac{L}{S h_0}= \left( 3^{-1/3}(1+2^{2/3}) \frac{h_L}{h_0} - 2\cdot 3^{-1/3}\right) \left( \frac{f}{S}\right) ^{-1/3} +\frac{1}{3} -\frac{1}{2}\frac{h_L}{h_0}+\cdots . \end{aligned}$$

As an example of such a constant singular arc solution, we choose parameter values \(S=0.11\), \(f=0.01\) and \(\alpha _\mathrm{min}=0^\circ \), from which, solving Eqs. (86) and (87), we have an inflow velocity ratio \(U(0)=0.471\) and a singular arc value of \(\alpha ^*=\tan 2.26^\circ \). Using (90), we find that \(H_\alpha =0\) and \(\mathrm{{d}}H_\alpha /\mathrm{{d}}x=0\) along the singular arc if we choose the remaining parameter values \(h_L/h_0=2\) and \(L/h_0=40\). In Fig. 7, we display the velocity colour map for this solution, together with a plot of \(H_\alpha \). We see that the solution starts on the singular arc until the expansion ratio \(h_L/h_0=2\) is reached, at which point \(H_\alpha \) becomes negative, such that the remaining length of the diffuser has angle \(\alpha _\mathrm{min}=0^\circ \).

It is of further interest to investigate how the singular arc depends on the model parameters f and S. We plot the relationship between the constant singular arc value \(\alpha ^*\) (87) and these parameters in Fig. 8. It is clear that increasing the friction factor f results in a higher \(\alpha ^*\). This is to be expected, since larger wall drag will penalise smaller angles more. Increasing the spreading parameter S also increases \(\alpha ^*\). This is because higher spreading rates results in better mixing, and hence, wider angles are more affordable.

5 Comparison with results from a k\(\epsilon \) model and a k\(\omega \) SST model

In this section, we discuss comparisons between the optimal shapes found using the simple model in the previous sections to calculations from CFD. Benham et al. [6] make comparisons between this model and a k\(\epsilon \) turbulence model [26], as well as experimental data generated with Particle Image Velocimetry (PIV). Here, we use both a k\(\epsilon \) and a k\(\omega \) Shear Stress Transport (SST) model [27] to compare with some of the simple model optimisation results. The k\(\epsilon \) model is one of the most popular computational turbulence models, whilst the k\(\omega \) SST model is particularly robust in situations with strong adverse pressure gradients [27] (though for the small diffuser angles we consider in this study the adverse pressure gradients are not severe). Moreover, since a thorough comparison between the mathematical model and CFD has already been discussed in [6], we do not perform comparisons for all of the optimisation results of Sect. 3. Instead, we look at the geometry in Fig. 4e as a single example.

Fig. 8
figure 8

Parameter analysis for the constant \(\alpha ^*\) singular arc solution, given by (87), which depends on the parameters S and f

Consider the example in Fig.  4e, as discussed in Sect. 3. In order to compare with the mathematical model, we use precisely the same inlet velocity profile in the CFD. Inlet conditions for the turbulence variables k, \(\epsilon \) and \(\omega \) are given by the free-stream boundary conditions [29] \(k=I^2\times 3/2\left( u^2+v^2\right) \), \(\epsilon =0.09 k^{3/2}/\ell \) and \(\omega =\sqrt{k}/\ell \), with turbulence intensity \(I=10\%\) and mixing length \(\ell =0.1 h_0\) (\(10\%\) of the channel half-width). In both the CFD models, no slip boundary conditions are applied to the channel walls. Furthermore, we use all the standard turbulence parameter values, which are given by Launder and Spalding [26] for the k\(\epsilon \) model and Menter [27] for the k\(\omega \) SST model.

Fig. 9
figure 9

Comparison between mathematical model and two computational turbulence models (k\(\epsilon \) and k\(\omega \) SST) for the optimal shape in Fig. 4c. a Velocity colour map calculated using the reduced model, with black dashed lines indicating the shear layer. b Corresponding velocity colour map calculated using the k\(\epsilon \) model. c Pressure, averaged across the channel width. d Velocity profiles at evenly spaced locations in the channel

In Fig. 9a, b, we display colour plots of the time-averaged streamwise velocity u generated with both the simple model and the k\(\epsilon \) model. Figure 9d also compares velocity profiles at evenly spaced locations in the channel, for the simple model and both CFD models. There is good agreement between the models, with the simple model capturing the dominant features of the flow, such as maximum and minimum velocities, and the width of the shear layer. There is a slight discrepancy near the diffuser wall since our model does not resolve boundary layers, but instead parameterises their effect with a friction factor. However, we can see that our model accurately captures the effect of the boundary layers on the pressure by the close comparison between the models in Fig. 9c.

In Sect. 3, we investigated reducing the dimension of the control \(\alpha \) by splitting it into three piecewise constant sections divided by \(x_1\) and \(x_2\), which we treated as free parameters. Motivated by these piecewise linear shapes, here we make the same simplification, reducing the degrees of freedom of the control to 2. We explore the parameter space generated by \(x_1\) and \(x_2\), using both CFD models to calculate pressure recovery. Each calculation made by the CFD models is much more computationally expensive than that of the simple model, but because of the low dimension of the degrees of freedom, we can still feasibly explore the different possible combinations of \(x_1\) and \(x_2\). This would not be tractable, however, if we were to use 100 degrees of freedom, as we did with the simple model in Sect. 3. Hence, the numerical optimisation using the simple model is very useful for finding the general shape of the optimal channels, around which we can further search for optima using more realistic, yet more computationally intensive CFD models.

In Fig. 10, we plot contours of pressure recovery \(C_p\), given by (10), (11), as a function of the two parameters \(x_1\) and \(x_2\), where \(C_p\) is calculated using the k\(\epsilon \) model instead of the simplified model, as in Fig. 5. Similarly to the contour plots in Fig. 5, we exclude values of \(x_1\) and \(x_2\) which result in a diffuser angle larger than \(\tan 7^\circ \) for the two-dimensional case and \(\tan 3.5^\circ \) for the axisymmetric case.

Fig. 10
figure 10

Contour plots of pressure recovery \(C_p\), given by (10), (11), over all permissible values of \(x_1\) and \(x_2\), calculated using the k\(\epsilon \) model. Direct comparison is made with Fig. 5, where the same contour plots are calculated using the simple model. a Two-dimensional case. b Axisymmetric case

Comparing Figs. 5 and 10, we see that the optimal diffuser shape using both the simple model and the k\(\epsilon \) model, is characterised by similar values of \(x_1\) and \(x_2\). In the two-dimensional case, according to the k\(\epsilon \) model, the optimal diffuser shape has \(x_1/h_0=13\) and \(x_2/h_0=25\), with a pressure recovery of \(C_p=0.5370\). According to the simplified model, the optimal diffuser shape has \(x_1/h_0=12.3\) and \(x_2/h_0=24.3\), with a pressure recovery of \(C_p=0.5205\), which is very close to that obtained with the k\(\epsilon \) model. Similarly, for the axisymmetric case, the k\(\epsilon \) model suggests an optimal diffuser shape with \(x_1/h_0=7\) and \(x_2/h_0=21\), giving a pressure recovery of \(C_p=0.7067\), whereas the simplified model suggests \(x_1/h_0=6.3\) and \(x_2/h_0=19.8\), with a pressure recovery of \(C_p=0.6886\). Considering that the diffuser angle is given by Eq. (29), it is clear that if the optimal values of \(x_1\) and \(x_2\) are similar, according to the simple model and the CFD, then the optimal diffuser angle is also similar. In fact, we can compare the value of \(C_p\) as a function of diffuser angle by looking at intersections of the contour plots (Figs. 5, 10) with the lines \(x_1-x_2=\mathrm {const}\). We have also generated these pressure recovery data using the \(k-\omega \) SST model, and we find the results very similar. The average discrepancy between the \(C_p\) values calculated using the k\(\omega \) SST model and the k\(\epsilon \) model is 0.004 for the two-dimensional case, and 0.003 for the axisymmetric case.

These results indicate that the optimal shapes found using the numerical optimisation routine and the simplified model are similar to the optimal shapes that would be found if we were to use either of these computational turbulence models as a forward model. Hence, this gives us confidence that the optimal shapes generated using the simplified model are close to true optimal shapes in reality.

6 Discussion and conclusion

6.1 The effect of parameter values on the optimal shape

Although we have investigated optimal diffuser shapes in a number of specific cases, we have not yet explored the various parameters of the model thoroughly, which are listed in Table 1. We now briefly discuss the effect that each of these parameters has on the optimal shapes. However, since there are many parameters, we do not provide plots for the analysis of every single parameter.

One of the most important parameters is the velocity ratio \(U_2(0)/U_0\) of the inflow. To explore this parameter, we investigate optimal diffuser shapes for a fixed inflow with \(h_2(0)/h_0 = 0.5\), an expansion ratio \(h_L/h_0 = 2.3\) and a length ratio \(L/h_0 = 40\), and we vary the velocity ratio. The results of the optimisation are displayed in Fig. 11, for \(U_2(0)/U_0=0.3\) and \(U_2(0)/U_0=0.7\). We see that the effect of a velocity ratio which is closer to 1 is that an initial widening section becomes favourable. This is because when the inflow is more uniform, wider angles penalise pressure recovery less. Therefore, the balance is tipped in favour of reducing wall drag by expanding the channel a little. In the extreme case where \(U_2(0)/U_0\) becomes close to unity, we have seen in Sect. 4.1 that this initial widening section dominates throughout, such that the optimal control is purely bang-bang, with no singular arc. Notice how in the case of \(U_2(0)/U_0=0.7\) the shape can no longer be approximated with the parameterisation of \(x_1\) and \(x_2\).

Fig. 11
figure 11

Investigation of the dependence of optimal diffuser shapes on the inflow velocity ratio in the two-dimensional case, showing velocity colour maps (a, b) and plots of the control \(\alpha \) (c, d). In both cases, we choose an inflow with \(h_2(0)/h_0= 0.5\), an expansion ratio \(h_L/h_0 = 2.3\) and a length ratio \(L/h_0 = 40\). The lower limit for the diffuser angle in both cases is \(\alpha _\mathrm{min}=0^\circ \). The upper limit is \(\alpha _\mathrm{max}= \tan 7^\circ \)

The effect of increasing or decreasing the ratio of the size of the plug regions from \(h_2(0)/h_0=0.5\) is that the distance it takes for one of the plug regions to disappear becomes smaller. If the velocity ratio is small then, as described earlier, this distance is critical because it marks the point where the flow is sufficiently mixed that it is acceptable to expand thereafter at a wider angle. Hence, the effect of increasing or decreasing \(h_2(0)/h_0\) is that this critical distance becomes smaller.

The effects of varying the diffuser expansion ratio \(h_L/h_0\) and length ratio \(L/h_0\) are more obvious and less interesting. Neither of them affect the optimal widening angle, but instead simply make the diffuser continue to expand wider and longer respectively. This is because they don’t affect the crucial balance between wall drag and mixing effects.

Varying the upper and lower bounds on the diffuser angle, \(\alpha _\mathrm{max}\) and \(\alpha _\mathrm{min}\), only affects the optimal solution if the diffuser angle touches the bounds over an interval. For example, in Fig. 11a, c, we see that \(\alpha \) never touches \(\alpha _\mathrm{max}\). Therefore, in this case, raising \(\alpha _\mathrm{max}\) would have no effect on the solution. However, \(\alpha \) clearly lies on the lower-bound \(\alpha _\mathrm{min}\) over an interval at the beginning and near the end of the domain. Therefore, varying \(\alpha _\mathrm{min}\) here moves the optimal control along with it.

Throughout this manuscript, we have used a constant value of the spreading parameter \(S=0.11\). In Sect. 5, we showed that this parameter value is consistent with both a k\(\epsilon \) and a k\(\omega \) SST computational turbulence model using all standard turbulence parameter values [26, 27]. In earlier work [6], we compared our simple model to PIV experiments in a three-dimensional geometry and found \(S=0.18\). The equivalent spreading parameter for free shear layers [39] has been reported to take a range of values for different experiments and CFD calculations. Since the spreading parameter S is associated with shear layer growth rate, for larger S, the shear layer will entrain the plug regions over a shorter distance. Similar to varying \(h_2(0)/h_0\), this decreases the critical distance after which expansion occurs. We have already discussed the effect of S on the singular arc in Sect. 4.2.

For rougher channels with a larger friction factor f, thinner channels and smaller angles will be penalised more. In such cases, the optimal widening angle is larger. Furthermore, if f is sufficiently large, it becomes more advantageous to have an initial widening section, similar to situations where the velocity ratio \(U_2(0)/U_0\) is close to 1. In the extreme case where wall drag dominates, the control becomes bang-bang because the penalty of worsening the non-uniform flow is eclipsed by the effect of wall drag. For very small wall drag, the optimal diffuser shape appears to prioritise mixing over widening the flow. In these cases, thin channels and small diffuser angles are not penalised very much, such that the critical distance after which expansion occurs is precisely the point where the shear layer has reached across the entire channel. At this point, the flow is sufficiently mixed and can afford expansion.

6.2 Conclusions

We have developed a numerical optimisation routine to find the diffuser shape which maximises pressure recovery for given non-uniform inflow, in both two-dimensional and axisymmetric cases. The optimisation uses a simplified mathematical model for the development of turbulent shear layers in confining channels. We find that some of the optimal diffuser shapes are well approximated by shapes which are composed of two straight sections separated by a widening section with a constant widening angle. This is in contrast to diffuser design for uniform flow, where diffusers do not typically have an initial straight section. Furthermore, we show that the optimal widening angle is less than the angle at which boundary layer separation typically occurs, which is usually the diffuser angle chosen for uniform flow. Therefore, we have shown that the effects of non-uniform inflow are critical to diffuser performance, and should not be ignored when it comes to diffuser design.

In two limiting cases, we use analytical techniques to interpret the optimal diffuser shapes found with the numerical optimisation. The first of these cases is the small shear limit, where the inflow is almost uniform, in which case the optimal control is bang-bang, such that the diffuser widens at the maximum possible angle until it reaches the desired cross-sectional area, and then remains at that area. The second case is the pure shear limit, where the inflow is a purely sheared flow with no plug regions. In this case, the optimal control may have a singular arc where, on an interval, the diffuser angle takes values between its upper and lower bounds. We show that in certain cases, the singular arc corresponds to a constant angle, and this angle depends on the friction factor f and the spreading parameter S. We compare some of the numerical optimisation results with CFD simulations using both a k\(\epsilon \) and a k\(\omega \) SST turbulence model (using all standard turbulence parameter values), and the comparion showed good agreement. In the case where we approximate the diffuser shape with piecewise linear sections, we show that both the simplified model and the CFD share almost identical optimal shapes. This suggests that the optimal shapes found using the numerical optimisation and the simplified model are indeed close to the true optimal shapes in reality.