1 Introduction

Assume that the velocity of an incompressible irrotational flow at each location \((x,y)\in \Omega \subset {\mathbb {R}}^2\) is given by \(\nabla \phi\) where the stream function \(\phi (x,y)\) satisfies the Laplace equation (Farahi et al. 2005)

$$\begin{aligned} \triangle \phi =0\quad in\quad \Omega , \end{aligned}$$
(1.1)

with the Neumann boundary conditions

$$\begin{aligned} \frac{\partial \phi }{\partial n}& {}= \left\{ \begin{array}{ll} -1,&\quad x\in \Gamma _1,\\ 0,&\quad x\in \Gamma _3\cup \Gamma ^{*}\\ \frac{a}{b},&\quad x\in \Gamma _2.\\ \end{array},\right. \end{aligned}$$
(1.2)

such that

$$\begin{aligned}&\partial \Omega =\Gamma _1\cup \Gamma _2\cup \Gamma _3\cup \Gamma ^{*},\nonumber \\&\Gamma _1=\{0\}\times [0,a],~\Gamma _2=\{L\}\times [0,b],~\Gamma _3=[0,L]\times \{0\},\nonumber \\& \Gamma ^{*}:=\{(x,s(x))|~s\in C[0,L],~s(0)=a,~s(L)=b,\nonumber \\&\quad \forall ~0<x<L,~0\le s(x)\le b\}. \end{aligned}$$
(1.3)

The problem is defined by (Farahi et al. 2005; Mohammadi and Pironneau 2010):

$$\begin{aligned} \mathbf{P }:=\min _{\partial \Omega ,~D\subset \Omega }\bigg \{\int _{D}\Vert \nabla \phi -\overrightarrow{\phi _d}\Vert ^2\quad s.t\quad \Delta \phi =0,\quad \frac{\partial \phi }{\partial n}=\left\{ \begin{array}{ll} -1,&\quad x\in \Gamma _1,\\ 0,&\quad x\in \Gamma _3\cup \Gamma ^{*}\\ \frac{a}{b},&\quad x\in \Gamma _2.\\ \end{array}\right. \bigg \}. \end{aligned}$$
(1.4)

Briefly stated, a shape \(\Gamma ^{*}\) as a portion of the entire boundary \(\partial \Omega\) is to be found that brings the stream function \(\phi\) which satisfies the two-dimensional Laplace equation in \(\Omega\) as well \(\phi\) minimizes the objective function \(\int \Vert \nabla \phi -\overrightarrow{\phi _d}\Vert ^2\) defined over a subdomain D of the domain \(\Omega\) (Mohammadi and Pironneau 2010).

Theorem 1.1

Suppose that

$$\begin{aligned} P_L{C[a,b]}& {}= \{f:[0,L]\longrightarrow {\mathbb {R}},\\&\quad ~{f{{\text{ is a piecewise linear continuous function defined on }}}\,\,[0, L]}\}. \end{aligned}$$

Then, the problem given by equations (1.1)-(1.3) has at least one solution with upper bound in \(P_L{C[0, L]}\).

Proof

See Farahi et al. (2005). \(\square\)

Equations (1.11.4) present an optimal shape design (OSD) problem which has great applications in wind tunnel or nozzle design for potential flow (Mohammadi and Pironneau 2010). For this problem, some of the boundary condition is defined over an unknown curve \(\Gamma ^{*}\subset \partial \Omega\). We address the question of simultaneous estimation of the unspecified trajectory function \(\Gamma ^{*}\) as well as the stream function by applying the given boundary conditions and using the fact that the velocity of the stream function passing through the known region \(D\subset \Omega\) reaches a desired value (Farahi et al. 2005).

Fig. 1
figure 1

Representation of the physical domain corresponding to the P, with locations of the boundary conditions (1.21.3)

1.1 Some Applications of Optimal Shape Design Problems

Optimal shape design (OSD) is an important field from both theoretical and industrial aspects. They appear while studying physical systems described by elliptic, hyperbolic or parabolic partial differential equations and include a broad range of inverse problems (Mohammadi and Pironneau 2010; Pironneau 1984) for which the issues of existence and sensitivity analysis of the solution, correct discretization of the problem and practical implementation in order to prepare the convergent numerical solution, are of crucial importance (Mohammadi and Pironneau 2010; Pironneau 1984; Rad et al. 2017; Rashedi and Sarraf 2018; Rashedi et al. 2014). Briefly stated ( Fakharzadeh Jahromi and Alimorad 2019), suppose that the problem of minimizing the objective function with respect to a particular geometric elements including a curve, a domain, or a point of the physical system is considered. Then, it is necessary to modify the shape of the physical system to obtain the minimum cost function. The process of designing the best shape of a physical system such that the given objective function finds the minimum cost is called the OSD problem.

We recall few instances of the OSD problems that have been researched by engineers and mathematicians to extract the shape of a body that achieves specified design objectives (Ashrafzadeh et al. 2002). It should be noted that the following applications are related to physical systems that are described by elliptic partial differential equations supplemented with a single criterion function that has to be minimized:

Nozzle optimization In addition to applications in the supersonic wind tunnel connected with computational fluid dynamics (Garg 1998) and designing the nozzle for potential flows, it is seen that the nozzle shape significantly affects on the performance of the industrial devices. For example, in jet wiping process related to galvanization industry (Mehne et al. 2005), the liquid film is dragged on the surface of a moving strip and is impacted by the effect of air knives produced by a 2D slot nozzle (Gosset and Buchlin 2003).

Optimal breakwater It is possible to construct a calm harbor by building an optimal breakwater, at a little cost, which protects a harbor from incoming waves (Keuthen and Kraft 2016; Mohammadi and Pironneau 2010). Indeed, the incoming waves must have minimum amplitude in a given harbor D and this goal can be achieved by minimizing the average wave height in the harbor basin with the shape of the breakwater as the optimization variable (Keuthen and Kraft 2016).

Wing drag minimization The flow reaction on a wing (drag) of a plane directly depends on the wing body configuration. Therefore, in aeronautics industry, aerodynamic optimization of 3D wings and wing body configurations can significantly reduce the percentage of drag and provide a valuable saving on commercial airplanes (Mohammadi and Pironneau 2010). To optimize the shape of the wing, it is necessary to consider surface stresses coming from fluid forces acting on the wing and several other constraints such as aerodynamical and structural factors. Generally, the stream function of a flow around an airfoil satisfies the Navier–Stokes equation but in the case of low Mach and Reynolds numbers, the Navier–Stokes equation is reduced to an incompressible potential flow equation. If only the wave drag is considered, the optimal shape of a thin wing for minimum drag can be determined by solving a modified type of the shape design problem (Farahi et al. 2006; Mohammadi and Pironneau 2010).

Minimum weight of structures A crucial task for car industries is the design of the optimal structure of the car such that the final production carries the minimum weight with the best aerodynamics, provided that some inequality constraints for stress distribution of the engine crankshaft are satisfied. Other important applications can be seen in the design of light weight beams for strengthening airplane floors (Mohammadi and Pironneau 2010)

1.2 Literature Review

Various methods have been applied to solve the OSD problems described by elliptic PDE’s (Ashrafzadeh et al. 2002; Butt 1993; Fakharzadeh Jahromi 1996, 2013; Fakharzadeh and Rubio 1999a, b, 2001, 2009; Fakharzadeh and Rafiei 2012; Fakharzadeh Jahromi et al. 2013; Farahi et al. 2005, 2006; Mehne et al. 2005; keuthen and Kraft 2016; Mohammadi and Pironneau 2010). In these methods, the OSD problems have often been viewed as a branch of calculus of variations and optimal control problems. In Butt (1993), a gradient method was developed for the optimal shape design of a nozzle problem that is described by variational inequalities. In Laumen (2000), the author applied Newton’s method in a particular function space and obtained an algorithm to solve the discretized form of some OSD problems. Mohammadi and Pironneau (2010) and Pironneau (1984) discussed the novel applications of finite element method, Boundary element method and finite difference technique for discretizing the elliptic OSD problems.

A great number of papers dealing with OSD problems by applying measure theory and embedding approaches published by Fakharzadeh Jahromi ( 1996, 2013), Fakharzadeh Jahromi and Alimorad (2019), Fakharzadeh and Rubio (1999a, b, 2001, 2009), Fakharzadeh and Rafiei (2012) and Fakharzadeh Jahromi et al. (2013). In Fakharzadeh and Rubio (1999a), the authors proposed a solution procedure based on employing the Radon measures in the variational form of elliptic partial differential equation describing an optimal shape problem defined in polar coordinates. In Fakharzadeh and Rubio (2009) and Fakharzadeh and Rafiei (2012), the shape-measure method was applied to construct optimal domains for elliptic OSD problems in Cartesian coordinates where the shape was determined as a generator curve by using measures. In Fakharzadeh Jahromi (2013), a general free boundary problem governed by an elliptic equation with boundary control and functional criterion was studied by shape-measure method and an algorithmic approach for obtaining the optimal solution was proposed. In Fakharzadeh Jahromi et al. (2013), a comparison between the shape-measure method and the penalty approach was made and the advantages of these two methods were discussed.

Farahi et. al published several papers on elliptic OSD problems including shape design of nuzzles and wing drag minimization by employing measure theory (Farahi et al. 2005, 2006; Mehne et al. 2005). Essentially, the initial problem is converted to a shape-measure problem consisting of minimizing a linear form over a set of positive measures. Finally, the converted problem is approximated by a finite dimensional linear programming approach.

For a comprehensive review of OSD problems and their solutions, the interested reader is referred (Fakharzadeh Jahromi and Alimorad 2019; Mohammadi and Pironneau 2010; Pironneau 1984).

It should be noted that applying aforementioned methods may cause some difficulties and shortcomings. Regarding the embedding methods, several steps of approximations are employed to characterize the optimal shape using a finite linear programming approach (Fakharzadeh Jahromi and Alimorad 2019). Thus, not only the yielded piecewise linear trajectory may not satisfy the final condition (Fakharzadeh Jahromi and Alimorad 2019; Farahi et al. 2006) because of the approximations, but also the proposed methods are not easy to program and relatively expensive in computations. The main challenge, especially concerning the techniques which need to discretize the domain of the problem (Mohammadi and Pironneau 2010; Pironneau 1984), is the computation of the solution which is time-consuming because the method requires solving numerous boundary value problems. Furthermore, these methods are difficult to use in practice. In other cases, the proposed techniques may involve iteration processes and they need to have an initial guess for solution.

In this work, we propose an MFS solution for an OSD problem where the dynamic constraints are a system of homogeneous partial differential equations. The MFS is a mesh free boundary collocation technique (Karageorghis et al. 2011; Kita and Kamiyia 1995; Trefftz 1926) to solve initial/boundary value problems provided that the fundamental solution for their corresponding governing equations is available. Here, the governing equation which describes the considered OSD problem is a two-dimensional Laplace equation defined over a non-rectangular domain \(\Omega\). In comparison with other numerical techniques, the main advantages of the MFS are:

  • Despite the other well-known numerical techniques such as finite-difference methods (FDM), finite element methods (FEM), boundary element method (BEM), the MFS is flexible and easy to adjust to irregular domains. To manipulate the MFS, we only choose a scattered set of points out of the physical domain and therefore, no kind of mesh generation over the domain is needed. Thus, it is quite easy to understand and implement. Also, it does not incur a large computational cost to establish a suitable mesh (Rashedi and Sarraf 2018).

  • Our technique produces accurate, stable and cost-effective results in conjunction with Tikhonov regularization techniques (Johansson et al. 2011; Karageorghis et al. 2011). Numerical simulations will demonstrate the small errors with boundary conditions for the stream function \(\phi (x,y)\) and confirm that the approximation of trajectory function s(x) exactly satisfies the conditions \(s(0)=a\) and \(s(L)=b\).

The paper is organized as follows: In Sect. 2, a detailed description of the proposed algorithm for solving the given OSD problem based on the MFS is provided. The numerical results are discussed in Sect. 3. In Sect. 4, we give some concluding remarks.

2 The Solution Procedure

In this section, we introduce the approximate solution to the system (1.11.3) based on application of the MFS and the Tikhonov regularization method. The MFS is a powerful, accurate and low cost numerical meshless method which has been applied for solving a wide class of stationary and time-dependent partial differential equations (Rashedi et al. 2015; Karageorghis et al. 2011). Following the idea of MFS for solving Laplace equation (Karageorghis et al. 2011), we first consider \(N_1\) number of source points, namely \((x_j^{*},y_j^{*}),~j=\overline{1,N_1}\), settled (Fig. 2) out of the domain \(\Omega\) and express the approximate solution to Eq. (1.1) by using the linear combination of basis functions

$$\begin{aligned} \bigg \{\Phi _m(x,y)=\Phi (x-x_m^{*},y-y_m^{*})\bigg \}_{m=1}^{N_1}, \end{aligned}$$

where \(\Phi (x,y)=\log (x^2+y^2)\) is the fundamental solution to the two-dimensional Laplace equation.

Fig. 2
figure 2

Representation of a possible placement of source \((\bigstar )\) and collocation points \((\circ )\)

2.1 Solution of P

We place the source points external to the domain \(\Omega\) by using the following scheme:

$$\begin{aligned} \Gamma _{P}:=\bigg \{(x_j^{*},y_j^{*})|~x_j^{*}= & {} \frac{L}{2}+(\frac{L}{2}+\gamma )\cos \bigg (\frac{2\pi j}{N_1}\bigg ),\nonumber \\ ~y_j^{*}= & {} \frac{b}{2}+(\frac{b}{2}+\gamma )\sin \bigg (\frac{2\pi j}{N_1}\bigg ),~ j=\overline{1,N_1}\bigg \}, \end{aligned}$$
(2.1)

where \(\gamma >0\) and establish the approximate solution of equation (1.1) as:

$$\begin{aligned} \overline{\phi (x,y)}=\sum _{m=1}^{N_1}c_m\Phi _m(x,y). \end{aligned}$$
(2.2)

Next, we consider a Ritz type approximation (Rashedi et al. 2015, 2013; Sarabadan et al. 2018) by employing a truncated series in terms of the Lagrange polynomials \(L_i(x)\) (Rad et al. 2017):

$$\begin{aligned} \overline{s(x)}=\sum _{m=N_1+1}^{N_1+N_2}c_mx(x-L)L_i(x)+a+\frac{(b-a)x}{L},\quad 0\le x\le L, \end{aligned}$$
(2.3)

as the approximation for the smooth object s(x), where \(c_i\)’s are the unknown coefficients. It is obvious that the conditions \(\overline{s(0)}=a\) and \(\overline{s(L)}=b\) are satisfied automatically. By a simple calculation and by taking into account the orthonormal outer vectors

$$\begin{aligned} \overrightarrow{n_1}=(-1,0),~\overrightarrow{n_2}=(1,0),~\overrightarrow{n_3}=(0,-1),~\overrightarrow{n^{*}}=\frac{(-s'(x),1)}{\sqrt{1+s'(x)^2}}, \end{aligned}$$

corresponding to \(\Gamma _1,~\Gamma _2,~\Gamma _3,~\Gamma ^{*}\), we get

$$\begin{aligned} \phi _x(0,y)=1,~y\in [0,a],\quad \quad \phi _x(L,y)=\frac{a}{b},~y\in [0,b], \end{aligned}$$
(2.4)
$$\begin{aligned} \phi _y(x,0)& {}= 0,~x\in [0,L],\nonumber \\&\phi _y(x,s(x))-s^{'}(x)\phi _x(x,s(x))=0,~x\in [0,L]. \end{aligned}$$
(2.5)

Now, we define

$$\begin{aligned} H_1(y)& {}= \phi _x(0,y)-1,~y\in [0,a],\nonumber \\ H_2(y)& {}= \phi _x(L,y)-\frac{a}{b},~y\in [0,b], \end{aligned}$$
(2.6)
$$\begin{aligned} H_3(x)& {}= \phi _y(x,0),~x\in [0,L],\nonumber \\ H_4(x)& {}= \phi _y(x,s(x))-s^{'}(x)\phi _x(x,s(x)),~x\in [0,L], \end{aligned}$$
(2.7)

and substitute them in the following nonlinear regularized least squares functional:

$$\begin{aligned} \mathbf{F}(c) &:= \sum _{i=1}^{M_1}H_1(t_i)^2\nonumber \\&+\sum _{i=1}^{M_2}H_2(y_i)^2+\sum _{i=1}^{M_3}H_3(x_i)^2+\sum _{i=1}^{M_3}H_4(x_i)^2\nonumber \\&+\int _{D}\Vert \nabla \phi -\overrightarrow{\phi _d}\Vert ^2\nonumber \\&+\lambda \sum _{i=1}^{N_1+N_2}c_i^2, \end{aligned}$$
(2.8)

where

$$\begin{aligned} t_i= & {} \frac{a(i-1)}{M_1},~i=\overline{1,M_1},\\ y_j= & {} \frac{b(j-1)}{M_2},~j=\overline{1,M_2},~x_r=\frac{L(r-1)}{M_3},\\ r= & {} \overline{1,M_3}, \end{aligned}$$

are the collocations points and \(\lambda >0\) is the Tikhonov’s regularization parameter. The squared terms in the functional (2.8) include the error between the approximation of \(\phi (x,y)\) and the boundary data, the objective function and the regularization term for the unknown constants \(c_i\), respectively. For obtaining unknown parameters \(c_i,~i=\overline{1,N_1+N_2}\), we insert the approximations \(\overline{s(x)},~\overline{\phi (x,y)}\) in the functional (2.8) and minimize the following functional:

$$\begin{aligned} J^{*}= & {} \sum _{i=1}^{M_1}\bigg \{\sum _{m=1}^{N_1}c_m\frac{\partial \Phi _m(0,t_i)}{\partial x}-1\bigg \}^2\nonumber \\&+ \sum _{i=1}^{M_2}\bigg \{\sum _{m=1}^{N_1}c_m\frac{\partial \Phi _m(L,y_i)}{\partial x}-\frac{a}{b}\bigg \}^2\nonumber \\&+\sum _{i=1}^{M_3}\bigg \{\sum _{m=1}^{N_1}c_m\frac{\partial \Phi _m(x_i,0)}{\partial y}\bigg \}^2\nonumber \\&+\lambda \sum _{i=1}^{N_1+N_2}c_i^2+\int _{D}\Vert \sum _{m=1}^{N_1}\nabla \Phi _m(x,y)-\overrightarrow{\phi _d}\Vert ^2\nonumber \\&+\sum _{i=1}^{M_3}\bigg \{\sum _{m=1}^{N_1}c_m\frac{\partial \Phi _m(x_i,\overline{s(x_i)})}{\partial y}\nonumber \\&-\frac{d\overline{s(x)}}{dx}|_{x_i}\frac{\partial \Phi _m(x_i,s(x_i))}{\partial x}\bigg \}^2. \end{aligned}$$
(2.9)

For minimizing \(J^{*}\), we can either use the necessary conditions for the extremum as

$$\begin{aligned} \frac{\partial J^{*}}{\partial c_j}=0,\quad j=\overline{1,N_1+N_2}, \end{aligned}$$
(2.10)

and solve a nonlinear system of algebraic equations for the elements \(c_i\) directly, or apply the Mathematica toolbox ”NMinimize” which is designed to minimize a sum of squares of arbitrary differentiable functions. Here, the regularization parameter \(\lambda\) is applied to the functional \(J^{*}\) as a known value. This approach is called the static MFS. It should be noted that the integration term \(\int _{D}\Vert \sum _{m=1}^{N_1}\nabla \Phi _m(x,y)-\overrightarrow{\phi _d}\Vert ^2\) in \(J^{*}\) will be calculated numerically using the midpoint rule (Stoer and Bulirsch 1980).

Remark 2.1

The considered inverse problem is ill-posed since small errors in the input measured data can produce large deviations in the desired solution. Therefore, if the input boundary conditions are contaminated by noise, regularization needs to be incorporated in the objective function which is minimized in order to obtain a stable solution (Johansson et al. 2014; Reeve 2013). This does not seem to affect the accuracy for exact data, but it becomes necessary if noise is added in the input data. We use the Tikhonov regularization technique, presented by the functional \(J^{*}\), to obtain the stable solution. The regularization parameter \(\lambda >0\) is employed in \(J^{*}\) as a known value, to control the quality of the regularized solution by fairly balancing the perturbation error and the regularization error in the regularized solution (Chen et al. 2006; Kirsch 2011). It can be chosen via several well-known disciplines like discrepancy principle, composite residual and smoothing operator method, zero-crossing method and L-surface method (Hansen 1992; Johansson et al. 2014; Reeve 2013). In our experiments, we find the parameter \(\lambda\) by trial and error. That is we start with a small value of \(\lambda\) for example \(\lambda =10^{-16}\), solve the minimization problem (2.9), find the unknown coefficients \(c_i\) and then compute

$$\begin{aligned} \mathbf{B }_{\phi }=\Vert H_1(y)\Vert _2+\Vert H_2(y)\Vert _2+\Vert H_3(x)\Vert _2+\Vert H_4(x)\Vert _2. \end{aligned}$$
(2.11)

Then, increase \(\lambda\) gradually as \(\lambda \in \{10^{-15},10^{-14},...,10^{-2},10^{-1}\}\) and calculate \(\mathbf{B }_{\phi }\) related to each selection \(\lambda\). In our computation, the best solution is obtained when its corresponding regularization parameter, \(\lambda\), gives the minimum value of \(\mathbf{B }_{\phi }\).

Remark 2.2

It must be noted that the numerical solution obtained by minimizing the functional \(J^{*}\) is acceptable as long as \(\forall ~x\in [0,L],~0\le \overline{s(x)}\le b\). Otherwise, we propose the alternative procedure that consists of the following steps:

Step1 Based on approximation via the piece-wise constant basis functions, we consider \(m^n\) possible approximations

$$\begin{aligned}&s^{0,i_1,i_2,...,i_{m-2},m-1}(x):[0,L]\\&\quad \longrightarrow \{0,\frac{b}{m-1},\frac{2b}{m-1},...,a,...,\frac{(m-2)b}{m-1},b\},\\&\quad i_j\in \{0,1,2,...,m-1\},~j=\overline{1,m-2}, \end{aligned}$$

for s(x) and contribute these known functions in the computations. The criterion of \(s^{0,i_1,i_2,...,i_{m-2},m-1}(x)\) is proposed by:

$$\begin{aligned} s^{0,i_1,i_2,...,i_{m-2},m-1}(x)=\left\{ \begin{array}{llrr} a, &{} 0\le x<\frac{L}{n+2},\\ \frac{b}{m-1}i_1, &{} \frac{L}{n+2}\le x<\frac{2L}{n+2},\\ \frac{b}{m-1}i_2, &{} \frac{2L}{n+2}\le x<\frac{3L}{n+2},\\ \vdots &{} \vdots \\ \frac{b}{m-1}i_{m-2}, &{} \frac{nL}{n+2}\le x<\frac{(n+1)L}{n+2},\\ b, &{} \frac{(n+1)L}{n+2}\le x\le L. \end{array} \right. \end{aligned}$$
(2.12)

It is obvious that \(s^{0,i_1,i_2,...,i_{m-2},m-1}(0)=a,\quad s^{0,i_1,i_2,...,i_{m-2},m-1}(L)=b\). Step2 For each \(s^{0,i_1,i_2,...,i_{m-2},m-1}(x)\), follow the procedure given by equations (2.1)-(2.2) and compute

$$\begin{aligned} J_{i_1,i_2,...,i_{m-2}}^{*}= & {} \sum _{i=1}^{M_1}\bigg \{\sum _{r=1}^{N_1}c_r\frac{\partial \Phi _r(0,t_i)}{\partial x}-1\bigg \}^2\nonumber \\&+\sum _{i=1}^{M_2}\bigg \{\sum _{r=1}^{N_1}c_r\frac{\partial \Phi _r(L,y_i)}{\partial x}-\frac{a}{b}\bigg \}^2\nonumber \\&+\sum _{i=1}^{M_3}\bigg \{\sum _{r=1}^{N_1}c_r\frac{\partial \Phi _r(x_i,0)}{\partial y}\bigg \}^2+\lambda \sum _{i=1}^{N_1}c_i^2\nonumber \\&+\int _{D}\Vert \sum _{r=1}^{N_1}\nabla \Phi _r(x,y)-\overrightarrow{\phi _d}\Vert ^2\nonumber \\&+\sum _{i=1}^{M_3}\bigg \{\sum _{r=1}^{N_1}c_r\frac{\partial \Phi _r(x_i,s^{0,i_1,i_2,...,i_{m-2},m-1}(x_i))}{\partial y}\nonumber \\&-\frac{s^{0,i_1,i_2,...,i_{m-2},m-1}(x_i+h)-s^{0,i_1,i_2,...,i_{m-2},m-1}(x_i-h)}{2h}\nonumber \\&\times \frac{\partial \Phi _r(x_i,s^{0,i_1,i_2,...,i_{m-2},m-1}(x_i))}{\partial x}\bigg \}^2, \end{aligned}$$
(2.13)

where h is a small positive value. Step3 Calculate \(J_{opt}^{*}=\min \{J_{i_1,i_2,...,i_{m-2}}^{*}\}\) and select the optimal shape \(s_{opt}(x)\) so that for which the value of functional (2.13) is minimized.

3 Numerical Experiments

To test the applicability of the proposed technique, we solve two benchmark test examples. The numerical implementation is carried out in MATHEMATICA 11.

3.1 Example 1

As the first example, consider P with the following properties:

$$\begin{aligned} L=b=3,~a=1,~D=[1.5,2.5]\times [0,1],~\overrightarrow{\phi _d}=(0.6,0)^t. \end{aligned}$$
(3.1)

We applied the numerical scheme presented by equations (2.12.9) with

$$\begin{aligned} N_1=26,~N_2=2,~M_1=M_2=M_3=90,~\gamma =0.2 \end{aligned}$$
(3.2)
Fig. 3
figure 3

Approximate solutions for s(x) and \(\phi (x,y)\) with \(\mathbf{B }_{\phi }=0.00504\). All plots for exact data, discussed in Example 3.1

and obtained the results demonstrated by Figs. 3a–4d. Also, we obtained the optimal value of the cost functional as 0.02257. In Farahi et al. (2005), the authors reported the minimum value of the cost functional (1.4) with condition (3.1) as 0.034. Table 1 represents the comparison between our findings and the results derived by Farahi et al. (2005), including the optimal objective values, CPU times and the errors of boundary conditions for approximations of unknown functions \(\phi (x,y)\) given by \(\mathbf{B }_{\phi }\) and s(x) defined by \(\mathbf{B }_s=|\overline{s(0)}-a|+|\overline{s(L)}-b|\). It should be noted that in Farahi et al. (2005), the boundary error \(\mathbf{B }_{\phi }\) was not reported. Nevertheless, we used the approximate solution of s(x) obtained in Farahi et al. (2005) and solved the direct problem:

Table 1 A comparison between the numerical results derived by Farahi et al. (2005) and the present method, including the optimal objective values, CPU times and the errors of boundary conditions for approximations of unknown functions s(x) and \(\phi (x,y)\), discussed in Example 3.1
$$\begin{aligned} \Delta \phi =0,\quad in\quad \Omega , \end{aligned}$$
(3.3)

with the boundary conditions (2.42.5) via the MFS with the parameters (3.2).

Fig. 4
figure 4

Graphs of the absolute errors for the boundary conditions discussed in Example 3.1. All plots for exact data

Next, we study the effect of model parameters on the optimal shape and the optimal value of the cost functional. Thus, we consider small changes in the position and the size of D and solve the problem by employing the presented method.

  • Sensitivity of the optimal shape with respect to changes in the position of D: Let change the place of D along the nozzle length. We choose five different cases

    $$\begin{aligned}&D_0=[0.2,1.2]\times [0,1],~D_1=[0.9,1.9]\times [0,1],\\&\quad ~D_2=[1.2,2.2]\times [0,1],\\&\quad D_3=[1.5,2.5]\times [0,1],~D_4=[1.8,2.8]\times [0,1], \end{aligned}$$

    and solve the problem with properties (3.2). The outcomes are demonstrated by Fig. 5 and Table 2. Evidently, in all cases we should anticipate the increasing curves as the optimal shape. Besides, when the position of D is closer to inlet, the graph of resulting optimal shape is higher than other cases.

  • Sensitivity of the optimal shape with respect to changes in the size of D: We make small changes in the size of D along the nozzle length (longitudinal changes) as well in the direction perpendicular to the stream flow \(\phi (x,y)\) (transversal changes). Hence, we consider different regions for D as:

    $$\begin{aligned} D_1^{*}& {}= [1.5,1.9]\times [0,1],\,D_2^{*}=[1.5,2.2]\times [0,1],\\ D_3& {}= [1.5,2.5]\times [0,1],\, D_4^{*}=[1.5,2.8]\times [0,1], \end{aligned}$$

    corresponding to the longitudinal altering and take

    $$\begin{aligned} D_1^{\#}& {}= [1.5,2.5]\times [0,0.4],\quad D_2^{\#}=[1.5,2.5]\times [0,0.7],\\ D_3& {}= [1.5,2.5]\times [0,1],\\ D_4^{\#}& {}= [1.5,2.5]\times [0,1.3],\quad D_5^{\#}=[1.5,2.5]\times [0,2], \end{aligned}$$

    as the samples of transversal changes. By solving the problem using the MFS with the properties (3.2), we obtain the results depicted in Figs. 67 and Tables 34. It is seen that the longitudinal changes in the size of D do not have significant impact on the shape but the large transversal altering can give rise to considerable variations in the optimal shape.

Fig. 5
figure 5

Representation of the optimal shapes related to the different positions of D, i.e., \(***\) corresponding to \(D_0\), \(\bullet \bullet \bullet\) corresponding to \(D_1\), \(\blacktriangle \blacktriangle \blacktriangle\) corresponding to \(D_2\), Line corresponding to \(D_3\), \(\Box \Box \Box\) corresponding to \(D_4\)

Table 2 Numerical results for the optimal objective values and the errors of boundary conditions for approximations of unknown function \(\phi (x,y)\), corresponding to different positions of D, discussed in Example 3.1
Fig. 6
figure 6

Representation of the optimal shapes related to the transversal changes of the size of D, i.e., \(\bullet \bullet \bullet\) corresponding to \(D_1^{\#}\), \(\blacktriangle \blacktriangle \blacktriangle\) corresponding to \(D_2^{\#}\), Line corresponding to \(D_3\), \(\Box \Box \Box\) corresponding to \(D_4^{\#}\), \(***\) corresponding to \(D_5^{\#}\)

Table 3 Numerical results for the optimal objective values and the errors of boundary conditions for approximations of unknown function \(\phi (x,y)\), corresponding to the transversal changes of the size of D, discussed in Example 3.1
Fig. 7
figure 7

Representation of the optimal shapes related to the longitudinal changes of the size of D, i.e., \(\bullet \bullet \bullet\) corresponding to \(D_1^{*}\), \(\blacktriangle \blacktriangle \blacktriangle\) corresponding to \(D_2^{*}\), Line corresponding to \(D_3\), \(\Box \Box \Box\) corresponding to \(D_4^{*}\)

Table 4 Numerical results for the optimal objective values and the errors of boundary conditions for approximations of unknown function \(\phi (x,y)\), corresponding to the longitudinal changes of the size of D, discussed in Example 3.1
Table 5 The obtained values for the cost functional \(\int _{D}\Vert \nabla \phi -(0.5,0.75)\Vert ^2\) and \(\mathbf{B }_{\phi }\) in the presence of the different noise levels \(\delta\) with \(N_1=26,~N_2=2,~M_1=M_2=M_3=90,~\gamma =0.2\), discussed in Example  3.1.1 for exact and contaminated data

3.1.1 Example 2

Consider P with the following properties:

$$\begin{aligned}&L=b=3,~a=1,\nonumber \\&D=\{(x,y)|~(x-1.5)^2\nonumber \\&\qquad +y^2\le 1,~y\ge 0\},~\overrightarrow{\phi _d}=(0.5,0.75)^t. \end{aligned}$$
(3.4)

By employing the relations (2.12.9) with

$$\begin{aligned} N_1=26,~N_2=2,~M_1=M_2=M_3=90,~\gamma =0.2, \end{aligned}$$
(3.5)

we found the value 0.7045 as the minimum of the cost functional \(\int _{D}\Vert \nabla \phi -(0.5,0.75)\Vert ^2\). The illustration of the obtained results including the approximate solutions for s(x) and \(\phi (x,y)\) along with the residual of the boundary conditions are given by Figs. 8a–9d, confirming that the boundary conditions are satisfied accurately. Next, to study the numerical stability with respect to the boundary conditions, the contaminated input boundary data generated by:

$$\begin{aligned} \psi _x(0,y_l)& {}= 1+\delta \% RandomReal[\{-1,1\}],\\&y_l\in (0,1),~l=\overline{1,M_1},\\ \psi _x(3,y_l)& {}= \frac{1}{3}+\delta \% RandomReal[\{-1,1\}],\\&y_l\in (0,3),~l=\overline{1,M_2},\\ \psi (x_l,0)& {}= \delta \% RandomReal[\{-1,1\}],\\&x_l\in (0,3),~l=\overline{1,M_3},\\ \phi _y(x_l,s(x_l))& {}= s^{'}(x_l)\phi _x(x_l,s(x_l))+\delta \% RandomReal[\{-1,1\}],\\&x_l\in (0,3),~l=\overline{1,M_3}, \end{aligned}$$

are considered, where \(RandomReal[\{-1,1\}]\) gives a random real digit that belongs to the interval \([-1,1]\) and \(\delta \%=\delta \times 10^{-2}\) is called the level of noises. We take into account remark 2.1 and find the results depicted in Table 5, showing that the performance of the method is good in the presence of small additional errors, but it degrades when the errors increase.

Fig. 8
figure 8

Approximate solutions for s(x) and \(\phi (x,y)\). All plots for exact data, discussed in Example 3.1.1

Fig. 9
figure 9

Graphs of the absolute errors for the boundary conditions discussed in Example 3.1.1 with \(\mathbf{B }_{\phi }=0.02725\). All plots for exact data

4 Concluding Remarks

This article has outlined a numerical technique for design a wind tunnel with required flow properties in a region of space. As an extra specification, we take advantage of this fact that the velocity of the stream function passing through the known region \(D\subset \Omega\) reaches a desired value. We studied the numerical solution of the OSD problem by means of the MFS. Also, two numerical examples have been considered and we showed that by using the features of the MFS along with employing the appropriate regularization techniques lead to obtaining satisfactory results. In summary, the numerical achievements that should be highlighted here are as follows,

First, in contrast to other well-known numerical techniques such as finite-difference methods (FDM), finite element methods (FEM) and boundary element method (BEM), the MFS is flexible and easy to adjust to irregular domains. The MFS only needs to choose a scattered set of points out of the physical domain and therefore, no kind of mesh generation over the domain is needed. Thus, it is quite easy to understand and implement. Also, it does not incur a large computational cost to establish a suitable mesh (Rashedi and Sarraf 2018).

Second, the presented technique produces accurate, stable and cost-effective results. Numerical simulations demonstrate the small errors with boundary conditions for the stream function \(\phi (x,y)\) given by \(\mathbf{B }_{\phi }\) and confirm that the approximation of trajectory function s(x) exactly satisfies the conditions \(s(0)=a\) and \(s(L)=b\). These are the advantages of the proposed method in comparison with the approach of Farahi et al. (2005).

The issue of numerical stability and sensitivity analysis of the solution with respect to input data including, the position of D, the size of D and the Neumann boundary conditions is discussed. Following the numerical illustrations, we observe that stability is maintained for solution of the problems where their input data are contaminated with relatively small errors as well if the longitudinal changes are made in the size of D. In the future, we will consider developing the MFS for solving the wing drag minimization problem.