Mixed-Fidelity Design Optimization of Hull Form Using CFD and Potential Flow Solvers

The present paper proposes a new mixed-fidelity method to optimize the shape of ships using genetic algorithms (GA) and potential flow codes to evaluate the hydrodynamics of variant hull forms, enhanced by a surrogate model based on an Artificial Neural Network (ANN) to account for viscous effects. The performance of the variant hull forms generated by the GA is evaluated for calm water resistance using potential flow methods which are quite fast when they run on modern computers. However, these methods do not take into account the viscous effects which are dominant in the stern region of the ship. Solvers of the Reynolds-Averaged Navier-Stokes Equations (RANS) should be used in this respect, which, however, are too time-consuming to be used for the evaluation of some hundreds of variants within the GA search. In this study, a RANS solver is used prior to the execution of the GA to train an ANN in modeling the effect of stern design geometrical parameters only. Potential flow results, accounting for the geometrical design parameters of the rest of the hull, are combined with the aforementioned trained meta-model for the final hull form evaluation. This work concentrates on the provision of a more reliable framework for the evaluation of hull form performance in calm water without a significant increase of the computing time.


Introduction
Hydrodynamic hull form optimization is a very demanding task in terms of computer and time resources. In general, it is a multi-disciplinary process to take into account resistance, propulsion, seakeeping, and maneuvering characteristics of a vessel related to different sea states and wind directions as stated in Grigoropoulos et al. [1,2]. However, even in the single objective case, where only calm water resistance is handled, the use of fine grids for CFD evaluation is too time-consuming to be used in all steps of optimization via a Genetic Algorithm (GA). In this respect, metamodels or surrogate models have been widely used in several engineering contexts, such as structural optimization, aeronautics, aerospace and ground or waterborne vehicles, including stochastic applications and uncertainty quantification.
Thus, the necessity to reduce the computational effort in the optimization process without sacrificing the accuracy of the outcome has led to the extensive use of metamodels. The latter are based on the number of high-fidelity evaluations required, since the computational cost of the resulting algorithms is highly reduced [3]. Typical surrogate models are polynomial regression, kriging method, artificial neural networks (ANN), support vector machines (SVM), or radial basis functions (RBF) [4][5][6].
Once built, they are very fast (split seconds vs. hours of simulation). Of course, it is imperative to be ensured that a chosen surrogate model approximates the simulation sufficiently well to replace them for the design task at hand, at least at the level needed for engineering purposes at early stages when trends and dependencies need to be understood [7].
There are various ways to incorporate metamodels within an EA, so there are various metamodel-assisted evolutionary algorithms (MAEAs). Many relevant papers are based on the use of offline trained metamodels, i.e., metamodels which are trained separately from the evolution. On the other hand, in the variant of metamodel-assisted EAs (MAEAs) with online trained metamodels, these are trained on the fly separately for each new population member [8].
This paper proposes a mixed methodology to optimize the hull form for resistance in calm water, using both potential and viscous flow codes, both with grids of suitable density utilizing a limited number of viscous evaluations carried a priori (offline) to formal optimization. It is well known that potential flow codes implementing Boundary Element Method (BEM) are quite efficient and reliable in modeling the effect of various geometrical design parameters on the hydrodynamic performance of ships in calm water for the major part of the hull form except for the stern region. In the latter area, the viscous phenomena dominate and the potential flow modeling is poor. The 3D, time domain, and Rankine source potential flow code SWAN2 2002 is used for the potential flow calculation of the wave making resistance R w . The potential flow results for the bow and the middle part of the hull form are combined with a surrogate model based on an ANN trained by viscous flow results to account for the effect of the stern local design parameters on its hydrodynamic performance. The in-house (U)RANS solver MaPFlow, described in detail in Papadakis et al. [9,10], a cell centered CFD Solver that uses both structured and unstructured grids, is suitable for the viscous flow calculations.
On the basis of the aforementioned discussion, an Artificial Neural Network (ANN) is established to account for the effect of the stern only geometrical parameters, assuming the parent form for the rest of the hull. This methodology assumes that the effect of the stern design parameters on the performance of the whole hull is not altered significantly when the bow and the middle design variables are modified. In other words, this assumption is expressed in terms of the (at least partial) independence of the effects of the stern design variables from the rest ones. This assumption is verified by the comparison of the performance of the parent and the optimized hull using viscous flow calculations. A further check is also included in the paper to verify the reliability of the ANN.
It is expected that a small number of variants of the stern hull form geometry as evaluated by MaPFlow provide sufficient and reliable training to the ANN. The number of the required evaluations depends, of course, on the hull form, magnitude of variances and the complexity of vessel shape in the stern region. The latter is responsible for the number of the geometrical parameters that should contribute to the hull form optimization.
To be more specific, the mixed fidelity optimization procedure, presented in this paper, is performed in two separate steps, firstly, for the stern region and following for the middle and bow region. Once, the ANN is trained sufficiently to constitute a reliable metamodel, the first optimization step consists of ANN function's minimization, in order to derive the combination of stern parameters that minimize hull viscous resistance R TOTAL , as predicted by the ANN. On the second step, the bow and middle ship geometrical variables are optimized while maintaining the parent form for the stern of the hull in order to minimize wave resistance R w . Finally, all the geometrical variables, those in the bow and the middle section of the hull, as well as those in the stern region, as tuned by the two optimization cycles are combined in one fair hull. This final hull is evaluated by direct comparison with CFD modeling employing a grid of the same density. The KRISO Container Ship (KCS) has been used as a test case.
The major contribution of the work is that limited viscous flow calculations are carried out a priori (offline) to train the ANN in order to model efficiently stern viscous effects which dominate in relatively low Froude numbers, such as in the case examined. In this way, a reliable optimization framework is achieved with minimum resources to estimate stern viscous pressure effects, encompassing at the same time the advantages of potential flow codes to guide the optimization of the rest of the hull form for wave resistance.

Hydrodynamic Hull Form Optimization
The problem of hydrodynamic hull form optimization, focusing on its performance in calm and rough water, has been studied since the early 1980s by many authors. The use of parametric models with genetic algorithms to carry out a dual objective optimization for calm water resistance and seakeeping is described in detail by Grigoropoulos et al. [11].
The methodology is ruled out by the reliability of the computer codes used for the evaluation of the hydrodynamic performance of the variant hull forms and resources needed. They actually drive the optimization algorithm to a realistic optimum solution. Although viscous flow calculations provide more reliable estimates of calm water performance, they are too time-consuming to be used in each of the hundreds of steps of genetic algorithms. Thus, a way to tackle this difficulty is to use potential flow solvers in the optimization procedure and to verify the result by a viscous flow code. However, potential flow codes are not reliable in the stern region of the ship, where viscous flow phenomena prevail. In order to remedy this situation, it is proposed to use an Artificial Neural Network as a meta-model to account the effect of variations of the stern shape. This ANN is trained using a few runs of the viscous flow code.

Optimization Method
The problem we have to solve is an optimization problem where the displacement is allowed to vary up to 1% of its initial value. The space of the design variables' variance has been specified by trials during a preparatory stage, to ensure realistic hull form variants. The mathematical formulation of the optimization problem is as follows: w.r.t.l ≤ i ≤ u and D∆ ≤ const where R : Hull's resistance as evaluated by potential solver or ANN. i: Design variable vector; l and u are the lower and upper bounds, respectively. H i : Hull shape as affected by the changes in i parameters. Fn : Froude number of the vessel. SS : Sea state, calm water for cases evaluated. D∆ : Variation in the volume of displacement.
For the optimization process, the NSGA II (Non-Dominated Sorting Genetic Algorithm II), Figure 1, as described by Deb et al. [12], and which is provided inside CAESES software [13], is selected. The architecture of the artificial neural network used for the training is discussed in the next paragraph. Details of the genetic algorithm used in the optimization process are briefly described below: • A number of variant geometries is generated. • An equal number of off-springs is formed.

•
The total number of parents and offspring is then sorted to levels according to nondomination.

•
The geometries of each level are ranked with respect to their crowded distance of each solution in the population.

•
A new generation is being produced with a population number equal to the initial one.
step, comprised of 32 generations with 14 offspring each. In the second step, where the five bow and middle-part hull design variables were investigated, 37 generations with 24 offspring each produced in total 888 alternative hulls. The mutation and crossover probability rates were set to 0.04 and 0.92, respectively, in both cases. In both steps, the modification of the design variables is controlled by the GA, while CAESES automatically creates fair ship lines for each combination of them. The theoretical background of CEASES is described by Harries and Abt [14].

Design Modification Procedure
CAESES software has been selected for the parametric design and variation of the parent hull.
The initial geometry is represented by a set of basic curves providing topological information in the longitudinal direction (design waterline, centerline, deck-line) and a set of 32 section curves. All of them are either F-splines or B-splines. F-splines are used to describe areas or characteristic lines subjected to variation, which directly affect the geometrical hull form parameters to be optimized.
The geometry is split into three regions: the main hull, the stern region, and the bow bulb, assigning specific design variables for each of them in order to ease the optimization process. Hull form is described by different kinds of surfaces which reflect the changes at the parameters under investigation. Surfaces are generated either by interpolating the parametric-modeled section curves or by using the so-called engine curves. The approximation of the initial surfaces is very satisfactory and allows for the establishment of the eight design variables in total. Five of them refer to the bow bulb and the main hull, while the remaining three at the stem region. Figure 2 depicts the geometry delivered by CAESES software, while Figure 3 presents the control lines and the surface of the bow bulb.  For the two optimization cycles performed, an adequate number of generations and off-spring was selected in order to ensure convergence for all parameters. A total of 448 variants were evaluated concerning the three stern design variables parameters in the first step, comprised of 32 generations with 14 offspring each. In the second step, where the five bow and middle-part hull design variables were investigated, 37 generations with 24 offspring each produced in total 888 alternative hulls. The mutation and crossover probability rates were set to 0.04 and 0.92, respectively, in both cases. In both steps, the modification of the design variables is controlled by the GA, while CAESES automatically creates fair ship lines for each combination of them. The theoretical background of CEASES is described by Harries and Abt [14].

Design Modification Procedure
CAESES software has been selected for the parametric design and variation of the parent hull.
The initial geometry is represented by a set of basic curves providing topological information in the longitudinal direction (design waterline, centerline, deck-line) and a set of 32 section curves. All of them are either F-splines or B-splines. F-splines are used to describe areas or characteristic lines subjected to variation, which directly affect the geometrical hull form parameters to be optimized.
The geometry is split into three regions: the main hull, the stern region, and the bow bulb, assigning specific design variables for each of them in order to ease the optimization process. Hull form is described by different kinds of surfaces which reflect the changes at the parameters under investigation. Surfaces are generated either by interpolating the parametric-modeled section curves or by using the so-called engine curves. The approximation of the initial surfaces is very satisfactory and allows for the establishment of the eight design variables in total. Five of them refer to the bow bulb and the main hull, while the remaining three at the stem region. Figure 2  For the two optimization cycles performed, an adequate number of generations and off-spring was selected in order to ensure convergence for all parameters. A total of 448 variants were evaluated concerning the three stern design variables parameters in the first step, comprised of 32 generations with 14 offspring each. In the second step, where the five bow and middle-part hull design variables were investigated, 37 generations with 24 offspring each produced in total 888 alternative hulls. The mutation and crossover probability rates were set to 0.04 and 0.92, respectively, in both cases. In both steps, the modification of the design variables is controlled by the GA, while CAESES automatically creates fair ship lines for each combination of them. The theoretical background of CEASES is described by Harries and Abt [14].

Design Modification Procedure
CAESES software has been selected for the parametric design and variation of the parent hull.
The initial geometry is represented by a set of basic curves providing topological information in the longitudinal direction (design waterline, centerline, deck-line) and a set of 32 section curves. All of them are either F-splines or B-splines. F-splines are used to describe areas or characteristic lines subjected to variation, which directly affect the geometrical hull form parameters to be optimized.
The geometry is split into three regions: the main hull, the stern region, and the bow bulb, assigning specific design variables for each of them in order to ease the optimization process. Hull form is described by different kinds of surfaces which reflect the changes at the parameters under investigation. Surfaces are generated either by interpolating the parametric-modeled section curves or by using the so-called engine curves. The approximation of the initial surfaces is very satisfactory and allows for the establishment of the eight design variables in total. Five of them refer to the bow bulb and the main hull, while the remaining three at the stem region. Figure 2 depicts the geometry delivered by CAESES software, while Figure 3 presents the control lines and the surface of the bow bulb.    The design variables of Table 1   The range of the design variables and their values for the parent hull form are presented in Table 1. The constraints of the geometrical variables have been specified by a trial and error method to reduce the number of non-realistic or, more generally, invalid variant hull forms. However, this does not mean that all the variants generated during the optimization process are realistic hulls.  The design variables of Table 1 are described in the following:   The design variables of Table 1   The range of the design variables and their values for the parent hull form are presented in Table 1. The constraints of the geometrical variables have been specified by a trial and error method to reduce the number of non-realistic or, more generally, invalid variant hull forms. However, this does not mean that all the variants generated during the optimization process are realistic hulls. The range of the design variables and their values for the parent hull form are presented in Table 1. The constraints of the geometrical variables have been specified by a trial and error method to reduce the number of non-realistic or, more generally, invalid variant hull forms. However, this does not mean that all the variants generated during the optimization process are realistic hulls.

The KRISO Containership
The characteristics and the floating conditions of the containership under investigation have been proposed by the Korean Research Organization KRISO (former MOERI), and they are given in Table 2. The service speed of the vessel has been specified to be 24 kn corresponding to Froude number 0.26. However, this vessel has not been constructed in physical scale. Only models of this hull form have been tested in towing tank facilities. In the current study, the full-scale vessel has been modeled.

Potential Flow Calculation
The 3D panel, Rankine source, time domain, linear code SWAN2 2002 [16,17] has been used to carry out the potential calculations. The mesh generation of the free-surface and the body surface of the hull is an internal routine of SWAN2 2002. The spline sheet of the body surface is defined by 45 nodes in a direction parallel to the x-axis, corresponding to a number of 44 panels and by 13 nodes on the y-axis' perpendicular. The domain of the free-surface accounted in the calculations extends 0.5 L BP upstream, 1.5 L BP downstream, and 1.0 L BP in the transverse distance (athwartships). Figure 5 presents the spline sheet of the free-surface (a) and the body (b).

Viscous Flow Calculation
Regarding the CFD solver, an in-house (U)RANS solver, MaPFlow, was employed. MaPFlow is a cell centered CFD solver that can use both structured and unstructured grids, capable of solving compressible flows, as well as fully incompressible flows using the artificial compressibility method. For the reconstruction of the flow field, a 2nd order piecewise linear interpolation scheme is used. The limiter of Venkatakrishnan [18] is utilized when needed. The viscous fluxes are discretized using a central 2nd order scheme.
Turbulence closures implemented on MaPFlow include the one-equation turbulence model of Spalart (SA) [19] as well as the two-equation turbulence model of Menter (k-ω SST) [20]. Regarding laminar to turbulent transition modeling, the correlation γ-Reθ model of Langtry and Menter [21] has been implemented.
MaPFlow can handle both steady and unsteady flows. Time integration is achieved in an implicit manner permitting large CFL numbers. The unsteady calculations use a 2nd order time accurate scheme combined with the dual time-stepping technique to facilitate convergence. MaPFlow is able to handle moving/deforming geometries through the arbitrary Eulerian Lagrangian formulation. been used to carry out the potential calculations. The mesh generation of the free-surface and the body surface of the hull is an internal routine of SWAN2 2002. The spline sheet of the body surface is defined by 45 nodes in a direction parallel to the -axis, corresponding to a number of 44 panels and by 13 nodes on the -axis' perpendicular. The domain of the free-surface accounted in the calculations extends 0.5 LBP upstream, 1.5 LBP downstream, and 1.0 LBP in the transverse distance (athwartships). Figure 5 presents the spline sheet of the free-surface (a) and the body (b). Regarding the free surface treatment, the Volume of Fluid (VOF) method is employed, and two phase flows are described by two immiscible fluids with their interface being defined implicitly as a discontinuity in the density field. The system of equations is solved in a non-segregated manner, utilizing the Kunz Preconditioner, as discussed by Yue and Wu [22], to remove density dependencies from the system's eigenvalues.
For the CFD simulations, in order to reduce the computational domain, half of the hull is resolved with symmetry conditions applied on the side. The high Reynolds number of full scale simulations poses a significant challenge for CFD simulations since fully resolved simulations are computationally prohibitive. Following a grid-independence study, a grid consisting of approximately 5 million cells is employed. In the wall region, wall functions are employed; nevertheless, a structured-like region composed of 25 layers is used around the solid boundary. Lastly, the hull was resolved using approximately 200,000 elements. A snapshot of the computational grid employed can be seen in Figure 6.

Viscous Flow Calculation
Regarding the CFD solver, an in-house (U)RANS solver, MaPFlow, was employed. MaPFlow is a cell centered CFD solver that can use both structured and unstructured grids, capable of solving compressible flows, as well as fully incompressible flows using the artificial compressibility method. For the reconstruction of the flow field, a 2nd order piecewise linear interpolation scheme is used. The limiter of Venkatakrishnan [18] is utilized when needed. The viscous fluxes are discretized using a central 2nd order scheme.
Turbulence closures implemented on MaPFlow include the one-equation turbulence model of Spalart (SA) [19] as well as the two-equation turbulence model of Menter (k-ω SST) [20]. Regarding laminar to turbulent transition modeling, the correlation γ-Reθ model of Langtry and Menter [21] has been implemented.
MaPFlow can handle both steady and unsteady flows. Time integration is achieved in an implicit manner permitting large CFL numbers. The unsteady calculations use a 2nd order time accurate scheme combined with the dual time-stepping technique to facilitate convergence. MaPFlow is able to handle moving/deforming geometries through the arbitrary Eulerian Lagrangian formulation.
Regarding the free surface treatment, the Volume of Fluid (VOF) method is employed, and two phase flows are described by two immiscible fluids with their interface being defined implicitly as a discontinuity in the density field. The system of equations is solved in a non-segregated manner, utilizing the Kunz Preconditioner, as discussed by Yue and Wu [22], to remove density dependencies from the system's eigenvalues.
For the CFD simulations, in order to reduce the computational domain, half of the hull is resolved with symmetry conditions applied on the side. The high Reynolds number of full scale simulations poses a significant challenge for CFD simulations since fully resolved simulations are computationally prohibitive. Following a grid-independence study, a grid consisting of approximately 5 million cells is employed. In the wall region, wall functions are employed; nevertheless, a structured-like region composed of 25 layers is used around the solid boundary. Lastly, the hull was resolved using approximately 200,000 elements. A snapshot of the computational grid employed can be seen in Figure  6. The span of the domain was 5 LBP in the streamwise direction, 3 LBP in the side direction, and 6 LBP in the vertical direction. On the ship hull, a no-slip condition was applied, symmetry (zero gradient in the normal direction) conditions were applied on the symmetry plane, while a freestream condition was imposed on the rest of the domain. Additionally, a damping zone was adopted to avoid reflections from the generated wave system. The span of the domain was 5 L BP in the streamwise direction, 3 L BP in the side direction, and 6 L BP in the vertical direction. On the ship hull, a no-slip condition was applied, symmetry (zero gradient in the normal direction) conditions were applied on the symmetry plane, while a freestream condition was imposed on the rest of the domain. Additionally, a damping zone was adopted to avoid reflections from the generated wave system.
Regarding the y+ values, the average y+ was 150, while a maximum of 300, and due to that, wall functions were adopted. Unfortunately, this was a mandatory compromise cost-wise in order to make full scale simulations feasible.
For all the CFD simulations, a time step of 0.1 s using a second-order implicit scheme is used which yields a convective CFL around 3. Nevertheless, it was adopted to save computational time since the flows considered here converge to a steady state. It is evident from Figure 7 that both the time step and the grid spacing selected are tuned in order to properly capture the resulting wave system. Regarding the y+ values, the average y+ was 150, while a maximum of 300, and due to that, wall functions were adopted. Unfortunately, this was a mandatory compromise cost-wise in order to make full scale simulations feasible.
For all the CFD simulations, a time step of 0.1 s using a second-order implicit scheme is used which yields a convective CFL around 3. Nevertheless, it was adopted to save computational time since the flows considered here converge to a steady state. It is evident from Figure 7 that both the time step and the grid spacing selected are tuned in order to properly capture the resulting wave system.

Artificial Neural Network (ANN)
During the last decade, the application of Artificial Neural Networks has stepped up in every scientific field. From plain vanilla networks to unsupervised deep convolutional networks, ANN is able to model or detect complex nonlinear relationships within systems without using the physics of the system. Furthermore, they are a valuable tool, since they can bridge fragmented data to efficiently identify system characteristics or make up for a lack of analytical relations within complex systems.
Artificial neural network theory is based on the analysis of biological nervous systems consisting of neurons and their connections. A mathematical model of a neural network is created, based on this structure and signal transmission. ANNs are composed of internal parameters to be specified through the process of training. Such parameters are the weights by which the inputs of each neuron are multiplied so that the corresponding output emerges. Explicitly, the output of the neuron is calculated by the sum of all the inputs, weighted by the weights of the connections from the inputs to the neuron. Additionally, a bias term is introduced to this sum. This weighted sum is often called the activation, which is, then, passed through a (usually nonlinear) activation function to produce the output. Ultimately, the output of the last neuron, subsequently the output of the model in general, is compared against actual values and the difference between predicted and real values of the same parameter is estimated through a metric function. This part of the optimization algorithm is critical. The training aims at the minimization of the mean difference, or loss as it is called in the ANN field, by updating the weights in each iteration.
In the field of naval architecture, artificial neural networks (ANN) have gained popularity. In recent years, applications of ANNs for modelling and predicting vessel hull form [23], calm water resistance [24,25], added resistance in waves [26], speed and fuel consumption [27], maneuverability qualities [28], and seakeeping characteristics [29] are presented in several studies. In most cases, the use of artificial neural networks offers satisfactory results.
Compared to the above-mentioned publications, this paper's distinctive feature lies in the relatively low number of input data available for the training of an ANN. As discussed in the Introduction, the ANN is trained with only 27 examples as input, which correspond to the 27 (=33) combinations of three values per variable, the two selected limiting ones, and the value of the parent hull for the three chosen stern geometrical variables affecting the optimization scheme. Usually, the stern design variables are two to four and

Artificial Neural Network (ANN)
During the last decade, the application of Artificial Neural Networks has stepped up in every scientific field. From plain vanilla networks to unsupervised deep convolutional networks, ANN is able to model or detect complex nonlinear relationships within systems without using the physics of the system. Furthermore, they are a valuable tool, since they can bridge fragmented data to efficiently identify system characteristics or make up for a lack of analytical relations within complex systems.
Artificial neural network theory is based on the analysis of biological nervous systems consisting of neurons and their connections. A mathematical model of a neural network is created, based on this structure and signal transmission. ANNs are composed of internal parameters to be specified through the process of training. Such parameters are the weights by which the inputs of each neuron are multiplied so that the corresponding output emerges. Explicitly, the output of the neuron is calculated by the sum of all the inputs, weighted by the weights of the connections from the inputs to the neuron. Additionally, a bias term is introduced to this sum. This weighted sum is often called the activation, which is, then, passed through a (usually nonlinear) activation function to produce the output. Ultimately, the output of the last neuron, subsequently the output of the model in general, is compared against actual values and the difference between predicted and real values of the same parameter is estimated through a metric function. This part of the optimization algorithm is critical. The training aims at the minimization of the mean difference, or loss as it is called in the ANN field, by updating the weights in each iteration.
In the field of naval architecture, artificial neural networks (ANN) have gained popularity. In recent years, applications of ANNs for modelling and predicting vessel hull form [23], calm water resistance [24,25], added resistance in waves [26], speed and fuel consumption [27], maneuverability qualities [28], and seakeeping characteristics [29] are presented in several studies. In most cases, the use of artificial neural networks offers satisfactory results.
Compared to the above-mentioned publications, this paper's distinctive feature lies in the relatively low number of input data available for the training of an ANN. As discussed in the Introduction, the ANN is trained with only 27 examples as input, which correspond to the 27 (=33) combinations of three values per variable, the two selected limiting ones, and the value of the parent hull for the three chosen stern geometrical variables affecting the optimization scheme. Usually, the stern design variables are two to four and three values per variable are sufficient to train a reliable ANN, taking into account that the variation of the variables is limited. The use of limited CFD calculations is a major advantage of the proposed methodology. The derived ANN is handled by a GA, which, after 440 evaluations, reaches the optimum combination of the stern variables.
Selection of a suitable artificial neural network structure is probably the hardest part of the problem and critical to obtaining accurate predictions. Since dealing with a regression problem, the multilayer perceptron (MLP) concept was applied consisting of an input, hidden, and output layer, as well as utilizing a backpropagation learning algorithm. The development of the ANN was performed in Python assisted by the Tensorflow/Keras neural network library.
The usual search process for the optimal neural network goes through the following steps: data normalization, division of data set, selection of ANN model architecture, and finally the assessment of ANN model results. In this study, the small number of available training data significantly hindered this process. Input data were normalized using a custom Min/Max scalar function centered around parent hull resistance value with a 20% reserve. This reserve was used in order to ease the first step of optimization process, ANN's function minimization search, by allowing us to extrapolate values beyond observed ranges. Moreover, during ANN model's training, no validation set was used. It was decided to use every data point available for the more efficient training of the network and take the risk to validate the model's prediction at the final stage of optimization procedure via CFD calculations: In order to identify the ANN architecture that is better suited to the problem, many trials were conducted with different configurations. The number of input neurons was set to three, representing the three variables set at the vessel stern region, and the output node was set to one referring to the target value of CFD calculation. The rest of the ANN configuration as determined by the number of hidden layers, the number and type of neurons that comprise each one of them, the training algorithm, learning rate, and the backpropagation optimizer method went through exhaustive numerical experiments, probably an inevitable stage when developing an ANN. An overview of the performance of the best ANN models is presented in Table 3. The number of neurons at each layer and their activation functions can also be seen. Table 3. Overview of the best ANN performance.

Code
Training Set In this work, the Mean Squared Error (MSE) function was used as the loss or cost function under minimization during models' training. Notice should be kept, though, on the Mean Absolute Error (MAE) as well. The progression of MSE and MAE values during training is presented in Figure 8. The network (N-1) that showed the lowest MSE and MAE error was selected in order to evaluate hull meta-models. It consists of the three stern parameters as inputs, two hidden layers comprised of six and four nodes, respectively, and the output layer. In our effort to overcome the problem of vanishing gradients and saddle points, the sigmoid function was used as an activation function at input, first and output layer of the network, while tanh was utilized at the second layer. Stochastic gradient descent with momentum was selected against ADAM as the backpropagation optimizer method, learning rate, and momentum were set to 0.16 and 0.7, respectively. Selected ANN model's architecture and performance are presented at Figures 9 and 10. The Pearson coefficient was calculated at 0.975.  The small size of the training data led to an increase of epochs performed in order to get satisfactory results. For the best configuration found, the number of epochs was set at The network (N-1) that showed the lowest MSE and MAE error was selected in order to evaluate hull meta-models. It consists of the three stern parameters as inputs, two hidden layers comprised of six and four nodes, respectively, and the output layer. In our effort to overcome the problem of vanishing gradients and saddle points, the sigmoid function was used as an activation function at input, first and output layer of the network, while tanh was utilized at the second layer. Stochastic gradient descent with momentum was selected against ADAM as the backpropagation optimizer method, learning rate, and momentum were set to 0. 16  The network (N-1) that showed the lowest MSE and MAE error was selected in order to evaluate hull meta-models. It consists of the three stern parameters as inputs, two hidden layers comprised of six and four nodes, respectively, and the output layer. In our effort to overcome the problem of vanishing gradients and saddle points, the sigmoid function was used as an activation function at input, first and output layer of the network, while tanh was utilized at the second layer. Stochastic gradient descent with momentum was selected against ADAM as the backpropagation optimizer method, learning rate, and momentum were set to 0.16 and 0.7, respectively. Selected ANN model's architecture and performance are presented at Figures 9 and 10. The Pearson coefficient was calculated at 0.975.  The small size of the training data led to an increase of epochs performed in order to get satisfactory results. For the best configuration found, the number of epochs was set at The network (N-1) that showed the lowest MSE and MAE error was selected in order to evaluate hull meta-models. It consists of the three stern parameters as inputs, two hidden layers comprised of six and four nodes, respectively, and the output layer. In our effort to overcome the problem of vanishing gradients and saddle points, the sigmoid function was used as an activation function at input, first and output layer of the network, while tanh was utilized at the second layer. Stochastic gradient descent with momentum was selected against ADAM as the backpropagation optimizer method, learning rate, and momentum were set to 0.16 and 0.7, respectively. Selected ANN model's architecture and performance are presented at Figures 9 and 10. The Pearson coefficient was calculated at 0.975.  The small size of the training data led to an increase of epochs performed in order to get satisfactory results. For the best configuration found, the number of epochs was set at The small size of the training data led to an increase of epochs performed in order to get satisfactory results. For the best configuration found, the number of epochs was set at the scale of 150,000. Despite the large number of epochs, the training procedure required less than 5 min to complete at an i7 9700K.

Results
The results obtained from the implementation of the above-described methodology are presented in this chapter.
In the below figures, the outcome of the first step of optimization procedure is presented. After the training of the ANN model, an NSGA-II optimization algorithm was executed for the minimization of the ANN function modeling vessel total viscous resistance R TOTAL . In Figure 11a-c, the convergence of the three input parameters representing the variables at the hull stern is observed. Moreover, in Figure 11d, it is evident that the ANN function was minimized. This minimization translates to a 9% reduction at vessel's R TOTAL compared to the parent hull as evaluated by the ANN model. the scale of 150,000. Despite the large number of epochs, the training procedure required less than 5 min to complete at an i7 9700K.

Results
The results obtained from the implementation of the above-described methodology are presented in this chapter.
In the below figures, the outcome of the first step of optimization procedure is presented. After the training of the ANN model, an NSGA-II optimization algorithm was executed for the minimization of the ANN function modeling vessel total viscous resistance RTOTAL. In Figure 11a-c, the convergence of the three input parameters representing the variables at the hull stern is observed. Moreover, in Figure 11d, it is evident that the ANN function was minimized. This minimization translates to a 9% reduction at vessel's RTOTAL compared to the parent hull as evaluated by the ANN model. To verify this result, a direct CFD evaluation of the hull form with the optimum stern variables was performed. Dynamic sinkage and trim as calculated by the potential flow solver were used in the viscous evaluation.
As presented in Table 4, geometrical parameters, assessed by the ANN and optimized via NSGA-II at the vessel stern region, contributed to the reduction of RTOTAL by 15% after validation by MaPFlow, using the same discretization scheme and turbulence model for the evaluation of the parent and the optimum hull form. However, as stated in Section 3.5, the y+ of the simulations was relatively large; thus, it must be validated using successively denser grids in the hull region. Apart from that, results obtained by the trained neural network are quite satisfactory despite the small size of the training dataset. To verify this result, a direct CFD evaluation of the hull form with the optimum stern variables was performed. Dynamic sinkage and trim as calculated by the potential flow solver were used in the viscous evaluation.
As presented in Table 4, geometrical parameters, assessed by the ANN and optimized via NSGA-II at the vessel stern region, contributed to the reduction of R TOTAL by 15% after validation by MaPFlow, using the same discretization scheme and turbulence model for the evaluation of the parent and the optimum hull form. However, as stated in Section 3.5, the y+ of the simulations was relatively large; thus, it must be validated using successively denser grids in the hull region. Apart from that, results obtained by the trained neural network are quite satisfactory despite the small size of the training dataset. The small discrepancy in the R TOTAL reduction between network prediction and high-fidelity viscous evaluation verifies the reliability of the ANN meta-model. In the 2nd step of the optimization procedure, the five design variables at the bow and the middle region of the vessel went through another NSGA-II optimization cycle. Figures 12 and 13. This time, hull variants were evaluated via the potential solver SWAN2 as described in Section 3.4. It should be noted that the vessel stern region was kept at parent shape while only the five parameters were varied. Reduction of wave pressure resistance has been relatively small. Results are presented at following Table 5. The small discrepancy in the RTOTAL reduction between network prediction and high-fidelity viscous evaluation verifies the reliability of the ANN meta-model. In the 2nd step of the optimization procedure, the five design variables at the bow and the middle region of the vessel went through another NSGA-II optimization cycle. Figures 12 and 13. This time, hull variants were evaluated via the potential solver SWAN2 as described in Section 3.4. It should be noted that the vessel stern region was kept at parent shape while only the five parameters were varied. Reduction of wave pressure resistance has been relatively small. Results are presented at following Table 5.   The small discrepancy in the RTOTAL reduction between network prediction and high-fidelity viscous evaluation verifies the reliability of the ANN meta-model. In the 2nd step of the optimization procedure, the five design variables at the bow and the middle region of the vessel went through another NSGA-II optimization cycle. Figures 12 and 13. This time, hull variants were evaluated via the potential solver SWAN2 as described in Section 3.4. It should be noted that the vessel stern region was kept at parent shape while only the five parameters were varied. Reduction of wave pressure resistance has been relatively small. Results are presented at following Table 5.     As a final step, the optimum design variables as those that emerged from both optimization steps were combined to derive the overall optimized hull form, presented in Figure 14. Its performance was assessed via viscous calculation. Results were quite encouraging and are presented in Table 6.
As a final step, the optimum design variables as those that emerged from both optimization steps were combined to derive the overall optimized hull form, presented in Figure 14. Its performance was assessed via viscous calculation. Results were quite encouraging and are presented in Table 6 Figure 14. Comparison of optimized (red) and original hull stations.

Conclusions
On the basis of the results presented in the previous sections, it seems that the proposed mixed fidelity method is quite efficient in optimizing the hull form for calm water resistance of ships using genetic algorithms and ANN. The method combines the capabilities of the potential flow codes to evaluate the hydrodynamic effects of the geometrical design parameters of the fore and middle body of a ship with the strength of the viscous flow codes to estimate the respective effect of the design variables in the aft body. ANN was able to produce results of sufficient accuracy to be useful for the preliminary prediction of vessel resistance despite a small number of training inputs. It is worth underlining that the development of a case specific neural network model is needed. Besides traditional programming languages, though, online platforms and libraries for development of artificial neural networks are widely available nowadays. Depending on the number of inputs/outputs, the magnitude of their variances and size of training data an ANN can be effortlessly integrated at the optimization process Employing automated artificial neural network software can greatly accelerate the process of designing and training an ANN capable of modeling hull resistance problems. The agreement between the optimum value of the objective function and the results of the RANS solver is satisfactory. This is considerably easier and quicker than traditional statistical methods. Whilst it is important to choose a reasonable artificial neural network architecture, the exact number of neurons in the hidden layer is not too critical. Quality and quantity of input data are the key factors.
The final outcome of the optimization procedure is validated by evaluating the optimum hull form via the RANS solver. As mentioned above, dynamic sinkage and trim were utilized for the viscous evaluation. For a more precise evaluation, though, the actual

Conclusions
On the basis of the results presented in the previous sections, it seems that the proposed mixed fidelity method is quite efficient in optimizing the hull form for calm water resistance of ships using genetic algorithms and ANN. The method combines the capabilities of the potential flow codes to evaluate the hydrodynamic effects of the geometrical design parameters of the fore and middle body of a ship with the strength of the viscous flow codes to estimate the respective effect of the design variables in the aft body. ANN was able to produce results of sufficient accuracy to be useful for the preliminary prediction of vessel resistance despite a small number of training inputs. It is worth underlining that the development of a case specific neural network model is needed. Besides traditional programming languages, though, online platforms and libraries for development of artificial neural networks are widely available nowadays. Depending on the number of inputs/outputs, the magnitude of their variances and size of training data an ANN can be effortlessly integrated at the optimization process Employing automated artificial neural network software can greatly accelerate the process of designing and training an ANN capable of modeling hull resistance problems. The agreement between the optimum value of the objective function and the results of the RANS solver is satisfactory. This is considerably easier and quicker than traditional statistical methods. Whilst it is important to choose a reasonable artificial neural network architecture, the exact number of neurons in the hidden layer is not too critical. Quality and quantity of input data are the key factors.
The final outcome of the optimization procedure is validated by evaluating the optimum hull form via the RANS solver. As mentioned above, dynamic sinkage and trim were utilized for the viscous evaluation. For a more precise evaluation, though, the actual hull wetted surface should have been taken into account. Full scale simulations and subsequent large Reynolds number still pose a significant challenge for numerical experiments since fully resolved simulations are computationally prohibitive, especially if combined into an optimization scheme. Therefore, the urge to enhance the fidelity of optimization schemes with accurate and efficient methods for metamodels to integrate viscous effects into potential flows results with different tools such as ANNs is a challenging task.
It should be noted that the potential of the present approach can be further explored by increasing the number of training data to improve the fidelity of the ANN. Similar ANNs could be used to account for other aspects of ship performance, such as seakeeping and maneuverability characteristics, which, however, are currently estimated satisfactorily by fast codes using strip theory or 3D potential flow methods. Finally, to ensure the significance of the optimization simulations, results shall be validated by towing tank experiments. The construction of scaled models of the parent and the optimum hull forms and their testing in the towing tank would provide more confidence about the efficiency of the optimization scheme.