Damaged hull coatings can exacerbate corrosion to the ship body and timely detection and repair of defects are necessary to prevent further corrosion. Due to the large size of the ship, detection of the defects is not easy, especially those located below the waterline. When the impressed current cathodic protection detection system is combined with specialized software, this problem can be solved. This article has developed a software system that can predict damaged locations. The system adopts an improved annealing particle swarm optimization algorithm, combined with electrochemical theory, which can search for defects through iteration. Simulation results show that the system can locate the defects accurately in situations, where there are only one or two damaged parts with high accuracy.
INTRODUCTION
Ships may experience damage to the anticorrosion coatings due to aging or collision.1-2 Damage leads to increased local corrosion current and larger impressed current cathodic protection currents are needed to keep the vessel in a protective state. If the damaged part is located below the waterline, it is difficult to detect and by the time it is discovered, the ship may have already suffered severe corrosion. Therefore, timely detection of damage and prediction of its location is crucial for stopping the further development of corrosion.
Compared to the other aspects of ship hull anticorrosion research, a study in this area is relatively lacking.3-6 This lack is because the actual damage situation is relatively complex, including the defect shape, location, and count, therefore, various proposed algorithms have been simplified in various ways.
Thiel, et al.,3 adopted the neural network technology to predict damaged locations. This algorithm requires a large amount of potential and current data corresponding to randomly located defects to train the network, which results in a large computational load. Wrobel4 combined the genetic algorithm (GA) and boundary element method to predict the surface defects of the pipeline by the inverse problem- solving mode.
In the 1970s, Holland founded GA.7 GA expresses the solution of the problem (such as damage location xi, yi) in binary code and combines them to form a chromosome. Multiple chromosomes are generated by a certain algorithm to form a population, and then, by imitating biological evolution, the chromosomes in the population are crossed and mutated to generate new chromosomes. According to certain conditions (such as the minimum standard deviation of potential distribution), the good ones are left, and then the above process is repeated. After a certain generation of evolution, the optimal chromosome (the optimal solution of the problem) is output.
However, this algorithm requires operations such as chromosome selection, crossover, and mutation, making programming complex, and prone to falling into local minima.
To overcome the shortcomings of the above algorithms, an improved particle swarm optimization algorithm (imSAPSO) is proposed based on simple particle swarm optimization (PSO). This new efficient and fast algorithm closely adheres to practical applications as much as possible.
A simple PSO algorithm was proposed by Eberhart and Kennedy in 1995.8 It is an optimization technique to simulate the foraging behavior of birds. The algorithm takes the bird swarm as the modeling object, and each bird is regarded as a “particle.” Taking the damage location prediction as an example, each particle represents a possible damage location Xi = [xi, yi]. The swarm contains lots of particles, and all particles (Xi, i = 1, … ,N) constitute the solution space of the problem.
After several evolutions (k→iteration number), the optimal solution is obtained. See the Results and Discussion section for a more specific discussion.
The simple PSO algorithm has the same issue as the GA, it is easy to fall into the local optima after evolving several iterations. Therefore, this paper improves the PSO improve its accuracy. See the Results and Discussion section for details.
GOVERNING EQUATION
2.1 | Ship Hull Geometry Model
Figure 1(a) shows the three-dimensional (3D) drawing and dimensions of the ship hull. The four auxiliary anodes are identified by numbers 1, 2, 3, and 4. As the hull is symmetrical about the OY axis, half of the hull can be evaluated.
Ship models (a) 3D geometric ship and dimension, (b) boundary conditions, (c) geometry discretization, and (d) defects on the hull.
Ship models (a) 3D geometric ship and dimension, (b) boundary conditions, (c) geometry discretization, and (d) defects on the hull.
2.2 | Governing Equation
To protect the hull from corrosion, the impressed current was injected into the hull surface through the auxiliary anodes to provide electrons to produce reaction (3) instead of reaction (2). A conductive circuit is established in the seawater around the hull, thus generating an electric field, because seawater is a strong electrolyte.
2.3 | Boundary Condition
As shown in Figure 1(b), the area Ω represents the hull surfaces. On these surfaces (interfaces), there are various boundary conditions.
2.3.1 | Electrochemical Reaction Boundary Conditions



2.3.2 | Current Boundary Condition
2.3.3 | Infinite Boundary Condition
Theoretically, under these boundary conditions, the potential distribution in Ω can be obtained by solving Equation (4). However, due to the complexity of geometry and boundary conditions, it is difficult to obtain the analytical solution, so the numerical solution must be used. After discretization, the geometric modeling becomes the finite element model as shown in Figure 1(c), and is solved by COMSOL.†
PRINCIPLE OF IMPROVED PARTICLE SWARM OPTIMIZATION ALGORITHM METHOD
This section focuses on the improved particle swarm algorithm based on PSO. Because the PSO is prone to fall into local optima, researchers introduced an annealing mechanism into the particle swarm algorithm, which can help the solution avoid local optima and provide the opportunity to search for global optima denoted as “gbest.”

In this way, after each particle evolves, its historical optimal solution replaces the global optimal solution with a certain probability Ri, which will jump out of the local optima.

Such improvement protects the real global optimal solution to a certain extent. Table 2 shows the test results of the imSAPSO and other algorithms. It was found that the accuracy of this method is significantly improved over other algorithms.
APPLICATION OF IMPROVED PARTICLE SWARM OPTIMIZATION ALGORITHM IN DAMAGE PREDICTION
4.1 | The Data Structure of Particle
This paper is limited to where only one or two defects exist simultaneously. Take the latter as an example, let [X1, Y1] represent the first defect location and [X2, Y2] represent the second one, the data structure of a particle is as shown in Figure 2(a), where n1 and n2 are the number of the defects (see Figure 1[d]). Fuc is the fitness of the particle and then will be discussed in Definition of Particle Fitness section.
Data structure of particle: (a) common particle, (b) historical best of a particle, and (c) global optimal particle.
Data structure of particle: (a) common particle, (b) historical best of a particle, and (c) global optimal particle.
4.2 | Definition of Particle Fitness
Before prediction, two patches are selected as defects to be searched. With the breakage rate set to zero, the rest of the hull is set as 0.14, with Vbi calculated by COMSOL according to the boundary conditions (5) through (9).
At the beginning of the simulation, a certain number of particles with the data structure shown in Figure 2(a) are randomly generated. For any particle, (X1, Y1) and (X2, Y2) are random and it can be determined which two patches (X1, Y1) and (X2, Y2) are located in. Therefore, the number of the two small patches (n1, n2) are associated with (X1, Y1) and (X2, Y2). See the Lock Defect Location Through (X1, Y1) and (X2, Y2) section for more details.
During simulation, (X1, Y1) and (X2, Y2) vary continuously according to Equation (14), at the same time, the n1 and n2, which are associated with (X1, Y1) and (X2, Y2), are also changing. That is, the defects’ locations have changed. In this case, the hull potential should change as well. When the changed potential Vai is calculated, the fitness of a particle can be obtained.
4.3 | Lock Defect Location Through (X1, Y1) and (X2, Y2)
The surface of the ship is meshed into many small patches as shown in Figure 1(d). If one or two of small planes are selected as the defect, determining the defect location is the key to simulation.
Taking (X1, Y1) as an example, in Figure 3, after model is discretized, each small patch contains many triangles, if (X1, Y1) is within any triangle, it can be concluded that (X1, Y1) is related to the number of the patch. The criterion of (X1, Y1) is within a triangle is if at the same time, the point P is inside the triangle; otherwise it is outside it. During simulation all triangles are evaluated, if one triangle meets the above criteria, the evaluation stops.
Schematic diagram of a point within a triangle located within a small patch.
4.4 | Limitation of (X1, Y1) and (X2, Y2)

The upper and lower limits [] of the particle in the X direction should be defined through interpolation calculation.
Similarly, in the Y direction, A-B is the limit line.
4.5 | Determination of Initial Annealing Temperature
SA is a theoretical global optimization algorithm proposed by Metropolis in 1953.9 It is an algorithm based on the principle of the solid annealing process. When the solid temperature is very high, the internal energy is large, and the irregular motion of particles inside the solid is fast. At this time, there is a certain probability that any solution of the entire solution domain can be obtained; as the temperature gradually decreases, the internal energy gradually decreases, and the particles inside the solid gradually tend to be ordered, that is, the solution in the algorithm tends to be stable. However, this stable solution may only be a local optimal solution, so as the solution gradually converges (cools down), the SA will have a certain probability of jumping out of this local optimal solution, that is, when the solid internal energy increases and the solution obtained is far from the objective function, the algorithm will accept it with a certain probability, rather than blindly rejecting it. This is also the core idea of the simulated annealing algorithm.
The recommended range for α is (0.9, 0.99), while in this study, α is set to 0.96. k is the iteration steps.
CALCULATION PROCEDURE
This calculation adopts the online technique of MATLAB† and COMSOL, that is to establish communication between MATLAB and COMSOL, and run COMSOL through the script in MATLAB to greatly improve the flexibility of finite element simulation. The script command flow in MATLAB is shown in Figure 5.
The entire algorithm process is very complex, with numerous control parameters listed in flowchart shown in Figure 5. For parameter information, refer to Tables 2 and 3.
RESULTS AND ANALYSIS
To test the performance of the software, 10 sets of tests were taken for the two cases: only one defect and two defects existed.
Figure 6(a) shows the variation of the objective function (take group 1 as an example in Table 4) with the number of iterations. It can be seen that error rapidly declines, and defects were found within about 13 iterative steps. Comparing the results calculated by imSAPSO and GA, respectively, in Figure 6(b) and Table 4, it can be seen that the object functions of imSAPSO are all smaller than that of GA, indicating higher accuracy. Examples of this accuracy difference can be seen in Table 4 for groups 6 to 10 that have defects with small planes (or are located in the edge zone) numbered 12, 39, 41, 45, and 61, respectively. Examination of Table 4 shows that imSAPSO correctly predicts defect location for all groups while GA incorrectly predicts defect location for the abovementioned groups 6 to 10.
Error distribution (a) The variation of error with the number of iterations and (b) comparison of errors.
Error distribution (a) The variation of error with the number of iterations and (b) comparison of errors.
In the case with two defects as shown in Table 5, the imSAPSO algorithm converges on the correct defect locations for all groups. In comparison, the GA algorithm does not provide the same level of accuracy or convergence results. Only groups 1, 3, 4, and 9 obtained accurate results, but with significant error. The results of groups 2, 6, 7, and 8 are completely incorrect, while the results of groups 5 and 10 are partially correct, one of two defect locations predicted correctly.
In Table 5, from the sixth group to the tenth group, the difficulty was increased, where some defect planes with small areas and remote locations were introduced. This increased the difficulty of searching. By increasing the number of particles and iterations, accurate results were obtained through convergence.
In addition, the sensitivity of the calculated results is related to the number of elements. Table 6 shows that when the number of elements is less than or equal to 70,179, the defect prediction is correct but the error is significant (10−3); but when the number of elements exceeds 87,131, the results are accurate and the error is significantly reduced (10−30). Taking into account the accuracy and efficiency of the calculation, it is appropriate to set the minimum number of elements to 87,131.
CONCLUSIONS
The algorithm (imSAPSO) proposed here is efficient and accurate. Its convergence steps, the accuracy of the objective function, and the final result were all improvements over GA.
For defects with small elements or on the edges of the geometry, imSAPSO correctly predicted all defect locations while GA only predicted the correct locations for some of the cases.
These results were for situations of one defect and two defects. For future studies, there is no fundamental difference in algorithms for three or more defects.
Trade name.
ACKNOWLEDGMENT
The authors thank the staff of the laboratory of the Metal Research Institute.
CONFLICTS OF INTEREST
There are no potential conflicts of interest between authors.
DATA AND CODE AVAILABILITY
The datasets used and/or analyzed during the current study are available from the corresponding author on reasonable request.
SUPPLEMENTARY INFORMATION
There are no additional materials.
ETHICAL APPROVAL
There are no experiments involving human tissue.
AUTHOR CONTRIBUTIONS
LIU Bin is responsible for programming, debugging, and writing papers.
LIU Yingwei is responsible for calculating and analyzing the results.
References
Nomenclature
- ϕ
Electrolyte potential
- ϕFe
Equilibrium potential
Equilibrium potential
Exchange current density
Exchange current density
- AFe
Tafel slope
Tafel slope
- fc
Breakage rate rate breakage rate
- i_inject
Injected current of anode
- ρ
Seawater conductivity
- n
Normal vector of hull surface
- PSO
Particle swarm optimization
- SAPSO
Simulated annealing PSO
- ImSAPSO
Improved SAPSO
- vi(k)
Velocity of particle i in k-th iteration
- gbest
Global optimal particle
- gbest′
Global optimal particle after replaced
- pbesti
I-th particle’s historical optimization
- fpbesti
Fitness of historical optimal of particle i
- fgbest
Fitness of global optimal particle
Fitness of historical optimal particle among all particles
- Ri
Replacing probability of particle i
Replacing probability of historical optimal particle among all particles
- pi
Jump probability of particle i
- c1
Individual consciousness of a particle
- c2
Group consciousness of a particle
- r1
Random value within [0,1]
- r2
Random value within [0,1]
- ω
Inertial coefficient
- T
Annealing temperature
- X1
Defect 1 coordinate
- Y1
Defect 1 coordinate
- X2
Defect 2 coordinate
- Y2
Defect 2 coordinate
Minimum of X1 and X2
Maximum of X1 and X2
- Yi
Interpolation node coordinate
- Ya
Minimum of Yi
- Yb
Maximum of Yi
Minimum interpolation node coordinate
Maximum interpolation node coordinate
- fobj
The potential difference before and after damaging object function
- Vib
Potential without damage
- Via
Potential with damage
- N
The number of hull nodes
- Xi,opt
Historical optimal of particle i
- Yi,opt
Historical optimal of particle i
- ni,opt
Defect number of historical optimal of particle i
- fucopt
Object function value of historical optimal of particle i
- fucglobal
Object function value of global optimal particle
- Xi,global
Global optimal particle
- Yi,global
Global optimal particle
- ni,global
Defect number of global optimal
- n1
Defect number during iteration
- n2
Defect number during iteration