1 Introduction

Geometric design of high-speed train heads is a key part in the aerodynamic research of high-speed trains (Wang et al. 2018). A high-speed train head involves a lot of design variables and high smoothness requirements. Parametric surface modelling methods such as B-splines surfaces, Bézier surfaces and non-uniform rational B-splines (NURBS) surfaces are widely used in geometric design of the high-speed train head (Yao et al. 2016; Suzuki and Nakade 2013; Muñoz Paniagua et al. 2011). However, they are not ideal in using few surface patches to describe complicated shapes, easily and accurately controlling surface shapes, and achieving any high-order continuity which are required in shape modelling of high-speed strain heads. Especially, when aerodynamic simulation-based optimization is required to obtain the optimal head shape for further speed increase, using few design variables to describe complicated and detailed train head models will not only significantly reduce computational costs, but also make the optimal solution easy to obtain.

Partial differential equation (PDE)-based geometric modelling can use few PDE surface patches to describe complicated and detailed shapes (Zhang and You 2004), easily specify shape manipulation regions with arbitrary complexity (Ugail et al. 1999), apply sculpting forces to achieve complicated deformations and accurate control of surface shapes (Bloor and Wilson 1994; Du and Qin 2000), and readily achieve and naturally maintain any high-order continuity between two adjacent PDE surface patches (Zhang and You 2004). Therefore, PDE-based geometric modelling has the strengths in geometric design of high-speed train heads.

With partial differential equation-based modelling, 3D models are constructed from the solution to partial differential equations subjected to position, tangent, curvature, and even higher-order boundary constraints (You et al. 2013). Since adjacent PDE surface patches share the same boundary constrains, 3D models constructed from partial differential equation-based geometric modelling exactly and automatically satisfy position, tangent, curvature and higher order continuities between adjacent PDE surface patches. No manual operations are required to stitch PDE surface patches together. Complicated shapes of 3D models can be easily and effectively manipulated by adjusting shape control parameters in partial differential equations, and boundary curves, boundary tangents, boundary curvature, etc. in boundary constraints. Since a single PDE surface patch can describe a complicated shape, a complicated 3D model can be constructed from few PDE surface patches. In addition, fourth order partial differential equations are similar to the governing equations of elastic bending of thin plates. Therefore, PDE-based geometric modelling is physics-based (Du and Qin 2001), and has a potential to create more realistic deformations of 3D models. Its association with physical significance is particularly useful for engineering design.

Geometric models of high-speed train heads are usually applied in computer-aided design (CAD), computer-aided manufacturing (CAM) and computer-aided engineering (CAE) for further applications such as aerodynamic simulation and structural optimization. Currently, PDE-based geometric modelling has not become an industrial standard for the applications in CAD, CAM and CAE. In contrast, non-uniform rational B-splines (NURBS) have become an industry standard for the representation, design, and data exchange of geometric information processed by computers (Piegl and Tiller 1997). In order to facilitate further applications of PDE-based geometric modelling, it is necessary to convert PDE surfaces into NURBS surfaces for use in CAD, CAM and CAE systems. Therefore, optimal conversion from PDE surfaces into NURBS surfaces is an essential part of PDE-based geometric modelling of high-speed train heads.

Although there has been much work investigating conversion methods between different geometric surfaces such as from B-spline surfaces to Bézier surfaces (Hoschek and Schneider 1990), parametric surfaces to implicit surfaces (Manocha and Canny 1992), and physical surfaces to NURBS surfaces (Heidrich et al. 1996; Ma and Kruth 1998; Saini and Kumar 2014; Kruth and Kerstens 1998; Yin 2004; Dan and Lancheng 2006), we did not find any reports which convert PDE-surfaces into NURBS surfaces. In addition, most of prior conversion methods focus on a single surface patch or an object with a simple shape. Thus the data sizes of origin surfaces and converted surfaces are small and there is no need to minimize the data sizes in the process of conversion and further applications such as aerodynamic simulation-based optimization. However, for a complicated and large-scale object such as high-speed train heads in this paper, it involves a large amount of data. Therefore, two main problems exist. First, the conversion process will cost a lot of computational time and raise the computational cost. Second, after achieving the conversion, the NURBS surface-represented train heads involve plenty of control points which will cause heavy calculations of aerodynamic simulation-based optimization and make the optimal shape difficult to obtain. In order to tackle the two problems, the conversion method should not only achieve good conversion accuracy, but also minimize the amount of the data representing the converted NURBS surfaces. This paper will review various conversion methods between different geometric surfaces and develop a new method to optimally converting PDE surfaces of high-speed train heads into NURBS surfaces with required accuracy and small data amount.

PDE surfaces are defined by the solution to a vector-valued PDE subjected to the required boundary constraints. Depending on whether the vector-valued PDE is solved analytically or numerically, the solution to the PDE can be continuous or discrete representations. When converting continuous representations of analytical PDE surfaces into NURBS surfaces, it is still required to calculate the errors between the discretized version of analytical PDE surfaces and NURBS surfaces. Therefore, this paper will investigate the optimal conversion between discrete representations of PDE surfaces and NURBS surfaces.

The remaining parts of the paper are organised as follows. Existing research studies on PDE-based geometric modelling, NURBS and surface conversion methods are reviewed in Sect. 2. An overview of the proposed method is given in Sect. 3. Then, a fourth order PDE for each of the position functions x, y, and z function and its solution are proposed in Sect. 4. After that, an optimal conversion method of PDE surfaces defining high-speed train heads into NURBS surfaces is developed in Sect. 5, and validated by the application example presented in Sect. 6. Finally, the conclusion is drawn in Sect. 7.

2 Literature review

The work given in this paper is related to PDE-based geometric modelling, NURBS surfaces and their applications in CAD, CAM and CAE as an industrial standard, conversion between different surface representations, and optimization methods. This section will review some work in these fields.

2.1 PDE-based geometric modelling

Surface modelling based on the solutions of PDEs was initially proposed by Bloor and Wilson (1990). In the paper, they applied a vector-valued fourth order PDE with one shape control parameter to create surface shapes such as a propeller blade and a phone handset. Since then, this fourth order PDE-based surface modelling approach was applied to a number of engineering design problems (Bloor and Wilson 1994, 1996). Ugail et al. (1999) studied interactive design of practical surfaces using PDE-based modelling in real time. Du and Qin (2000) proposed a unified methodology to combine PDE surfaces with physics-based techniques, and presented a numerical approach through finite difference discretization of PDE surfaces (Du and Qin 2000).

Since one shape control parameter cannot satisfy the designers who want to obtain a much greater variety of shapes by adjusting the shape control parameters, You and Zhang (1999) proposed a general fourth order PDE with three shape control parameters for surface generation. Then, they developed some analytical methods to resolve the fourth order PDEs (Zhang and You 2004, 2002). They also presented a fast surface modelling method using a sixth order PDE (Zhang and You 2004). This method provides more degrees of freedom and shape control parameters to manipulate surface shapes.

Due to the advantages of PDE-based geometric modelling discussed above, they have been applied in many applications. For example, PDE-based geometric modelling has been used in parametric design and optimisation of solid pharmaceutical tablets in cylindrical and spherical shapes (Ahmat et al. 2014), facial geometry parameterisation (Sheng et al. 2011), cyclic animation (Gonzalez Castro et al. 2010), and real-time aircraft design (Athan et al. 2009).

2.2 NURBS as an industrial standard of CAD, CAM and CAE

NURBS originates from B-spline technology and plays an important role in the CAD, CAM and CAE world. The description of NURBS was first given by Versprille KJ (1975) who extended B-splines to rational B-splines in 1975. By understanding the advantages of NURBS for geometry representation and design, Boeing proposed it as part of the standard to the 1981 International Graphics Exchange Standard meeting, and many companies, such as Structural Dynamics Research Corporation and Intergraph Corporation, started to develop modellers and systems based on NURBS in the 1980s (Piegl 1991). Because of the useful geometric properties, NURBS become part of many national and international standards such as IGES (Kennicott 1996), PHIGS (ISO/IEC 1997) and STEP (ISO 2003) for the representation, design, and data exchange of geometric information.

2.3 Surface representation conversion

Converting other types of surfaces into NURBS surfaces is most often required since NURBS has become an industrial standard in CAD, CAM and CAE, especially in the field of reverse engineering. The key issue in the conversion is to solve NRUBS fitting. In general, fitting is usually achieved with polynomial approximation, which involves the minimization of an error at discrete data points. Depending on the application domain and the expected type of error, different norms can be selected for the minimization process such as \(l_1\), \(l_2\) and \(l_3\) norms (Heidrich et al. 1996). The least-square (\(l_2\) norm) is usually applied in NURBS fitting. Ma and Kruth (1998) presented an algorithm for NURBS curves and surfaces fitting from freeform objects based on least squares fitting. The basic idea is to identify weights of the control points by applying symmetric eigenvalue decomposition techniques and then establish the control points in a similar way. Based on this identified method of weights, Saini and Kumar (2014) proposed a method to reconstruct surfaces from arbitrary perspective images using a NURBS model, and Kruth and Kerstens (1998) described NURBS surface fitting from a cloud of points subject to the incorporation of sufficient boundary conditions. Through determining the knot vectors, selecting the degrees, calculating the weights, and constructing an initial NURBS surface, Yin (2004) provided a new algorithm for fitting NURBS surfaces to scattered points using minimization of deviation under boundary constraints. By letting ordered measured points be control points and using least squares minimization, Dan and Lancheng (2006) developed a new conversion method which modifies a constructed surface to obtain a desired fitted surface.

2.4 Optimization methods

NURBS consists of multi-parameters: control points, knots and weights which make the conversion task become a multi-variable nonlinear optimization problem involving large amount of data. In order to find a good NURBS model from large amount of data, Erkan Ulker (2012) applied the heuristic of artificial immune system for global optimization to find a smooth curve and the optimization of the NURBS weights and the knot vector. Jing et al. (2009) used a simulated annealing method to optimize weights and knot parameters of NURBS for curve and surface fitting. The genetic algorithm (GA) is a common multi-variables optimization method. Limaiem et al. (1996) applied genetic algorithms to obtain control point and knot values optimization, and proposed a new method for curve and surface approximation from scanned data points. Similarly, Yoshimoto et al. (1999) and Sarfraz (2004) applied GA to optimize both the knots and the weights of control points for curves and surfaces.

3 Overview of the proposed method

For complicated and large-scale objects such as high-speed train heads to be considered in this paper, plenty of control points are required to describe its shape. This will introduce many design variables and increase the need of storage capacity. If the weights of control points are also involved in the optimization calculations, independent design variables will be significantly increased. Too many control points and weights will lead to a large search space, greatly reduce computational efficiency, increase the difficulty in finding optimal converted NURBS surfaces. In the following applications of aerodynamic simulation-based optimization, they will also cause heavy calculations and make the optimal shape hard to obtain. Therefore, the aim of the optimal conversion from PDE surface-represented train heads to NURBS surface-represented train heads should look for the minimum design variables and weights while satisfying the required conversion accuracy \(\varepsilon\). We introduce two new ideas to achieve this aim. First, we approximate a lot of weights with a weight deformation discussed in Sect. 5.2.1 to noticeably reduce the number of weights. Second, we minimize the number of control points to decrease total control points while still satisfying the required conversion accuracy \(\varepsilon\).

Including the weight deformation and the number and positions of control points in a same optimization objective function will greatly increase the computational complexity of the optimal conversion. When the total number of control points is known, the errors between PDE surfaces and NURBS surfaces can be minimized with the least square method to obtain the optimal positions of control points. Therefore, the complicated optimal conversion problem can be converted into two simple interlinking sub-problems: (1) obtaining the minimum number of control points and optimal weight deformation, and (2) determining the optimal positions of control points. The genetic algorithm (GA) is commonly used to generate high-quality solutions to optimization and search problems. In this paper, we employ GA to determine the minimum number of control points and the optimal weight deformation and combine it with the least squares method to obtain the optimal conversion from PDE surface-represented train heads to NURBS surface-represented train heads.

As shown in Fig. 1, the proposed method can be divided into three steps: (1) PDE surface-based train head modelling, (2) NURBS surface formulation, and (3) Genetic algorithm-based optimal conversion. In (1) PDE surface-based train head modelling, a complicated train head (Fig. 1: left image of the top row) is first decomposed into a number of simple parts (second image from the left in top row), each part is described with a PDE surface patch (third image from the left in top row) obtained from the finite difference solution of a vector-valued partial differential equation (1) below, and all the PDE surface patches are automatically and smoothly stitched together to represent the whole train head model (right image in top row). In (2) NURBS surface formulation, the discrete vertices of each PDE surface patch are extracted, the number of control points and weight deformation obtained from the genetic algorithm are input to define a NURBS surface with unknown control points, and the least square method is introduced to minimize the errors between the PDE surface and NURBS surface and determine the optimal positions of control points. In (3) Genetic algorithm-based optimal conversion, the maximum error between the PDE surface and the corresponding NURBS surface obtained from the least squares method is first calculated. If the maximum error satisfies the required conversion accuracy \(\varepsilon\), i. e., maximum error \(\le \varepsilon\), the optimal NURBS-represented train head is obtained for further applications in CAD, CAM and CAE and the optimization calculations terminate. If the maximum error is larger than \(\varepsilon\), the genetic algorithm will find new number of control points and weight deformation and replace the previous input variables with them in second step. The new variables are input into the least squares minimization to determine the new positions of control points.

Fig. 1
figure 1

Framework of our method

4 PDE-based surfaces of high-speed train heads

Since the geometric shape of a high-speed train head is complicated, it cannot be accurately described with one PDE-based surface patch. Therefore, we divide a train head into some simple parts according to their shape changes, and use one PDE-based surface patch to describe each of the parts.

PDE-based surface modelling can take different forms such as PDEs of the second, fourth and sixth orders (You et al. 2013). It was found that the higher the order of a PDE, the smoother between two adjacent PDE surfaces and the more powerful in creating and manipulating geometric models, but the less efficient of the calculations and the harder it is to be solved (Zhang and You 2004). Since a second order PDE cannot ensure the tangent continuity between two adjacent PDE surface patches, we apply a fourth order PDE for our applications, which can be written as:

$$a_1\left( \frac{\partial ^{4}f}{\partial u^{4}}\right) +a_2\left( \frac{\partial ^{4}f}{\partial u^{2}\partial v^{2}}\right) +a_3\left( \frac{\partial ^{4}f}{\partial v^{4}}\right) =0$$
(1)

where \(f(u,v)=(x(u,v),y(u,v),z(u,v))\) represents the generated surface, \(a_1\), \(a_2\) and \(a_3\) are user defined shape parameters, and u and v are parametric variables which are the independent variables used in parametric equations to express the location of a point (xyz) on a surface by determining each of the coordinates x, y, and z separately, i. e., \(x=x(u,v)\), \(y=y(u,v)\) and \(z=z(u,v)\) with u and v usually defined by \(0\le u\le 1\) and \(0\le v\le 1\).

A PDE surface patch is defined by the solution to the vector-valued partial differential equation (1) subjected to boundary conditions such as boundary curves, boundary tangents and boundary curvature. Compared to polygon and other patch-based modelling which involve a lot of design variables, the design variables defining a \(C^1\) continuous PDE surface patch only involve few design variables, i. e., three shape parameters in PDE (1), and boundary curves and the first derivatives on the boundaries. Since the analytical solution to PDE (1) is usually not a simple polynomial function, a PDE surface patch can describe a more complicated shape than other geometric methods. Therefore, PDE-based geometric modelling can use few design variables to represent a complicated 3D model.

The solution of a PDE can be analytical or numerical methods. The analytical method, representing PDE surfaces by continuous functions, is usually applicable to low order or simple PDE. Although the numerical method is computationally more complicated and expensive, it is more powerful than the analytical method. When converting analytical PDE surfaces into NURBS surfaces, we are still required to calculate the errors between the discretized version of analytical PDE surfaces and NURBS surfaces. Therefore, this paper will investigate optimal conversion between discrete points of PDE surfaces and NURBS surfaces. The finite difference method is ideal in generating discrete points of PDE surfaces. Here we briefly introduce such a method.

A typical \(I\times J\) grid of the finite difference method is shown in Fig. 2. The small dots and squares represent the unknown inner nodes and the known boundary nodes of a PDE surface patch, respectively. The small triangles represent the virtual nodes beyond the boundaries of the PDE surface patch. The virtual nodes will be involved in the finite difference equations of the first partial derivatives on the boundaries and used to guarantee the boundary tangent continuity.

Fig. 2
figure 2

Typical finite difference grid

Based on the Taylor series expansion of a function f, the central-difference approximation of \(\frac{\partial f_{i,j}}{\partial u}\) and \(\frac{\partial f_{i,j}}{\partial v}\) at the typical node (ij) can be formulated below:

$$\frac{\partial f_{i,j}}{\partial u}= \frac{1}{2h}(f_{i,j+1}-f_{i,j-1})$$
(2)
$$\frac{\partial f_{i,j}}{\partial v}= \frac{1}{2h}(f_{i+1,j}-f_{i-1,j})$$
(3)

where h denotes the grid interval.

The central difference approximations of the fourth partial derivatives can be derived from Eqs (2) and (3). They can be written as:

$$\frac{\partial ^{4}f_{i,j}}{\partial u^{4}}= \frac{1}{h^4}[6f_{i,j}-4(f_{i,j-1}+f_{i,j+1}) +(f_{i,j-2}+f_{i,j+2})]$$
(4)
$$\frac{\partial ^{4}f_{i,j}}{\partial v^{4}}= \frac{1}{h^4}[6f_{i,j}-4(f_{i-1,j}+f_{i+1,j}) +(f_{i-2,j}+f_{i+2,j})]$$
(5)
$$\begin{aligned}\frac{\partial ^{4}f_{i,j}}{\partial u^{2}\partial v^{2}}&= \frac{1}{h^4}[4f_{i,j}-2(f_{i-1,j}+f_{i+1,j}+f_{i,j-1}+f_{i,j+1})\nonumber \\ &\quad +(f_{i-1,j+1}+f_{i-1,j-1}+f_{i+1,j+1}+f_{i+1,j-1})] \end{aligned}$$
(6)

where \(i=3,4,...,I-2\), \(j=3,4,...,J-2\). Substituting Eqs (4), (5) and (6) into (1), we obtain the following vectorial finite difference equation of the PDE (1) at the inner node (ij) :

$$\begin{aligned}&(6a_1+4a_2+6a_3)f_{i,j}-(4a_1+2a_2)f_{i,j+1}-(2a_2+4a_3)f_{i+1,j}\nonumber \\&\quad -(4a_1+2a_2)f_{i,j-1}-(2a_2+4a_3)f_{i-1,j} +a_{2}f_{i-1,j+1}+a_{2}f_{i+1,j+1}\nonumber \\&\quad +a_{2}f_{i+1,j-1}+a_{2}f_{i-1,j-1}+a_{1}f_{i,j+2}+a_{3}f_{i+2,j} +a_{1}f_{i,j-2}+a_{3}f_{i-2,j}=0 \end{aligned}$$
(7)

After the boundary conditions, i. e., positions and the first partial derivatives of the function f with respect to the parametric variable u and v on the boundaries of the PDE surface patch, are specified by users, they can be converted into the finite difference equations by using Eqs. (2) and (3) to change them into the finite difference approximations. Making use of the first partial derivatives on the boundaries, the virtual nodes beyond the boundaries are represented with the inner nodes next to the boundaries. The finite difference equations of the boundary conditions together with Eq. (7) can be written in a matrix form below:

$$[A]\left\{ Q \right\} =\left\{ E \right\}$$
(8)

where [A] is an \(I\times J\) by \(I\times J\) coefficient matrix. \(\left\{ Q \right\}\) is a column vector of the discrete vertices of the PDE surface patch. \(\left\{ E \right\}\) is a column vector involving boundary points and tangents. Since the matrix [A] is square and nonsingular, the PDE surface patch is obtained directly by matrix inversion:

$$\left\{ Q \right\} =[A]^{-1}\left\{ E \right\}$$
(9)

5 Optimal NURBS conversion method

Non-uniform rational B-splines (NURBS) are commonly supported by CAD, CAM, and CAE systems and have already become part of numerous industry wide standards. A NURBS surface of degree p in the u direction and degree q in the v direction can be expressed as (Piegl and Tiller 1997):

$$S(u,v)=\sum _{i=0}^n\sum _{j=0}^m R_{i,j}(u,v)P_{i,j} \quad (0\le u\le 1; 0\le v\le 1)$$
(10)

where \(P_{i,j}\) are \((m+1)\times (n+1)\) control points of the NURBS surface, and \(R_{i,j}(u,v)\) are piecewise rational basis functions, which are defined as:

$$R_{i,j}(u,v)=\frac{N_{i,p}(u)N_{j,q}(v)w_{i,j}}{\sum _{\bar{i}=0}^n\sum _{\bar{j}=0}^m N_{\bar{i},p}(u)N_{\bar{j},q}(v)w_{\bar{i},\bar{j}}}$$
(11)

In the above equation, \(w_{i,j}\) and \(w_{\bar{i},\bar{j}}\) are the weights, and \(N_{i,p}(u)\), \(N_{j,q}(v)\), \(N_{\bar{i},p}(u)\) and \(N_{\bar{j},q}(v)\) are the non-rational B-spline functions defined on the knot vectors:

$$\begin{aligned}U&= \left\{ \underbrace{ 0,\ldots ,0 }_{p+1}, u_{p+1},\ldots ,u_{r-p-1}, \underbrace{ 1,\ldots ,1 }_{p+1}\right\} \end{aligned}$$
(12)
$$V= \left\{ \underbrace{ 0,\ldots ,0 }_{q+1}, v_{q+1},\ldots ,v_{s-q-1}, \underbrace{ 1,\ldots ,1 }_{q+1}\right\}$$
(13)

where \(r=n+p+1\) and \(s=m+q+1\).

Taking the parametric variables u and v to be the same values as those at the finite difference nodes, i. e., \(u=u_k\) and \(v=v_k\) with \(k=(i-1)J+j\) where i and j are shown in Fig. 2, we use \(R_{kl}\)\((k=1,2,...,K;l=1,2,...,L)\) to represent \(R_{i,j}(u_k,v_k )\) with \(K=I\times J\) to be the total number of the finite difference nodes and L to be the total number of control points, i. e., \(L=(m+1)\times (n+1)\). After replacing the control point \(P_{i,j}\) (\(i=0,1,2,...,n\); \(j=0,1,2,...,m\)) in Eq. (10) with the symbol \(P_l\), Eq. (10) can be written in a matrix form as follows:

$$\begin{aligned} \begin{bmatrix} S_1\\ S_2\\ \vdots \\ S_K \end{bmatrix}= \begin{bmatrix} R_{11}&R_{12}&\cdots&R_{1L}\\ R_{21}&R_{22}&\cdots&R_{2L}\\ \vdots&\vdots&\ddots&\vdots \\ R_{K1}&R_{K2}&\cdots&R_{KL} \end{bmatrix} \begin{bmatrix} P_1\\ P_2\\ \vdots \\ P_L \end{bmatrix} \end{aligned}$$
(14)

or

$$\{S\}=[R]\{P\}$$
(15)

5.1 Least squares fitting

The least squares method is a standard approach in regression analysis which is used to find the best fit to a dataset. It is widely applied in reverse engineering. With the least squares method, the sum of the squared errors between a PDE surface patch and its corresponding NURBS surface patch at the finite difference nodes can be written as:

$$f=\sum _{k=1}^K\left| Q_{k}-S_{k}\right| ^{2}$$
(16)

where \(Q_k\) and \(S_k\) are \(k^{th}\) element of the column vector \(\{Q\}\) and \(\{S\}\) which represents the \(k^{th}\) discrete vertex of a PDE surface patch and a NURBS surface patch respectively.

Introducing Eqs. (9) and (15) into the above equation, Eq. (16) is transformed into the following form:

$$f=\sum _{k=1}^K\left| [A]_{k}^{-1}\{E\}-[R]_{k}\{P\}\right| ^{2}$$
(17)

where \([A]_k^{-1}\) is the \(k^{th}\) row of the matrix \([A]^{-1}\), \(\{E\}\) is the column vector given in Eq. (9), \([R]_k\) is the \(k^{th}\) row of the matrix [R] , and \(\{P\}\) is the column vector given in Eq. (15).

With the least squares method, we have \(\frac{\partial f}{\partial P_l}=0\) (\(l=1,2,...,L\)) which converts Eq. (17) into the following normal equations.

$$[R]^{T}[A]^{-1}\{E\}=[R]^{T}[R]\{P\}$$
(18)

Solving the above equations, the positions of all the unknown control points of the NURBS surface patch is obtained.

5.2 Genetic algorithm

The accuracy of the converted NURBS surface depends on the number of control points: more control points will lead to more accurate calculations which make the converted NURBS surface closer to the PDE surface. Therefore, we need to find enough control points which make the converted NURBS surface satisfy the required conversion accuracy. Since increasing control points will introduce more design variables, cause more storage capacity, and raise the computational cost in both conversion process and following applications, it is important to find the least control points which not only minimize the number of design variables but also satisfy the required conversion accuracy \(\varepsilon\).

Apart for control points, weights of a NURBS surface also affect the conversion accuracy. As shown in Eqs. (10) and (11), one control point has one weight. If all the weights are taken to be design variables, the optimization calculation cost will greatly increase and the optimal conversion will be more difficult to obtain. To tackle this problem, a curve deformation algorithm is proposed in Sect. 5.2.1 to change all the weights into a single weight deformation.

The genetic algorithm is very efficient in random search to solve unclear and complex problems. This paper uses it to find the minimum number of control points and the optimal weight deformation and combine it with the least squares method which is used to determine the most suitable positions of control points for the optimally converted NURBS surface. The basic structure of a genetic algorithm is shown in Fig. 3.

Fig. 3
figure 3

The basic structure of the genetic algorithm

5.2.1 Design variables

As discussed above, the number of control points and weight deformation are chosen to be design variables. Inspired by the algorithm of deforming a curve discussed in Yu et al. (2013), we propose a new weight deformation algorithm to deform a surface. It transforms multiple weight variables into a single weight deformation, makes the deformation bigger and bigger when moving from the boundaries to the centre of a NURBS surface, and has no effects on the four boundaries of a NURBS surface patch to ensure the continuity between adjacent NURBS surface patches. The deformation algorithm is given by

$$w_{i,j}=\bar{w}_{i,j}\left( 1+dw\frac{(i-1)(n-i)}{(i-1)^{2}+(n-i)^{2}}\times \frac{(j-1)(m-j)}{(j-1)^{2}+(m-j)^{2}}\right)$$
(19)

where \(\bar{w}_{i,j}\) and \(w_{i,j}\) are original and new weight respectively, \(n+1\) and \(m+1\) are the numbers of weights in the u direction and v direction respectively, and dw is the weight deformation.

Figure 4 shows an example how the weight deformation changes the shape of a NURBS surface. When dw is 0, the weights of all control points are equal to 1 (\(w_{i,j}=1\)). It means the NURBS surface becomes a B-spline surface. Therefore, the geometric meaning of weight deformation is to adjust the concavity (\(dw<0\)) and convexity (\(dw>0\)) of a B-spline surface.

Fig. 4
figure 4

Effects of the weight deformation on a NURBS surface

The least number of control points of a NURBS surface is related to the degree p in the u direction and degree q in the v direction. For a NURBS surface of the degree p with \(n+1\) control points in the u direction, its knot vector has \(n+p+2\) knots. Since the knot vector is non-periodic and the first and last knots have multiplicity \(p+1\), the number of control points must satisfy \(n+1\ge p+1\). Similarly, in the v direction, the number of control points must satisfy \(m+1\ge q+1\). Thus, for a NURBS surface, the least number of control points is \((p+1)\times (q+1)\). In addition, the maximum number of control points is equal to K which is the total number of discrete vertices of NURBS surface. Therefore, the input range of the number of control points is between \((p+1)\times (q+1)\) and K.

There is no strict limitation for the range of weight deformation, except that it needs to include the value of zero. A wider range of weight deformation produces more precise results but causes more computing time. On the other side, when the value of weight deformation is very large or small, the shape of surface is nearly unchanged. Therefore, after a dozen experiments, we find a suitable range of weight deformation which is \([-4, 30]\).

After the ranges of the number of control points and weight deformation have been specified, they are represented by a set of strings coded in binary.

5.2.2 Objective function

Since Eq. (9) determines a PDE surface patch represented by the column vector \(\{Q\}\) and Eq. (15) describes the corresponding NURBS surface patch represented by the column vector \(\{S\}\), we can obtain the difference between the two surface patches by calculating the errors of the two surface patches at the finite difference nodes i (\(i=1,2,3,\cdots ,K\)) which is the Euclidean distances \(d(Q_i,S_i)\) where \(Q_i\) is the \(i^{th}\) element of the column vector \(\{Q\}\) and \(S_i\) is the \(i^{th}\) element of the column vector {S}. The optimization objective function is to find the minimum number of control points and the optimal weight deformation which minimize the maximum error between the PDE surface patch and its corresponding NURBS surface patch. Once the maximum error satisfies the required conversion accuracy \(\varepsilon\), the genetic algorithm terminates and the optimal NURBS surface patch is obtained. Therefore, the optimization objective function can be formulated as:

$$\begin{aligned} \begin{aligned} \mathop {\arg \min }_{cp,dw} \ \,&| \varepsilon _{max} (cp,dw)-\varepsilon | \\ subject\ to\ \,&\varepsilon _{max}(cp,dw)\le \varepsilon \\ \end{aligned} \end{aligned}$$
(20)

where

$$\begin{aligned} \varepsilon _{max}(cp,dw)= \mathop {\max }_{1\le i\le K} \left\{ \dfrac{1}{L}_s d(Q_i,S_i)\right\} \end{aligned}$$
(21)

where cp and dw are design variables that are the number of control points and the weight deformation, respectively, and \(L_s\) is the shortest distance between any two points of the PDE surface. The reason why we choose the shortest distance is to measure the distance between the PDE surface patch and the NURBS surface patch under the same order of magnitude of the PDE surface.

5.2.3 Genetic operators

The basic structure of the genetic algorithm is shown in Fig. 3. The transition from one generation to the next one consists of four basic components (Bodenhofer 2004):

  1. 1)

    Selection: The selection process selects individuals for reproduction according to their fitness. In this paper, the individuals are the binary strings of the number of control points and the weight deformation, and the fitness is the objective function value.

  2. 2)

    Crossover: Crossover is a probabilistic process that merges the genetic information of two selected individuals and produces next generation.

  3. 3)

    Mutation: mutation is a random deformation of the strings with a certain probability. It mutates a bit position (genes) of binary representation of chromosomes by simply flipping its value at random. The positive effect is preservation of genetic diversity and avoidance of local maxima.

  4. 4)

    Sampling: The sampling process computes a new generation from the previous one and its offspring.

6 Applications

As a demonstration of the proposed method, we here present an example of converting the PDE surface patches of a simplified high-speed train head into optimal NURBS surface patches. To obtain the NURBS-represented train head, the first step is to represent a high-speed train head with a number of PDE-based surface patches. Since the high-speed train head is a symmetrical structure, there is no need to use whole PDE-based surface patches for representing the shape of train head. Thus, we can create the half of train head by PDE-based surface patches, and then obtain the whole shape of the PDE-based train head by symmetry. The patches of the half of the train head are then converted to optimal NURBS surface patches which are assembled to represent a complete NURBS surface-represented train head. The conversion process is shown in Fig. 5.

Fig. 5
figure 5

Process of conversion

For illustrative purposes, we divide the half of a high-speed train head into twenty-two surface patches according to shape changes. The whole train head includes forty-four surface patches, which are shown in Fig. 5. The twenty-two surface patches are converted to optimal NURBS surface patches by our proposed method. The flowchart of the optimal conversion is shown in Fig. 6.

Fig. 6
figure 6

Flowchart of the optimal conversion

The flowchart includes three steps. First, the coordinate values and u and v values of the twenty-two PDE surface patches of the train head at the finite difference nodes together with a required conversion accuracy and GA variables (the number of control points and weight deformation) are input to the algorithm of least squares surface fitting to determine the optimal positions of control points of the converted NURBS surface patches. Second, the genetic algorithm is applied to minimize the objective function and obtain the new number of control points and weight deformation. Third, whether the maximum error is smaller than the required conversion accuracy is checked. If yes, the optimal NURBS surface patches are obtained and the genetic algorithm terminates. Otherwise, the new number of control points and weight deformation are input to the algorithm of least squares surface fitting to determine new optimal positions of control points.

In this example, we take the required conversion accuracy \(\varepsilon\) to be \(1\%\) (\(\varepsilon =1\%\)). The optimal number of control points and weight deformation for the twenty-two NURBS surface patches of the high-speed train head are given in Table 1. In order to visualize the errors between the PDE surface patches and the obtained optimal NURBS surface patches, the errors are represented with different colours in Fig. 7. In the figure, the lighter colours mean smaller errors whereas the darker colours mean bigger errors.

Table 1 Optimal number of control points and weight deformation (\(\varepsilon =1\%\))
Fig. 7
figure 7

Visualization of the errors between the PDE surface patches and NURBS surface patches

Since we set \(\varepsilon =1\%\), the minimized maximum errors should be between 0 and 0.01, i. e., \(0\%\le \varepsilon _{max} (cp,dw)\le 1\%\) . Fig. 7 indicates that all the errors are in the range. Among them, the maximum error of patches 4, 8, 11, 12, 17, and 21 reaches the upper limit of the range which is 1%, and the maximum error of patches 13 and 20 is 0.38% and 0.32%, respectively which are minimal.

For the whole train head, the errors between the PDE representation and NURBS representation are visualised in Fig. 8. In this figure, (a) is the original PDE surface-represented train head, (b) is optimally converted NURBS surface-represented train head, and (c) uses different colours to visualize the errors between the original PDE surface-represented train head and the optimally converted NURBS surface-represented train head. The images given in the figure clearly shows the errors for all the surface patches are not more than 1%.

The above discussions indicate that the developed method is very effective in obtaining the optimal conversion from the PDE surface-represented train head to the NURBS surface-represented train head.

Fig. 8
figure 8

Error comparison between the original PDE surface-represented (a) and NURBS surface-represented (b) high-speed train head where (c) uses different colours to visualize the errors between them

In order to investigate the effects of the required conversion accuracy \(\varepsilon\) and weight deformation, we set \(\varepsilon\) to 0%, 1%, 2%, 5% and 10%, respectively, and consider two cases: one with fixed weights \(w_{i,j}=1\) (Brujic 2002; Xiao 2005), and the other with the optimal weight deformation. The obtained results are depicted in Fig. 9 where the blue curve is from the optimal conversion with the fixed weight, and the pink curve is from the optimal conversion with the optimal weight deformation.

Fig. 9
figure 9

Effects of the required conversion accuracy and weight deformation

Figure 9 shows the total number of control points for the 22 NURBS patches of the half of the train head linearly decreases with the increase of the required conversion accuracy for both cases. The linear decrease when the required conversion accuracy is less than 1% is larger than the linear decrease when the required conversion accuracy is more than 1%. When the required conversion accuracy \(\varepsilon\) is 0%, 1%, 2%, 5% and 10%, the minimum control points for the optimal conversion with fixed weights are 2956, 2060, 1635, 1239 and 903 respectively, and the minimum control points for the optimal conversion with weight deformation are 2956, 1939, 1559, 1172 and 848 respectively, indicating the application of the weight deformation can decrease the number of control points to some extent. Compared to the minimum control points obtained by the optimal conversion with the fixed weights, the optimal conversion with the optimal weight deformation reduces the minimum control points by 0%, 5.87%, 4.65%, 5.41% and 6.09% respectively. When \(\varepsilon =0\%\), the errors at the finite difference nodes between the PDE surface patches and the corresponding NURBS surface patches are zero, and Eq. (17) becomes\([A]_{k}^{-1}\{E\}-[R]_{k}\{P\}=0\) (\(k=1,2,3,\ldots ,K\)). That is, we solve the K equations to determine K control points. Therefore, the number of control points is always K whether the fixed weights or the weight deformation are considered. When the required conversion accuracy increases from 0% to 1%, 2%, 5% and 10% , the total control points are reduced by 34.40%, 47.26%, 60.35% and 71.31% for the optimal conversion with the optimal weight deformation which indicate setting the required conversion accuracy to a high value will greatly decrease the number of control points. Therefore, proper selection of the required conversion accuracy is very important for reducing the number of control points.

7 Conclusion

A new method of converting a PDE surface-represented high-speed train head into optimal NURBS surfaces has been developed in this paper. How to use the finite difference method to obtain PDE surface-represented high-speed train heads is investigated. A new 3D weight deformation method is proposed to transform many weights into a single weight deformation for significant reduction of design variables. The least squares fitting method and genetic algorithm are combined to optimally convert PDE surface patches to NURBS surface patches which satisfy the required conversion accuracy with minimum control points.

We have demonstrated this method by presenting an example of converting PDE surfaces of a high-speed train head into NURBS surfaces. The example indicates that the developed method is able to obtain an optimal NURBS surface-represented high-speed train head with high accuracy and minimum control points.

We have also investigated the influences of the required conversion accuracy and weight deformation on the optimal conversion. Since a high value of the required conversion accuracy can greatly reduce control points, it is very important to properly specify the required conversion accuracy to minimize control points. By comparing the optimal conversion with fixed weights and that with the optimal weight deformation, it can be concluded that introduction of the weight deformation can further lower the number of control points.