# Utilizing Artificial Neural Network for Load Prediction Caused by Fluid Sloshing in Tanks

Authors: Hossein Goudarzvand Chegini; Gholamreza Zarepour
Journal: Geofluids
 (2021)

---

## Abstract

In this research, neural network models were used to predict the action of sloshing phenomena in a tank containing fluid under harmonic excitation. A new methodology is proposed in this analysis to test and simulate fluid sloshing behavior in the tank. The sloshing behavior was first modeled using the smooth particle hydrodynamics (SPH) method. The backpropagation of the error algorithm was then used to apply the two multilayer feed-forward neural networks and the recurrent neural network. The findings of the SPH process are employed in the training and testing of neural networks. Input neural network data include the tank position, velocity, and acceleration, neural output data, and fluid sloshing curve wave position. The findings of the neural networks were correlated with the experimental evidence provided in the literature. The findings revealed that neural networks can be used to predict fluid sloshing.


---

## Body

## 1. Introduction

Fluid sloshing has a wide variety of uses in the fields of engineering, for example, the construction of fuel tanks for automobiles, containers to carry liquid on roads, ships, and space vessels. As a result, studying the fluid sloshing activity inside a partly filled container is important [1, 2]. Sloshing is the movement of liquid inside a partly filled container as a result of external excitations. The liquid may undergo violent oscillations under such critical circumstances, such as major container movement or the presence of resonance, where the excitation frequency is similar to the normal frequency of the liquid sloshing mechanism. As a result, the container system is subjected to substantial structural load due to the induced high impact effect [3]. For a long time, fluid-filled storage tank systems have piqued researchers’ attention because of the peculiar properties that result from the fluid’s contact with the system. The sloshing is caused by the mixing between the fluid and structure, which may be a serious concern for vehicle stability and control [4]. The resonant state in sloshing will create high structural loads on the tank frame since the frequency of tank motion is similar to the normal frequency of the fluid within it. This resonance effect may be linked to complex movements of the filled liquid, which could couple with structure motions, posing a threat to the tank structure and its stability [5–7].The behavior of the free surface motion of the liquid within the tank is determined by the form of excitation, the frequency ratio to the natural frequency, and the amplitude. Excitation can take many types, including impulsive, sinusoidal, and random. The tank will sway, rotate, pitch/yaw, or a combination of these motions. In moderate sloshing, the resulting free surface profile may be a mix of various wave modes, such as hydraulic jump and traveling waves, or standing and breaking waves in extreme sloshing [6–10]. For the last few decades, researchers have been very interested in predicting the free surface motion of liquids, and some of the experiments on liquid sloshing are mentioned. Mechanical models of the phenomena were used at the beginning, with terms in the harmonic equation of motion being modified [10, 11]. There are several similar articles on reducing sloshing in the literature, and several researchers have published studies on sloshing using different methods [11–13]. Sloshing has been simulated in several previous studies using a generalized computational approach based on a pendulum or spring-mass model [12]. Nevertheless, because of the vast number of assumptions and simplifications used in the sloshing modeling stage, this approach has several flaws and weaknesses in implementation.Numerical simulations, in addition to the above methods, were presented as commonly used techniques for investigating fluid sloshing problems. For studying extremely nonlinear sloshing problems, numerical techniques have offered an alternative tool. Many reports [14, 15] include detailed analyses of numerical techniques for liquid sloshing problems. Grid-based approaches, such as the finite difference method (FDM) [16, 17], finite element method (FEM) [18, 19], and boundary element method (BEM) [20–23], were mainly used in computational experiments during the last decade. The traditional grid-based approach has several issues with liquid motion discontinuity or breaking waves. Although some free surface monitoring strategies, such as volume-of-fluid (VOF) [24, 25] and level set [26], have been adopted to address these shortcomings and increase the efficiency of traditional mesh-based systems, they still cannot accommodate large fluid deformation, necessitating mesh adjustment or rezoning to resolve liquid sloshing [27]. The use of a Lagrangian formulation to describe both fluid and structure motion has received a lot of interest as an alternate class of numerical simulation methods. This is due in part to the method’s ease of execution and in part to the method’s independence from grid data. In reality, the term meshless refers to the lack of an intrinsic dependence on a certain mesh topology in these approaches. Using Lagrangian techniques on both the solid and fluid parts of the problem has the advantage of allowing one to follow the motion of the fluid-solid interface and model the fluid’s free surface without any special care.The SPH approach is a meshless methodology that Chen and Nokes [16] and Chen and Wu et al. [17, 18] first introduced in 1977. The technique is based on a solely Lagrangian method and has been applied to a variety of issues, including astrophysics [28–31], fluid mechanics [31, 32], solid mechanics [33], and fluid-structure interaction [28]. Mesh-free and particle methods have recently been introduced as alternatives to mesh-based and particle methods for studying nonlinear free surface flows [28–30, 34, 35]. The SPH is a meshless approach that was initially designed to solve a compressible flow before being modified to apply the incompressible state [30]. This study is aimed at improving the SPH method’s ability to correctly simulate sloshing flow and calculate impact pressure by utilizing a more precise time-stepping integration and a simplified boundary state treatment. The theoretical approach is the most pragmatic way of studying sloshing physics. During this time, both experimental and theoretical methods were considered. Small-scale studies have been mostly employed in the manufacturing fields due to the sophistication and stochastic existence of sloshing problems [33].Even though laboratory tests have been conducted, the factors that should be studied are still up for debate. Sloshing loads under a given test environment are difficult to estimate due to their irregularity and nonparametric sophistication. A few studies have been carried out [36, 37], but no definitive estimate can be made. As a result, a nonlinear intelligent approach must be used to model this action. A good method for modeling nonlinear processes is an artificial neural network. Ahn et al. [38] conducted a large number of experiments. The artificial neural network is conditioned on the database to simulate the magnitude of sloshing loads. Neural networks are nonlinear mathematical data processing or decision-making tools in more realistic terms. They can be employed to model complicated input-output relationships or to identify patterns in results.Given that artificial neural networks have two basic features of learning or mapping based on the presentation of experimental data (power and ability to generalize) and parallel structure ability, they are one of the most important methods of artificial intelligence in which inspired by the human brain, while conducting the training process, data information is stored within network weights.Because of their strength, flexibility, and ease of use, neural networks are superior tools in many applications of predictive processes through data analysis. In cases where the process has nonlinear behavior and difficult mathematical equations, one of the best methods is an artificial neural network.The advantage of a neural network is direct learning from data without the need to estimate their statistical characteristics. The neural network is able to find the relationship between the set of inputs and outputs to predict each output corresponding to the desired input, without considering any initial hypotheses and prior knowledge of the relationships between the studied parameters.Considering that most of the studies have been done on the study of fluid sloshing behavior in tank using numerical methods and equivalent mechanical models (pendulum model and mass-spring model), therefore, in this study, the use of a neural network is a suitable technique for predicting and modeling fluid sloshing behavior in the tank.One of the achievements of this study is to determine and investigate the behavior of fluid sloshing in the reservoir using neural network tools to predict sloshing in reservoirs. In other modeling methods, due to the nonlinear behavior of the sloshing phenomenon, which leads to behavior change by changing the initial conditions or the simulation time, the use of neural network tools can be justified. In fact, the work done in this study is modeling behavior based on the input and output results of a sloshing phenomenon based on data from the SPH method.As a result, a suggested neural network-based methodology is used to model the sloshing action of liquid in a rectangular tank under harmonic excitation in this research. The experimental results of the obtained [38] and numerically SPH system study regarding the influences of sloshing phenomenal in the tank were discussed first, and then, a method for fluid sloshing in tank prediction was suggested. There are four steps to this article. The sloshing effect was numerically modeled in the first stage using the SPH equation. The collected SPH findings were compared to the experimental results. Multilayer feed-forward (MLFF) neural networks are generated in the second level. The Elman neural network is built in the third level. The inputs to neural networks were wave curve direction, velocity, and acceleration, and the outputs were wave curve position. The computed findings from neural networks were compared to real data in the final step, and they were in good agreement.


## 2. Model Description

At atmospheric pressure and room temperature, the sloshing tests are conducted out in a rectangular tank partly filled with water. This paper’s case study is based on previous research on lateral sloshing effects under periodic harmonic excitation. The tank’s dimensions are1.3m×0.9m×0.1m and correspond to the tank’s length, height, and width, respectively (see Figure 1).Figure 1
Schematic diagram of the liquid sloshing model corresponding to Rafiee et al. [31].Based on the experimental work of Rafiee et al. [31], the schematic diagram for liquid sloshing in a tank was adopted, with a low filling depth ratio d=0.2H and a sinusoidal motion excitation, x=Asinωt. The motion was introduced with a high amplitude (A=0.1m) and a resonance frequency of ω=3.116. Figure 1 shows the precise dimensions of the rectangular tank in this model.


## 3. Numerical Analysis

### 3.1. SPH Theory

The SPH procedure is used to numerically simulate the sloshing effect in this article. A short overview of the approach is provided below, along with several key implementation problems. For a more detailed summary, the reader is directed to [38]. The interpolation principle underpins the SPH system. Using a kernel function, any function may be represented in terms of its values at a series of disordered points describing particle locations. The kernel function is a weighting function that determines the input of a common field vector, Ar, at a specific point in space, r. Ar’s kernel estimate is specified as [24, 28].(1)Ar=∫VAr′δr−r′,hdr′,where r denotes the vector position, V denotes the solution space, and h denotes the kernel’s effective distance. The particle approximation of the function at amparticle, r, can be written as follows by discretizing approximation Equation (1).(2)Ar=∑b=1NmjρjAjWij.At the summation, all particles inside the kernel function’s compact support area must be considered. The weight function or kernel isWij=Wri−rj,h, and the mass and density are mj and ρj, respectively. The following kernel function proposed by Faltinsen and Timokha [23] is one of the kernel functions used in this work:(3)Wr,h=αd1−32q2+34q3,0≤q<1,142−q2,1≤q<2,0,q>2,where αd is 10/7πh2 in 2D and q=r/h and r is the distance between two points a and b.


### 3.2. Discretization of Governing Equations in SPH Formulation

To model fluid motions, the SPH formalism is extended to the Navier-Stokes equations. This approach is described briefly here. The continuity and Navier-Stokes equations are the governing equations.(4)1ρDρDt+∇.v⟶=0,(5)Dv⟶Dt=−1ρ∇p+g+ν∇2v⟶,where v⟶ denotes the particle velocity vector, t is the time, ρ is the fluid density, p is the pressure, g is the gravitational acceleration vector, and ν denotes the laminar kinematic viscosity. When the actual equation of state is applied, the time stage would be very limited due to the finite compressibility of real liquids. As a result, in the actual measurement, the fluid is typically treated as weakly compressible, and the pressure field is extracted by solving the equation p=pρ,e. In addition, the entropy effect on the pressure field can be ignored when the fluid pressure is less than 1 GPa. The density of a fluid is solely determined by its pressure. The mass conservation equation, the energy conservation equation, and the momentum conservation equation make up the SPH equations. When the flow field’s pressure is low, the fluid is considered barotropic, and energy has no impact on the pressure field. As a result, the energy equation remains unsolved. The density equation and the momentum equation are described as follows using the SPH method’s kernel approximation and particle approximation:(6)DρiDt=ρi∑j=1Nvi⟶−vj⟶∇WijVj,(7)DviDt=g⟶−mj∑jpiρi2+pjρj2∇Wij+αh∑jpi+pjvi⟶−vj⟶.rij⟶ρi+ρjrij⟶2+0.01h2∇Wij,where P, m, ρ, c, v, r, and g represent pressure, mass, density, speed of sound, velocity, coordinates, and acceleration of gravity, respectively, Rij=ri–rj. For the pressure, the system is closed with a stiff equation of state.(8)p=ρ0cs2γρρ0γ−1,where ρ0 denotes the fluid’s nominal density (1000 kg/m3), γ is a constant set to 7, and cs denotes the numerical sound speed used in the measurement. In SPH, the sound speed is normally set to 10 times the predicted maximum velocity of the fluid (Vmax). Because density changes with the square of the Mach number, it is likely to be about 1% of the fluid’s nominal density. The numerical sound speed is therefore kept low enough to allow for appropriate time measures.


## 3.1. SPH Theory

The SPH procedure is used to numerically simulate the sloshing effect in this article. A short overview of the approach is provided below, along with several key implementation problems. For a more detailed summary, the reader is directed to [38]. The interpolation principle underpins the SPH system. Using a kernel function, any function may be represented in terms of its values at a series of disordered points describing particle locations. The kernel function is a weighting function that determines the input of a common field vector, Ar, at a specific point in space, r. Ar’s kernel estimate is specified as [24, 28].(1)Ar=∫VAr′δr−r′,hdr′,where r denotes the vector position, V denotes the solution space, and h denotes the kernel’s effective distance. The particle approximation of the function at amparticle, r, can be written as follows by discretizing approximation Equation (1).(2)Ar=∑b=1NmjρjAjWij.At the summation, all particles inside the kernel function’s compact support area must be considered. The weight function or kernel isWij=Wri−rj,h, and the mass and density are mj and ρj, respectively. The following kernel function proposed by Faltinsen and Timokha [23] is one of the kernel functions used in this work:(3)Wr,h=αd1−32q2+34q3,0≤q<1,142−q2,1≤q<2,0,q>2,where αd is 10/7πh2 in 2D and q=r/h and r is the distance between two points a and b.


## 3.2. Discretization of Governing Equations in SPH Formulation

To model fluid motions, the SPH formalism is extended to the Navier-Stokes equations. This approach is described briefly here. The continuity and Navier-Stokes equations are the governing equations.(4)1ρDρDt+∇.v⟶=0,(5)Dv⟶Dt=−1ρ∇p+g+ν∇2v⟶,where v⟶ denotes the particle velocity vector, t is the time, ρ is the fluid density, p is the pressure, g is the gravitational acceleration vector, and ν denotes the laminar kinematic viscosity. When the actual equation of state is applied, the time stage would be very limited due to the finite compressibility of real liquids. As a result, in the actual measurement, the fluid is typically treated as weakly compressible, and the pressure field is extracted by solving the equation p=pρ,e. In addition, the entropy effect on the pressure field can be ignored when the fluid pressure is less than 1 GPa. The density of a fluid is solely determined by its pressure. The mass conservation equation, the energy conservation equation, and the momentum conservation equation make up the SPH equations. When the flow field’s pressure is low, the fluid is considered barotropic, and energy has no impact on the pressure field. As a result, the energy equation remains unsolved. The density equation and the momentum equation are described as follows using the SPH method’s kernel approximation and particle approximation:(6)DρiDt=ρi∑j=1Nvi⟶−vj⟶∇WijVj,(7)DviDt=g⟶−mj∑jpiρi2+pjρj2∇Wij+αh∑jpi+pjvi⟶−vj⟶.rij⟶ρi+ρjrij⟶2+0.01h2∇Wij,where P, m, ρ, c, v, r, and g represent pressure, mass, density, speed of sound, velocity, coordinates, and acceleration of gravity, respectively, Rij=ri–rj. For the pressure, the system is closed with a stiff equation of state.(8)p=ρ0cs2γρρ0γ−1,where ρ0 denotes the fluid’s nominal density (1000 kg/m3), γ is a constant set to 7, and cs denotes the numerical sound speed used in the measurement. In SPH, the sound speed is normally set to 10 times the predicted maximum velocity of the fluid (Vmax). Because density changes with the square of the Mach number, it is likely to be about 1% of the fluid’s nominal density. The numerical sound speed is therefore kept low enough to allow for appropriate time measures.


## 4. Results of SPH Modelling

A Fortran code based on the SPH method is employed in the simulation. A simulated model is depicted in Figure2.Figure 2
Sloshing simulation in tank using SPH method for time steps of different times.These findings can be checked based on the pressure results collected from the SPH process and experiments, as seen in Figures2 and 3. The need for simulation of the SPH process, on the other hand, arises from the fact that it will be used in the next segment for neural network training, and the more data available, the closer the sloshing behavior prediction using a qualified neural network will be to actual performance.Figure 3
Comparison between experimental results and SPH method for water.


### 4.1. Data Preprocessing

Preprocessing data is a crucial part of the data mining process. Out-of-range values, unlikely data combinations, incomplete values, and other issues may arise from data collection approaches that are not tightly regulated. Analyzing data that has not been thoroughly screened for such issues will lead to false conclusions. As a result, before running an analysis, the representation and consistency of data must come first [1]. Data preprocessing is often the most crucial stage of a machine learning project [2]. Cleaning, instance filtering, normalization, transformation, function extraction and selection, and so on are all examples of data preprocessing. The final training collection is the product of data preprocessing. Data preprocessing may have an impact on how the results of the final data processing are viewed [3]. When the meaning of the findings is a critical point, this element should be carefully considered. The simulation employs the SPH process, as previously stated. As a result, a variety of particles were used to create the tank model and the fluid inside it. Each particle has many characteristics at each time phase of the simulation process. Particle position, velocity, pressure, mass, and density are among these characteristics. As a result, there is a lot of data available in the simulation over time. Due to the short time measures, the simulation time is less than 10 seconds, but the data collection is high. Figure 4 shows a picture of a virtual model of fluid in the tank, for example. As can be observed, a large number of particles make up the fluid volume. As a consequence, the simulation’s output has a lot of numbers (see Figure 4).Figure 4
The configuration of particles in 2D simulations by the SPH method.The next step is to prepare the data for use in neural networks. However, before we get to this stage, we must first decrease the size of the results. This is accomplished by the use of MATLAB applications. The model design according to the SPH system consists of a significant number of particles in both vertical and horizontal directions. We are looking for the produced waveform in the tank, which can be used to calculate the sloshing effect, pressure values, and generated forces. As a result, obtaining the location of the fluid surface, or, in other words, the generated wave position, is necessary to calculate the amount of fluid at any given time. As a result, the position of the particles on the fluid’s surface is critical in determining the final form of the fluid in the tank. This is shown in Figures5 and 6.Figure 5
Presentation of fluid sloshing simulation in the time step 29 after particle elimination.Figure 6
Time step 29, particles position of the wave curve in SPH simulation.According to Figure5, the goal of particle removal is to decrease the computational cost. As a consequence, using the wave’s curve coordinates, we can calculate the sloshing results under the same conditions as before.


### 4.2. Artificial Neural Network

Artificial neural networks are used in a variety of applications, including control, manufacturing, and optimization [39]. When it comes to neural networks, there are several different kinds of networks that can be employed. Various network parameters, such as the type of neurons present in each layer and the mechanism by which network layers are interconnected, can be determined by the network type. The following two forms are being considered for use in this research:(1)
Two or three layers of neurons make up MLFF neural networks. Feed-forward networks get their name from the fact that the output of each layer is simply fed into the next layer. Each layer may have various sizes and transfer features(2)
Elman networks are a form of recurrent network that has feedback from the first layer’s output to the first layer’s input and consist of two feed-forward layers. The secret layer’s neurons have a tangential-Sigmoidal transfer mechanism, while the output layer’s neurons have a linear transfer function [40]


### 4.3. Data Collection

The gathering of data is an important step in the creation of neural network models. The data for this analysis comes from simulations of a complex SPH model. Throughout the simulation, the data is sampled every 0.01 second, yielding a total of 1000 datasets. Time, tank displacement, velocity, and acceleration are the model’s input parameters. The waveform location is the model’s output parameter.The main technique in this study is the use of fluid sloshing wave profile curve data in the reservoir shown in Figure5. The results obtained from the SPH method are based on particle modeling, so a large amount of fluid information is generated for modeling, and to use it, a large part of it must be filtered. Therefore, a programming code has been written in MATLAB software that extracts useful information from the simulation data of SPH method and transmits it for use in a neural network.The next step is to define the input and output data for the neural network. As mentioned earlier, the input data of the network is equal to the displacement, velocity, and acceleration applied to the fluid and the output data is equal to the position of the profile of the fluid sloshing wave profile. For example, a view of the fluid sloshing wave curve after filtration is shown in Figure6. As a result, the most important part of this research is the extraction of simulation data and the selection of appropriate data for use in the neural network.


### 4.4. Data Normalization

Since each input sample has various physical definitions and proportions, the input sample must be normalized for each input sample to have an equivalent essential location and to avoid the weight from being adjusted into the flat region of error. The ANN’s normalized inputs are generated using the regularization function below:(9)Xn=Xi−XminXmax−Xmin,where Xmax and Xmin are the maximum and minimum values of X, respectively, and Xn is the X normalization value;


### 4.5. Determination of Neuron and Layer Numbers in ANN

A two-layer feed-forward network configuration is used in this paper’s neural network prediction model, which comprises a hidden layer and an output layer. The number of hidden neurons affects the network as well. The number of neurons in the hidden layer is proportional to the network model’s predictive capacity.The MLFF network is shown in Figure7. The neural network used in this study is multilayer perceptron. This network is based on the backpropagation algorithm used to train the data. This algorithm is a method for deep learning of artificial neural networks with more than one hidden layer, which is used to calculate the weight gradient more accurately. This method is often done by optimizing the learning algorithm and stabilizing the weight of neurons by calculating the gradient descent of the cost function.Figure 7
A model of multilayer feed-forward neural networks.For a MLFF network, input data includeX, V, and a, output data include y1,y2⋯,y127, Wi1 denotes the connected weight between the input layer and hidden layer, Wi2 denotes the connected weight between the hidden layer and output layer, and the sigmoid function as the activation function with the following form:(10)gt=11+e−t,whose derivative form is(11)ġt=gt1−gt.As a result, the estimation output of networky´tandy´t+1 are obtained according to(12)y´t=Wc2sigWi1xt+b1,(13)y´t+1=Wc2sigWi1xt+1+b1,where xt=xtTvtTatTT, xt+1=xt+1Tvt+1Tat+1TT, and b1 is the activated threshold. Formulas (12) and (13) transform the solving of yt and yt+1 to the learning of connected weights Wi1 and Wi2.The main purpose of the calculations for the neural network is to reduce the difference between the predicted value of the network and the actual model, so to calculate this output, a cost function must be defined according to which the value of the difference betweenyt and y´t is minimized.The errorδi between the estimated y´it and yit is obtained by(14)δit=y´it−yit,(15)E=12∑i=1∞δit2.We are looking for the minimum measurement error; therefore, the weight error∆Wi1 and ∆Wi2 at t is(16)∆Wi2=μ∂E∂Wi2=μ∂E∂δi∂δi∂yt´∂yt´∂Wi2=μ∙δit∙μ∙git,(17)∆Wi1=μ∂E∂Wi1=μ∂E∂δi∂δi∂yt´∂yt´∂gi∂gi∂g´i∂gi´∂Wi1=μ∙δi∙μ∙Wi2∙git1−git∙xt,where μ is the learning rate, Xt is the input of neural network, git is the output of the sigmoid function of the network, and Wi2 is the connected weight between the hidden layer and output layer. gi and Wi2 will be obtained from the neural network, see [41, 42] for a more detailed discussion.


### 4.6. Training and Testing of Network

The data extracted from the SPH modeling has been spontaneously divided into three groups for training the networks: 70% is used for training, 15% is used to verify that the network is generalizing and to interrupt training until it becomes overfit, and the other 15% is employed as a completely independent test of network generalization. The method of achieving optimum values for the adjustable parameters, weights, and biases used to obtain the best match between input and output data is known as ANN training. It is a nonlinear optimization problem to minimize mean squared error (MSE) and root-mean-square error (RMSE). The Levenberg-Marquardt optimization algorithm was used to complete the training phase. The numerous optimization algorithms are introduced as training functions in the MATLAB Neural Network Toolbox, such as the trainlm function (Levenberg-Marquardt), trainbr function (Bayesian regularization), and trainscg function (scaled conjugate gradient).


### 4.7. Simulation Results and Discussion

Three measures were regarded in this section of the analysis to forecast the actions of sloshing phenomena. The multilayer feed-forward neural network is employed in the first section. The multilayer Elman neural network is utilized in the second phase, and comparisons between networks are made in the third stage. Information is given at each level of neural network modeling. For predicting sloshing behavior, a multilayer feed-forward neural network was implemented in the first phase. Input neural network data include tank position, velocity, and acceleration, neural output data, and fluid sloshing curve wave position. The wave’s curve position is the neural network’s contribution. As previously mentioned, the knowledge of the wave curve coordinates is calculated utilizing the data mining method based on the simulation results obtained using the SPH method. The number of particles in the waveforms is 127, which is used as the neural network’s output based on the wave curve data (Figure6). In the secret layer, the number of neurons was set to 5. The network accuracy is also validated using regression (r) plots. The regression plots in Figure 8 indicate that the fit is strong for all datasets, with regression values of 0.9993 or higher in each case. Figure 8 shows a comparison of network expected and real insolation values. The error values for each input vector are also seen in this figure. The estimated values are very similar to the real values, and the majority of the errors are close to zero, as seen in Figures 9–13.Figure 8
The regression plot for the proposed network.Figure 9
Simulation results of the MLFF neural network based on the trainlm function.Figure 10
Simulation results of the MLFF neural network based on the trainbr function.Figure 11
Simulation results of the MLFF neural network based on the trainscg function.Figure 12
The difference results of the neural network and the trained data for the position of the sloshing curve points in time step 29.Figure 13
The difference results of the neural network and the test data for the position of the sloshing curve points in time step 29.The Levenberg-Marquardt algorithm is one of the fastest implementation methods for backpropagation algorithm and has a very high efficiency for a medium network. The main drawback of this method is the need to store large matrices in memory, and this issue requires a lot of space [43–47], see reference [48] for more details. Another method used is the Bayesian regularization algorithm. In this method, weights and network biases are assumed to be random values with a specific distribution, see reference [49] for more details. In the third method, the scaled conjugate gradient algorithm is used. This algorithm works well for solving a wide range of problems. In particular, problems with a large number of network parameters are as fast as the L algorithm in estimating functions, see reference [50] for more details. The results of evaluating the algorithms used are shown in Table 1.Table 1
Feed-forward network backpropagation.
AlgorithmTimeMSERMSETansig-tansigTansig-purelinTansig-tansigTansig-purelinTansig-tansigTansig-purelintraingd2.7576121.9704891.5294e-041.5950e-040.01240.0126trainbr6.8204298.7059256.7651e-055. 3503e-050.00820. 0073trainscg0.8311161.0109781.2533e-046. 2863e-050.01120.0079trainlm5.6159314.9464961.0469e-041.0030e-040.01020.0100The Elman neural network was employed in the second stage to model the sloshing action. This network is one of the dynamic neural networks in which there is a feedback loop with a single delay around each layer of the network. This connection to the network helps to identify and generate time-varying patterns. The simplest form of this structure, which consists of only two layers and whose input and output excitation functions are tansigmoid and purelin, respectively, see reference [51] for more details. The results for the Elman neural network are shown in Table 2.Table 2
Elman network backpropagation.
AlgorithmTimeMSERMSETansig-tansigTansig-purelinTansig-tansigTansig-purelinTansig-tansigTansig-purelintraingd3.3033008.5895011.3164e-041.5175e-040.01150.0123trainbr6.8182496.2336765.2592e-055.9088e-050.00730.0077trainscg0.7928321.0253198.4818e-053.6562e-050.00920.0060trainlm5.0706453.8287515.5988e-056.9013e-050.00750.0083Whereas our neural networks predict with high accuracy, they can sometimes encounter issues such as being stuck in the wrong local minima, or under or overfitting during training. A nonlinear network’s error surface is more complicated than a linear network’s error surface. Nonlinear transfer functions in multilayer networks cause several local minima in the error surface, which is a challenge. Since gradient descent is conducted on the error surface, it is common for the network solution to get entangled in one of these local minima, based on the initial circumstances. Based on how close the local minimum is to the global minimum and how small an error is expected, settling in a local minimum may be beneficial or detrimental. As a result, while a multilayer backpropagation network with enough neurons can enforce almost any function, backpropagation does not always find the optimal weights. To ensure that the right option has been found, the network can require to be reinitialized and retrained multiple times (see Figures14–17).Figure 14
The regression plot for the proposed network.Figure 15
Simulation results of the Elman neural network based on the trainlm function.Figure 16
Simulation results of the Elman neural network based on the trainbr function.Figure 17
Simulation results of the Elman neural network based on the trainscg function.Usually in nonlinear systems, with the slightest change in its boundary conditions, the behavior of the system will change, which is the phenomenon of fluid sloshing in reservoirs as part of nonlinear systems. Therefore, modeling and finally predicting their behavior with other methods, such as numerical, experimental, and mathematical methods, will cause many problems. The use of artificial neural networks in fluid sloshing modeling due to the ease of using input and output data for neural network training has made this method superior to other methods, but it goes without saying that without the use of optimization algorithms such as genetic and PSO algorithms, the results will be poor. On the other hand, by implementing these models by the neural network, its dynamic model can be easily used in control systems.


## 4.1. Data Preprocessing

Preprocessing data is a crucial part of the data mining process. Out-of-range values, unlikely data combinations, incomplete values, and other issues may arise from data collection approaches that are not tightly regulated. Analyzing data that has not been thoroughly screened for such issues will lead to false conclusions. As a result, before running an analysis, the representation and consistency of data must come first [1]. Data preprocessing is often the most crucial stage of a machine learning project [2]. Cleaning, instance filtering, normalization, transformation, function extraction and selection, and so on are all examples of data preprocessing. The final training collection is the product of data preprocessing. Data preprocessing may have an impact on how the results of the final data processing are viewed [3]. When the meaning of the findings is a critical point, this element should be carefully considered. The simulation employs the SPH process, as previously stated. As a result, a variety of particles were used to create the tank model and the fluid inside it. Each particle has many characteristics at each time phase of the simulation process. Particle position, velocity, pressure, mass, and density are among these characteristics. As a result, there is a lot of data available in the simulation over time. Due to the short time measures, the simulation time is less than 10 seconds, but the data collection is high. Figure 4 shows a picture of a virtual model of fluid in the tank, for example. As can be observed, a large number of particles make up the fluid volume. As a consequence, the simulation’s output has a lot of numbers (see Figure 4).Figure 4
The configuration of particles in 2D simulations by the SPH method.The next step is to prepare the data for use in neural networks. However, before we get to this stage, we must first decrease the size of the results. This is accomplished by the use of MATLAB applications. The model design according to the SPH system consists of a significant number of particles in both vertical and horizontal directions. We are looking for the produced waveform in the tank, which can be used to calculate the sloshing effect, pressure values, and generated forces. As a result, obtaining the location of the fluid surface, or, in other words, the generated wave position, is necessary to calculate the amount of fluid at any given time. As a result, the position of the particles on the fluid’s surface is critical in determining the final form of the fluid in the tank. This is shown in Figures5 and 6.Figure 5
Presentation of fluid sloshing simulation in the time step 29 after particle elimination.Figure 6
Time step 29, particles position of the wave curve in SPH simulation.According to Figure5, the goal of particle removal is to decrease the computational cost. As a consequence, using the wave’s curve coordinates, we can calculate the sloshing results under the same conditions as before.


## 4.2. Artificial Neural Network

Artificial neural networks are used in a variety of applications, including control, manufacturing, and optimization [39]. When it comes to neural networks, there are several different kinds of networks that can be employed. Various network parameters, such as the type of neurons present in each layer and the mechanism by which network layers are interconnected, can be determined by the network type. The following two forms are being considered for use in this research:(1)
Two or three layers of neurons make up MLFF neural networks. Feed-forward networks get their name from the fact that the output of each layer is simply fed into the next layer. Each layer may have various sizes and transfer features(2)
Elman networks are a form of recurrent network that has feedback from the first layer’s output to the first layer’s input and consist of two feed-forward layers. The secret layer’s neurons have a tangential-Sigmoidal transfer mechanism, while the output layer’s neurons have a linear transfer function [40]


## 4.3. Data Collection

The gathering of data is an important step in the creation of neural network models. The data for this analysis comes from simulations of a complex SPH model. Throughout the simulation, the data is sampled every 0.01 second, yielding a total of 1000 datasets. Time, tank displacement, velocity, and acceleration are the model’s input parameters. The waveform location is the model’s output parameter.The main technique in this study is the use of fluid sloshing wave profile curve data in the reservoir shown in Figure5. The results obtained from the SPH method are based on particle modeling, so a large amount of fluid information is generated for modeling, and to use it, a large part of it must be filtered. Therefore, a programming code has been written in MATLAB software that extracts useful information from the simulation data of SPH method and transmits it for use in a neural network.The next step is to define the input and output data for the neural network. As mentioned earlier, the input data of the network is equal to the displacement, velocity, and acceleration applied to the fluid and the output data is equal to the position of the profile of the fluid sloshing wave profile. For example, a view of the fluid sloshing wave curve after filtration is shown in Figure6. As a result, the most important part of this research is the extraction of simulation data and the selection of appropriate data for use in the neural network.


## 4.4. Data Normalization

Since each input sample has various physical definitions and proportions, the input sample must be normalized for each input sample to have an equivalent essential location and to avoid the weight from being adjusted into the flat region of error. The ANN’s normalized inputs are generated using the regularization function below:(9)Xn=Xi−XminXmax−Xmin,where Xmax and Xmin are the maximum and minimum values of X, respectively, and Xn is the X normalization value;


## 4.5. Determination of Neuron and Layer Numbers in ANN

A two-layer feed-forward network configuration is used in this paper’s neural network prediction model, which comprises a hidden layer and an output layer. The number of hidden neurons affects the network as well. The number of neurons in the hidden layer is proportional to the network model’s predictive capacity.The MLFF network is shown in Figure7. The neural network used in this study is multilayer perceptron. This network is based on the backpropagation algorithm used to train the data. This algorithm is a method for deep learning of artificial neural networks with more than one hidden layer, which is used to calculate the weight gradient more accurately. This method is often done by optimizing the learning algorithm and stabilizing the weight of neurons by calculating the gradient descent of the cost function.Figure 7
A model of multilayer feed-forward neural networks.For a MLFF network, input data includeX, V, and a, output data include y1,y2⋯,y127, Wi1 denotes the connected weight between the input layer and hidden layer, Wi2 denotes the connected weight between the hidden layer and output layer, and the sigmoid function as the activation function with the following form:(10)gt=11+e−t,whose derivative form is(11)ġt=gt1−gt.As a result, the estimation output of networky´tandy´t+1 are obtained according to(12)y´t=Wc2sigWi1xt+b1,(13)y´t+1=Wc2sigWi1xt+1+b1,where xt=xtTvtTatTT, xt+1=xt+1Tvt+1Tat+1TT, and b1 is the activated threshold. Formulas (12) and (13) transform the solving of yt and yt+1 to the learning of connected weights Wi1 and Wi2.The main purpose of the calculations for the neural network is to reduce the difference between the predicted value of the network and the actual model, so to calculate this output, a cost function must be defined according to which the value of the difference betweenyt and y´t is minimized.The errorδi between the estimated y´it and yit is obtained by(14)δit=y´it−yit,(15)E=12∑i=1∞δit2.We are looking for the minimum measurement error; therefore, the weight error∆Wi1 and ∆Wi2 at t is(16)∆Wi2=μ∂E∂Wi2=μ∂E∂δi∂δi∂yt´∂yt´∂Wi2=μ∙δit∙μ∙git,(17)∆Wi1=μ∂E∂Wi1=μ∂E∂δi∂δi∂yt´∂yt´∂gi∂gi∂g´i∂gi´∂Wi1=μ∙δi∙μ∙Wi2∙git1−git∙xt,where μ is the learning rate, Xt is the input of neural network, git is the output of the sigmoid function of the network, and Wi2 is the connected weight between the hidden layer and output layer. gi and Wi2 will be obtained from the neural network, see [41, 42] for a more detailed discussion.


## 4.6. Training and Testing of Network

The data extracted from the SPH modeling has been spontaneously divided into three groups for training the networks: 70% is used for training, 15% is used to verify that the network is generalizing and to interrupt training until it becomes overfit, and the other 15% is employed as a completely independent test of network generalization. The method of achieving optimum values for the adjustable parameters, weights, and biases used to obtain the best match between input and output data is known as ANN training. It is a nonlinear optimization problem to minimize mean squared error (MSE) and root-mean-square error (RMSE). The Levenberg-Marquardt optimization algorithm was used to complete the training phase. The numerous optimization algorithms are introduced as training functions in the MATLAB Neural Network Toolbox, such as the trainlm function (Levenberg-Marquardt), trainbr function (Bayesian regularization), and trainscg function (scaled conjugate gradient).


## 4.7. Simulation Results and Discussion

Three measures were regarded in this section of the analysis to forecast the actions of sloshing phenomena. The multilayer feed-forward neural network is employed in the first section. The multilayer Elman neural network is utilized in the second phase, and comparisons between networks are made in the third stage. Information is given at each level of neural network modeling. For predicting sloshing behavior, a multilayer feed-forward neural network was implemented in the first phase. Input neural network data include tank position, velocity, and acceleration, neural output data, and fluid sloshing curve wave position. The wave’s curve position is the neural network’s contribution. As previously mentioned, the knowledge of the wave curve coordinates is calculated utilizing the data mining method based on the simulation results obtained using the SPH method. The number of particles in the waveforms is 127, which is used as the neural network’s output based on the wave curve data (Figure6). In the secret layer, the number of neurons was set to 5. The network accuracy is also validated using regression (r) plots. The regression plots in Figure 8 indicate that the fit is strong for all datasets, with regression values of 0.9993 or higher in each case. Figure 8 shows a comparison of network expected and real insolation values. The error values for each input vector are also seen in this figure. The estimated values are very similar to the real values, and the majority of the errors are close to zero, as seen in Figures 9–13.Figure 8
The regression plot for the proposed network.Figure 9
Simulation results of the MLFF neural network based on the trainlm function.Figure 10
Simulation results of the MLFF neural network based on the trainbr function.Figure 11
Simulation results of the MLFF neural network based on the trainscg function.Figure 12
The difference results of the neural network and the trained data for the position of the sloshing curve points in time step 29.Figure 13
The difference results of the neural network and the test data for the position of the sloshing curve points in time step 29.The Levenberg-Marquardt algorithm is one of the fastest implementation methods for backpropagation algorithm and has a very high efficiency for a medium network. The main drawback of this method is the need to store large matrices in memory, and this issue requires a lot of space [43–47], see reference [48] for more details. Another method used is the Bayesian regularization algorithm. In this method, weights and network biases are assumed to be random values with a specific distribution, see reference [49] for more details. In the third method, the scaled conjugate gradient algorithm is used. This algorithm works well for solving a wide range of problems. In particular, problems with a large number of network parameters are as fast as the L algorithm in estimating functions, see reference [50] for more details. The results of evaluating the algorithms used are shown in Table 1.Table 1
Feed-forward network backpropagation.
AlgorithmTimeMSERMSETansig-tansigTansig-purelinTansig-tansigTansig-purelinTansig-tansigTansig-purelintraingd2.7576121.9704891.5294e-041.5950e-040.01240.0126trainbr6.8204298.7059256.7651e-055. 3503e-050.00820. 0073trainscg0.8311161.0109781.2533e-046. 2863e-050.01120.0079trainlm5.6159314.9464961.0469e-041.0030e-040.01020.0100The Elman neural network was employed in the second stage to model the sloshing action. This network is one of the dynamic neural networks in which there is a feedback loop with a single delay around each layer of the network. This connection to the network helps to identify and generate time-varying patterns. The simplest form of this structure, which consists of only two layers and whose input and output excitation functions are tansigmoid and purelin, respectively, see reference [51] for more details. The results for the Elman neural network are shown in Table 2.Table 2
Elman network backpropagation.
AlgorithmTimeMSERMSETansig-tansigTansig-purelinTansig-tansigTansig-purelinTansig-tansigTansig-purelintraingd3.3033008.5895011.3164e-041.5175e-040.01150.0123trainbr6.8182496.2336765.2592e-055.9088e-050.00730.0077trainscg0.7928321.0253198.4818e-053.6562e-050.00920.0060trainlm5.0706453.8287515.5988e-056.9013e-050.00750.0083Whereas our neural networks predict with high accuracy, they can sometimes encounter issues such as being stuck in the wrong local minima, or under or overfitting during training. A nonlinear network’s error surface is more complicated than a linear network’s error surface. Nonlinear transfer functions in multilayer networks cause several local minima in the error surface, which is a challenge. Since gradient descent is conducted on the error surface, it is common for the network solution to get entangled in one of these local minima, based on the initial circumstances. Based on how close the local minimum is to the global minimum and how small an error is expected, settling in a local minimum may be beneficial or detrimental. As a result, while a multilayer backpropagation network with enough neurons can enforce almost any function, backpropagation does not always find the optimal weights. To ensure that the right option has been found, the network can require to be reinitialized and retrained multiple times (see Figures14–17).Figure 14
The regression plot for the proposed network.Figure 15
Simulation results of the Elman neural network based on the trainlm function.Figure 16
Simulation results of the Elman neural network based on the trainbr function.Figure 17
Simulation results of the Elman neural network based on the trainscg function.Usually in nonlinear systems, with the slightest change in its boundary conditions, the behavior of the system will change, which is the phenomenon of fluid sloshing in reservoirs as part of nonlinear systems. Therefore, modeling and finally predicting their behavior with other methods, such as numerical, experimental, and mathematical methods, will cause many problems. The use of artificial neural networks in fluid sloshing modeling due to the ease of using input and output data for neural network training has made this method superior to other methods, but it goes without saying that without the use of optimization algorithms such as genetic and PSO algorithms, the results will be poor. On the other hand, by implementing these models by the neural network, its dynamic model can be easily used in control systems.


## 5. Conclusion

In this paper, the fluid sloshing model in the reservoir was first simulated. The simulation was modeled based on the SPH method. The results obtained from the SPH method are based on particle modeling, so a large amount of fluid information is generated for modeling, and to use it, a large part of it must be filtered. Therefore, a programming code has been written in MATLAB software that extracts useful information from the simulation data of SPH method and transmits it for use in neural network. Then, the neural network was used to predict the sloshing behavior. In a neural network, two types of MLFF neural network and Elman neural network were compared based on different functions. The results obtained from the training data and test data show that there is good accuracy in neural network modeling. Table1 also shows a comparison between time-based and MSE algorithms in RMSE.



---

*Source: 3537542-2021-09-09.xml*