# Numerical Study of Rectangular Tank with Sloshing Fluid and Simulation of the Model Using a Machine Learning Method

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

---

## Abstract

This paper presents a fluid sloshing model using the artificial neural network method (ANN). Determining the fluid sloshing model in the tank is a challenging task due to its nonlinearity and complexity of behavior to its environmental and operational conditions. Due to the problems of laboratory modeling, the use of numerical modeling to analyze this phenomenon can be justified. In this paper, first, the fluid sloshing in the tank is simulated by the smooth particle hydrodynamics method (SPH). The input-output data for training the artificial neural network is based on the obtained results. Finally, the maximum force due to the fluid sloshing is obtained by changing different parameters.


---

## Body

## 1. Introduction

Sloshing refers to a fluid’s free surface oscillations in a partly filled tank. The presence of a free surface in the liquid is needed for slosh, presenting a dynamic fluid-structure interaction challenge [1]. Many studies of liquid sloshing in tanks have been conducted using model tests for various excitations, fillings, compartment shapes, and internal configurations ([2–4], as well as liquid sloshing effects for ship motions [5]. The majority of existing laboratory experiments, on the other hand, is for multiscale models rather than real ships. A series of numerical approaches are implemented to tackle the problem of liquid sloshing based on the constraints of theoretical and laboratory studies. However, most studies focused on the grid-based technique, which could necessitate special algorithms when tracking the motion of a free surface. Numerical methods for solving engineering problems involve several steps. The first step is to choose the proper governing equations that can model the problem with a certain level of accuracy. The next step is to discrete these governing partial differential equations. The most common discretization techniques are finite difference, finite volume, and finite element methods. All these methods discretize a continuum into elements connected by a topological mesh grid. However, when modeling problems like an explosion, impact, or fluid-structure interaction with large deformations, these methods require an adaptive remeshing process (Liu, 2010). Because fluid sloshing in tanks is associated with large deformations, numerical methods such as finite element and other techniques have many problems such as numerical distribution due to the expression transfer, continuity, and inflexibility of fluid free surface the use of these methods. In the last decade, mesh-free methods have been used for simulation and various applications.One of the nonlattice methods is the smooth particle hydrodynamics method. Sloshing flow has been studied using the SPH process ([6–9]. This study was aimed at improving the SPH method’s ability to simulate sloshing flow correctly and calculating impact pressure by using a more precise time-stepping integration and a simplified boundary state treatment. Qiao et al. [10] developed a new coupled model based on wavelet transform to predict short-term PM10 concentrations [10]. Peng et.al [11] have examined how metering performance is affected by the presence of rectifiers when shale gas is extracted. Lind et al. [12] used a weakly compressible assumption to apply the SPH simulation principle to incompressible flows with the free surface. The density was linked to the pressure field using an equation of state, a typical weakly compressible SPH (WCSPH) approach. Gómez-Gesteira and Dalrymple [13] used a 3D WCSPH model to simulate the effect of a dam-break flow on a tall structure. Qiao et al. [14] have studied a real-time and accurate underwater target classifier that can be created by combining Local Wavelet Acoustic Patterns (LWAPs) and multilayer perceptron (MLP) neural networks. They first improve the Whale Optimization Algorithm (WOA) and then optimize the classifier’s parameters [14]. Extensive research has been done on fluid sloshing modeling. [15] Fluid sloshing modeling in a carrier tank has been performed in two ways: mechanical model (pendulum) and simulation based on the SPH method. In this research, the issue of fluid tanker overturning has been investigated. Simulation of sloshing behavior in the tank has been performed by two methods, CFD and SPH [16]. The results of the two methods are compared [17], and the SPH method is used to model fluid sloshing phenomena. The algorithm used in this method to solve Poisson and momentum pressure equations includes various subalgorithms such as core gradient correction, particle displacement algorithms, sloshing viscosity calculators, and free surface detectors. Also, the size of the baffles in the tank to reduce sloshing has been studied and evaluated. As seen in all previous research, constant volume simulations have been considered. In spatial applications, the change in fluid volume in the reservoir will lead to changes in sloshing behavior. On the other hand, different modes of movement in the tank and fluid displacement relative to the tank and its effects on the amount of force created to investigate the maximum pressure are another important point of the present study.Furthermore, even though the SPH modeling technique is commonly used in the scientific community, few engineering implementations have been published due to its relatively high computational cost. Determining a completely accurate model of the behavior of a physical phenomenon is a challenging task. However, today, using computational expressions, especially artificial intelligence, it is possible to obtain a model close to the behavior of that phenomenon. A model is a mathematical representation of a real system that can be constructed based on various methods [18]. Given that most systems have nonlinear and complex behavior, modeling should be based on an approach based on physical mechanisms governing system behavior. The models thus obtained have a sufficient approximation of the actual process [19]. Many methods have been proposed to identify the system. Among the available methods, the artificial neural network method can be used as one of the important tools for determining to model. A combination model based on wavelet transform for predicting the natural gas based on machine learning method was studied in some papers in recent year [20, 21]. Much research has been done on using simulation data to train neural networks [22]. A neural network is used to predict aerodynamic coefficients. Training data for the neural network are derived from wind tunnel test measurements and numerical simulations. A comparative study of neural network prediction performance is also presented based on different transmission functions and educational data set sizes. Peng et al. [23] have implemented a model that forecasts the natural gas load daily using long short term memories, local mean decompositions, and wavelet threshold denoising algorithms. [24] A common modeling method using machine learning based on simulation data is used. In this research, a hypothetical model is created through a simulation model, and the necessary parameters and functions for modeling are presented using an artificial neural network model (machine learning) [25]. The neural network is used to predict the parameters of a diesel engine such as braking power, output torque, brake specific fuel consumption, brake thermal efficiency, and volumetric efficiency. Input data for network training were obtained from laboratory and simulation results. Data training was based on the backpropagation algorithm. Noghrehabadi et al. (2020) have examined how different heat fluxes affect the melting behavior of phase transition materials when they are surrounded by metal foam. To do this, a two-dimensional numerical model was utilized that took into account the nonequilibrium thermal component, the non-Darcy effect, and local natural convection [26]. Liu et al. [27] used a CFD model of the blowdown valve erosion issue to study the erosion simulation and improvement strategy for the separator blowdown system. A flow field analysis program called FLUENT is used to simulate and evaluate the erosion of the blowdown valve under various pressures, sand particle size and form factor, sand particle density, and sewage sediment concentration, and the major erosion issue of the blowdown system is determined [27]. Schmid et al. [28] present the optimal machine settings in polymer processing using a simulation-based machine learning model. In this research, different supervised machine learning algorithms are compared, and the best approach in experiments on a real machine is predicted using the initial settings of the device. Behbahan et al. [29] have used a metal foam/phase change PCM combination in the study, which has been demonstrated to be one of the most promising techniques for increasing thermal conductivity on PCMs. Findings show that selecting an aspect ratio that facilitates both conduction and convection heat transfer is extremely important [29]. Peng et al. [30] have analyzed the role of computational fluid dynamic tools in studying pathogen transmission. Using CFD models, they have studied airborne pathogens [30]. In another study, using the neural network method, the behavior of sloshing in a tank containing liquid under harmonic motion, and using the coordinates of the sloshing wave curve based on the results of the SPH method, the sloshing behavior was predicted [31].In the previous study, the sloshing behavior of the fluid was investigated based on the prediction of the fluid wave curve and the input data of the neural network included the position, speed and acceleration of the tank and the result of the neural network was the model of the sloshing wave curve. But in this new paper, sloshing behavior is considered based on changes in the physical parameters of the fluid and the tank. This paper simulates changes in parameters such as fluid volume, fluid position, tank position, and range of motion for different inputs. Then, based on the values obtained, the sloshing model is determined using the neural network method. The neural network to predict the fluid wave curve in the reservoir and other sloshing behavior based on the wave has been evaluated. Tank and fluid conditions were considered constant in the previous paper. This study was aimed at determining the fluid sloshing model in the tank based on different inputs. Changes in fluid volume, tank velocity, and tank motion amplitude can cause different results in fluid sloshing behavior. For this purpose, first, the smooth particle hydrodynamic method is used to simulate the fluid in the tank. Various states are considered based on their variable inputs, and the forces due to fluid sloshing are determined. An artificial neural network is used to model the fluid sloshing in the next step. This network is trained based on input and output data (SPH simulation results). Input data include changes in fluid volume, displacement rate, and tank velocity, and output data include the maximum force generated by fluid sloshing.


## 2. Governing Equations in Fluid Simulation

### 2.1. Mathematical Model

Since the fluid is believed to be incompressible, irrational, and inviscid water, the sloshing in tanks is defined using the potential flow theory. The surface tension is ignored. As seen in Figure1, the domain is a rigid rectangular container with and without baffle configuration that is partly filled with liquid. The free surface is believed never to get overturned or broken through the sloshing operation. The rectangular tank’s length and water depths are L and h, respectively. Consider the case of a rectangular rigid tank that has been exposed to lateral sinusoidal excitation x (t) [32]. The linearized fluid field equations for a two-dimensional fluid motion, assuming a small excitation amplitude and a small fluid response, are as follows:
(1)∂2φ∂x2+∂2φ∂z2=0,(2)∂φ∂xx=±L/2=0,(3)gη−∂φ∂t+x¨tx=0atz=ηx,t,(4)−∂φ∂z=∂η∂tatz=ηx,t,Figure 1
The coordinate system of the tank.wherez is the vertical axis direction, x is the horizontal axis direction, t denotes time, x″ is the vector of acceleration, g represents the vector of gravity acceleration, and η is the wave height. Combining the dynamic and kinematic free-surface conditions (3) and (4) yields a single state:
(5)g∂φ∂z+∂2φ∂t2=x¨tx.The total potential function is the sum of fluid perturbed functionΦ, which is the solution of Laplace’s Equation (1) that satisfies the boundary conditions (3 and 4) plus the tank potential function Φ0=−X0xΩcosΩt. Nevertheless, the expression x must be expressed in the Fourier series:
(6)x=4Lπ2∑n=0∞−1n2n+12sin2n+1πxL.The steps for determining the velocity potential function are the same as for a tank, with the same outcome:(7)φ=−x0ΩcosΩt×x+∑n=0∞−1nsin2n+1πx/Lcosh2n+1πz+h/Lπ22n+12cosh2n+1πh/L×4LΩ2ωn2−Ω2,where Ω is the excitation frequency and ωn2=2n+1πg/Ltanh2n+1πh/L is the square of the natural frequency of a fluid-free surface; replacing Equation (7) into Equation (3) yields the free-surface wave height.
(8)n=Ω2x0gsinΩtxx−∑n=0∞−1nπ22n+124LΩ2ωn2−Ω2×sin2n+1πxL.The first term in Equation (8) describes a simple wave, and a set of symmetric sine waves make up the surface waves. The pressure inside the fluid domain at every point (ignoring the hydrostatic pressure, ρgz) is
(9)P=ρ∂φ∂t=−ρΩφtanΩt.The hydrodynamic pressure at any point on the wall side,x=L/2, is
(10)Pw=ρΩ2x0sinΩt×L/2−∑n=0∞cosh2n+1πz+h/Lπ22n+12cosh2n+1πh/L×4LΩ2ωn2−Ω2.The net wall pressure distribution parameter,ΔPw/ρgx0, is shown in Figure 2 for various values of the excitation frequency parameter, Ω2L/g. A similar situation to the phase change mentioned in the previous segment can also be observed.Figure 2
Under lateral excitation, a rectangular tank’s wall pressure distribution corresponds to the first antisymmetric mode [32].


### 2.2. Analytical Results

Infinite series describe possible expressions, and they must be shortened. Here, we conduct a convergence analysis concerning series numberN. The tank’s dimensions and parameters are h=0.18, 0.28, and 0.38. The external excitation frequency is Ω=3.116rad/s, and the motion can be expressed as X=x0sinΩt. Figures 3, 4, and 5 display the findings of N=10, which show that they agree. To plot pressure value based on Equation (10), the value of the parameters of the above relation is as follows: L=1.3, h=0.18, 0.28, and 0.38,x0=0.1.Figure 3
Variation in pressure acting on the tank wall forh=0.18.Figure 4
Variation in pressure acting on the tank wall forh=0.28.Figure 5
Variation in pressure acting on the tank wall forh=0.38.


## 2.1. Mathematical Model

Since the fluid is believed to be incompressible, irrational, and inviscid water, the sloshing in tanks is defined using the potential flow theory. The surface tension is ignored. As seen in Figure1, the domain is a rigid rectangular container with and without baffle configuration that is partly filled with liquid. The free surface is believed never to get overturned or broken through the sloshing operation. The rectangular tank’s length and water depths are L and h, respectively. Consider the case of a rectangular rigid tank that has been exposed to lateral sinusoidal excitation x (t) [32]. The linearized fluid field equations for a two-dimensional fluid motion, assuming a small excitation amplitude and a small fluid response, are as follows:
(1)∂2φ∂x2+∂2φ∂z2=0,(2)∂φ∂xx=±L/2=0,(3)gη−∂φ∂t+x¨tx=0atz=ηx,t,(4)−∂φ∂z=∂η∂tatz=ηx,t,Figure 1
The coordinate system of the tank.wherez is the vertical axis direction, x is the horizontal axis direction, t denotes time, x″ is the vector of acceleration, g represents the vector of gravity acceleration, and η is the wave height. Combining the dynamic and kinematic free-surface conditions (3) and (4) yields a single state:
(5)g∂φ∂z+∂2φ∂t2=x¨tx.The total potential function is the sum of fluid perturbed functionΦ, which is the solution of Laplace’s Equation (1) that satisfies the boundary conditions (3 and 4) plus the tank potential function Φ0=−X0xΩcosΩt. Nevertheless, the expression x must be expressed in the Fourier series:
(6)x=4Lπ2∑n=0∞−1n2n+12sin2n+1πxL.The steps for determining the velocity potential function are the same as for a tank, with the same outcome:(7)φ=−x0ΩcosΩt×x+∑n=0∞−1nsin2n+1πx/Lcosh2n+1πz+h/Lπ22n+12cosh2n+1πh/L×4LΩ2ωn2−Ω2,where Ω is the excitation frequency and ωn2=2n+1πg/Ltanh2n+1πh/L is the square of the natural frequency of a fluid-free surface; replacing Equation (7) into Equation (3) yields the free-surface wave height.
(8)n=Ω2x0gsinΩtxx−∑n=0∞−1nπ22n+124LΩ2ωn2−Ω2×sin2n+1πxL.The first term in Equation (8) describes a simple wave, and a set of symmetric sine waves make up the surface waves. The pressure inside the fluid domain at every point (ignoring the hydrostatic pressure, ρgz) is
(9)P=ρ∂φ∂t=−ρΩφtanΩt.The hydrodynamic pressure at any point on the wall side,x=L/2, is
(10)Pw=ρΩ2x0sinΩt×L/2−∑n=0∞cosh2n+1πz+h/Lπ22n+12cosh2n+1πh/L×4LΩ2ωn2−Ω2.The net wall pressure distribution parameter,ΔPw/ρgx0, is shown in Figure 2 for various values of the excitation frequency parameter, Ω2L/g. A similar situation to the phase change mentioned in the previous segment can also be observed.Figure 2
Under lateral excitation, a rectangular tank’s wall pressure distribution corresponds to the first antisymmetric mode [32].


## 2.2. Analytical Results

Infinite series describe possible expressions, and they must be shortened. Here, we conduct a convergence analysis concerning series numberN. The tank’s dimensions and parameters are h=0.18, 0.28, and 0.38. The external excitation frequency is Ω=3.116rad/s, and the motion can be expressed as X=x0sinΩt. Figures 3, 4, and 5 display the findings of N=10, which show that they agree. To plot pressure value based on Equation (10), the value of the parameters of the above relation is as follows: L=1.3, h=0.18, 0.28, and 0.38,x0=0.1.Figure 3
Variation in pressure acting on the tank wall forh=0.18.Figure 4
Variation in pressure acting on the tank wall forh=0.28.Figure 5
Variation in pressure acting on the tank wall forh=0.38.


## 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 presented below and several key implementation problems. For a more detailed summary, the reader is directed to [33]. The interpolation principle underpins the SPH system. Using a kernel function, any function can express its values at a set of disordered points representing particle positions. The kernel function is a weighting function that specifies the input of a general field vector, Ar, at a given location, r. An r′s kernel estimate is defined as follows ([12, 33].
(11)Ar=∫VAr′δr−r′,ddr′.The smoothing lengthd defines the efficient kernel width in which r is the position of vector, Vis the space for the solution, and d is the length for the smoothing. The particle approximation of the function at a particle i can be described as follows using discretization of approximation (11):
(12)Ar=∑b=jNmjρjAjWij,where m is the mass of the particle and ρ is the density of each particle. Index i represents the central particle, and j represents each particle in the area of influence of the central particle (neighboring particle). The smooth length in this study is equal to 1/2 of the initial distance between the particles. All particles inside the kernel function’s compact support region must be considered at the summation. Wij=Wri−rj,d is the weight function or kernel, and mj and ρj denote the mass and density, respectively. One of the kernel functions used in this work is the one introduced initially by Nyugen et al. [34] as in
(13)Wr,d=αd1−32q2+34q3⟶0≤q<1142−q2⟶1≤q<20⟶q>2,where αd is the 10/7πd2 in 2D and q=r/d. r is the distance between two points, i and j.


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

To model fluid motions, the SPH formalism is extended to the Navier Stokes equations. This method is briefly explained here. Detailed descriptions are provided by [33]. The governing equations are the continuity and Navier-Stokes equations:
(14)1ρDρDt+∇.v⟶=0,Dv⟶Dt=−1ρ∇p+g+v∇2.v⟶,where v refers to the vector velocity of the particles, t denotes time, ρ denotes fluid density, p denotes the pressure, g denotes the vector of gravity acceleration, and ν refers to the viscosity of the laminar. As the actual state equation is carried out, the time stage is very small due to the finite compressibility of real fluids. Consequently, the fluid is usually considered weakly compressible in real measurement. The pressure field is calculated by solving the P=Pρ,e equation. When the fluid pressure is below 1GPa, the entropy impact on the pressure field can be neglected ([12, 33]. The density of a fluid is solely determined by its pressure. The SPH equations consist of the mass conservation equation, the energy conservation equation, and the energy conservation equation. When the pressure of the flow field is low, it is said that the fluid is barotropic, and energy does not affect the pressure field. The energy equation is still unresolved. The SPH method’s kernel and particle approximation define the density equations and the momentum equation [12] as follows:
(15)DρiDt=ρi∑j=1Nv⟶i−v⟶j∇WijVj,DviDt=g⟶−mi∑jpiρi2+pjρj2∇Wij+αh∑jpi+pjv⟶i−v⟶j.rijρi+ρjr⟶+ij20.01h2∇Wij,whereρ is the density of each particlev refers to the vector velocity of the particles, p denotes the pressure, g denotes the vector of gravity acceleration, and smoothing length h defines the efficient kernel width in which r is the position of vector, rij=ri–rj. Besides, W is the function of the kernel, and the enhanced Gaussian kernel is selected (mentioned in Section 2.2). The subscripts i and j describe a pair of interacting particles. In the preceding simulations, the coefficient α is set to 0.03.


### 3.3. Weakly Compressible SPH

The WCSPH assumes a compressible fluid with a higher sound speed, a Mach number ofM~0.1, and a density variation of less than 1%. The pressure is then measured using a state equation. The most famous state equation used in SPH is of the type ([33, 34] Here, we study the accuracy of the traditional WCSPH method using the Tait equation of state:
(16)p=ρ0cs2γρρ0γ−1,where P denotes the fluid’s nominal density (1000 kg/m3), γ denotes a fixed set to 7, and csdenotes the numerical sound speed utilized in the measurement. In SPH, the sound speed is normally set to 10 times the predicted maximum velocity of the fluid Vmax[12]. Since density changes with the square of the Mach number, it is likely to be about 1% of the fluid’s nominal density. Therefore, the numerical sound speed is kept low enough to allow for appropriate time measures. The calculations were performed with a Reynolds number of Re=1000 and Re=ρ2g1/2D3/2/μ, where D is the depth of water in the tank and g=9.81m/s2 is the gravitational acceleration.


## 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 presented below and several key implementation problems. For a more detailed summary, the reader is directed to [33]. The interpolation principle underpins the SPH system. Using a kernel function, any function can express its values at a set of disordered points representing particle positions. The kernel function is a weighting function that specifies the input of a general field vector, Ar, at a given location, r. An r′s kernel estimate is defined as follows ([12, 33].
(11)Ar=∫VAr′δr−r′,ddr′.The smoothing lengthd defines the efficient kernel width in which r is the position of vector, Vis the space for the solution, and d is the length for the smoothing. The particle approximation of the function at a particle i can be described as follows using discretization of approximation (11):
(12)Ar=∑b=jNmjρjAjWij,where m is the mass of the particle and ρ is the density of each particle. Index i represents the central particle, and j represents each particle in the area of influence of the central particle (neighboring particle). The smooth length in this study is equal to 1/2 of the initial distance between the particles. All particles inside the kernel function’s compact support region must be considered at the summation. Wij=Wri−rj,d is the weight function or kernel, and mj and ρj denote the mass and density, respectively. One of the kernel functions used in this work is the one introduced initially by Nyugen et al. [34] as in
(13)Wr,d=αd1−32q2+34q3⟶0≤q<1142−q2⟶1≤q<20⟶q>2,where αd is the 10/7πd2 in 2D and q=r/d. r is the distance between two points, i and j.


## 3.2. Discretization of Governing Equations in SPH Formulation

To model fluid motions, the SPH formalism is extended to the Navier Stokes equations. This method is briefly explained here. Detailed descriptions are provided by [33]. The governing equations are the continuity and Navier-Stokes equations:
(14)1ρDρDt+∇.v⟶=0,Dv⟶Dt=−1ρ∇p+g+v∇2.v⟶,where v refers to the vector velocity of the particles, t denotes time, ρ denotes fluid density, p denotes the pressure, g denotes the vector of gravity acceleration, and ν refers to the viscosity of the laminar. As the actual state equation is carried out, the time stage is very small due to the finite compressibility of real fluids. Consequently, the fluid is usually considered weakly compressible in real measurement. The pressure field is calculated by solving the P=Pρ,e equation. When the fluid pressure is below 1GPa, the entropy impact on the pressure field can be neglected ([12, 33]. The density of a fluid is solely determined by its pressure. The SPH equations consist of the mass conservation equation, the energy conservation equation, and the energy conservation equation. When the pressure of the flow field is low, it is said that the fluid is barotropic, and energy does not affect the pressure field. The energy equation is still unresolved. The SPH method’s kernel and particle approximation define the density equations and the momentum equation [12] as follows:
(15)DρiDt=ρi∑j=1Nv⟶i−v⟶j∇WijVj,DviDt=g⟶−mi∑jpiρi2+pjρj2∇Wij+αh∑jpi+pjv⟶i−v⟶j.rijρi+ρjr⟶+ij20.01h2∇Wij,whereρ is the density of each particlev refers to the vector velocity of the particles, p denotes the pressure, g denotes the vector of gravity acceleration, and smoothing length h defines the efficient kernel width in which r is the position of vector, rij=ri–rj. Besides, W is the function of the kernel, and the enhanced Gaussian kernel is selected (mentioned in Section 2.2). The subscripts i and j describe a pair of interacting particles. In the preceding simulations, the coefficient α is set to 0.03.


## 3.3. Weakly Compressible SPH

The WCSPH assumes a compressible fluid with a higher sound speed, a Mach number ofM~0.1, and a density variation of less than 1%. The pressure is then measured using a state equation. The most famous state equation used in SPH is of the type ([33, 34] Here, we study the accuracy of the traditional WCSPH method using the Tait equation of state:
(16)p=ρ0cs2γρρ0γ−1,where P denotes the fluid’s nominal density (1000 kg/m3), γ denotes a fixed set to 7, and csdenotes the numerical sound speed utilized in the measurement. In SPH, the sound speed is normally set to 10 times the predicted maximum velocity of the fluid Vmax[12]. Since density changes with the square of the Mach number, it is likely to be about 1% of the fluid’s nominal density. Therefore, the numerical sound speed is kept low enough to allow for appropriate time measures. The calculations were performed with a Reynolds number of Re=1000 and Re=ρ2g1/2D3/2/μ, where D is the depth of water in the tank and g=9.81m/s2 is the gravitational acceleration.


## 4. Results and Discussion

### 4.1. Results of SPH Modeling

This section contains the results of the SPH simulation. In this study, Fortran code is used for the simulated model. To execute the simulation, the required parameters based on the SPH method are shown in Table1. These values include selecting the kernel function, tank dimensions, fluid height, and more.Table 1
The results are based on.
Kernel functionCubicTime-stepping algorithmSymplecticViscosity treatmentLaminar+SPSFluid height0.18, 0.28, 0.38Coefficient of speed of sound16 (recommended 10 - 40)Boundary conditionsDalrympleGeometry of the tankBox dimension:1.3×0.9The simulation results using the SPH method are shown in Figures6 and 7. Figure 6 shows the pressure on the tank wall on the right and left. This sloshing behavior has been performed in response to a sinusoidal stimulus. Figure 7 shows the sloshing waveform at different time steps. The show was performed using Tecplot software.Figure 6
Results of SPH method for pressure in a rectangular tank.Figure 7
Simulation of fluid sloshing in a rectangular tank.


### 4.2. Results of SPH Simulation

A schematic representation of the fluid tank is shown in Figure8. As can be seen, changes are intended for the four parameters. These parameters are fluid volume, fluid displacement, tank displacement, and displacement amplitude value. The fluid sloshing model is simulated for each of these parameters, and the maximum force due to the fluid sloshing is obtained.Figure 8
Schematic diagram of a 2D rectangular tank.As mentioned, it is considered three modes of each parameter earlier. Parameter changes can be done more in smaller steps but will take a lot of time and volume to simulate. Therefore, by combining three modes for the four parameters, 81 modes are created and the maximum force is determined. According to the results obtained from the simulation of fluid sloshing with the SPH method, the next step will be the neural network method to model the fluid sloshing behavior. The results are shown in Table2.Table 2
The results are based on the parameters of fluid position in the tank, tank displacement, fluid mass, and displacement amplitude value.
xXmUFmax1-0.65-20.50.01-14.76052-0.65-20.50.26526.855813-0.65-20.50.5241.874614-0.65-210.01-15.94465-0.65-210.26521.623316-0.65-210.52-35.39317-0.65-21.50.01-17.09718-0.65-21.50.265-26.91939-0.65-21.50.52-42.158110-0.6500.50.01-1311-0.6500.50.26523.1253912-0.6500.50.5238.1441913-0.65010.01-1314-0.65010.26524.152615-0.65010.5237.115416-0.6501.50.01-1317-0.6501.50.26520.1122818-0.6501.50.5232.239319-0.6520.50.0111.8726320-0.6520.50.26519.3949821-0.6520.50.5234.4137822-0.65210.0113.719123-0.65210.26526.6818924-0.65210.5239.6446925-0.6521.50.0115.5324226-0.6521.50.26527.6594427-0.6521.50.5239.78645280-20.50.01-5.83135290-20.50.26519.33819300-20.50.5234.35699310-210.01-8.41395320-210.265-23.5699330-210.52-38.7781340-21.50.01-10.998350-21.50.265-26.2368360-21.50.52-41.475637000.50.01-0.592838000.50.265-15.709239000.50.52-30.8256400010.01-0.5964410010.265-15.8046420010.52-31.012843001.50.01-0.597644001.50.265-15.836445001.50.52-31.075246020.50.015.83135147020.50.265-13.496548020.50.52-28.6129490210.018.413948500210.26516.00043510210.5228.9632252021.50.0110.4071453021.50.26520.1497454021.50.5232.27676550.65-20.50.01-12.4766560.65-20.50.265-27.593570.65-20.50.52-42.7094580.65-210.01-13.8647590.65-210.265-26.9549600.65-210.52-42.1631610.65-21.50.01-15.1063620.65-21.50.265-25.5543630.65-21.50.52-40.7931640.6500.50.0113650.6500.50.265-25.3802660.6500.50.52-40.4966670.65010.0113680.65010.265-19.1896690.65010.52-34.3978700.6501.50.0113710.6501.50.265-15.1539720.6501.50.52-30.3927730.6520.50.0114.76049740.6520.50.265-23.1675750.6520.50.52-38.2839760.65210.0115.94465770.65210.26515.94465780.65210.52-26.6325790.6521.50.0117.09708800.6521.50.26517.09708810.6521.50.5224.76706


### 4.3. Modeling Artificial Neural Network

As mentioned earlier, the most important part of this research is using data related to sloshing simulation in the tank for modeling. Therefore, the artificial neural network has been used to achieve a suitable model of sloshing behavior. Artificial neural networks are an alternative way to solve and predict complex problems and are used in various programs such as control, production, and optimization. [35]. The neural network is a multilayered feed-forward type with an error propagation algorithm. Multilayered feed-forward (MLFF) neural networks comprise two or more layers of neurons. The output of each layer is simply fed to the next layer, hence the name of the feed-forward networks.MLFF neural network is a robust network used in many applications. It is easy to implement and can give good results. For approximation problems, the function as a general model has good accuracy. The training process is easy compared to the RBF network [36]. MLFF neural network is more popular than other methods due to its wide application in most issues. Compared to other methods available in neural networks, its simple structure is another reason for its use (Fung, 2005). The ability of online training to adjust network control parameters is another advantage of this method. One of the important issues in using neural networks is determining the number of neurons, which is one of the main challenges of neural networks. Many scientists have recently worked to determine the optimal number of neurons needed to build a neural network (Yotov, 2020). If the number of neurons is too much, it will over-fit, resulting in a complicated neural network and other problems in the training process. It dramatically reduces generalizability, which leads to significant deviations in forecasts.On the other hand, an insufficient number of neurons reduces prediction accuracy. From this point of view, determining the appropriate number of hidden layer neurons to prevent over-fitting plays an essential role in approximating the function. There are several methods, but the most common are determining the appropriate and sufficient number of hidden layer neurons, cross-validation, and initial stop [37]. The available data is divided into two independent sets in these methods: an educational set and a validation or test set. Only the training set participates in neural network learning, and the test set is used to calculate the test error.


### 4.4. Data Collection, Normalization, and Determination of Neurons

The data obtained from the simulation of the SPH method were performed with Fortran software, and then, the data were collected in MATLAB software. The data collection process is such that for each mode of simulation, for example, a tank with a volume of fluid with a height of 0.18 can be considered in 10 seconds. The maximum force is determined based on the generated wave. For all similar cases, this process is repeated, and finally, a set of data obtained from the simulation is used to train the neural network. One of the ways to reduce the difference between the simulation results based on the SPH method and the neural network method is to collect simulation data, which can be strengthened and improved by examining different modes of change of existing parameters.According to the status of the measurement parameters to normalize the sloshing behavior, normalization is used to standardize the data range. Data normalization is a database design technique. This method is to uniform the range of values related to different research variables and is also known as data scaling. If the unit of measurement of the studied variables is diverse, the data can be scaled using normalization methods [31]. The following formula is used to use this technique:
(17)Xn=xi−xminxmax−xmin,whereXmax and Xmin are the maximum and minimum values of X, respectively, and Xn is the X normalization value.Regarding the process of determining the neural network results based on the output layer, since the only output simulates the maximum amount of force generated by the fluid sloshing, the final layer neurons are a number. Regarding the number of hidden layer neurons, the appropriate number can be reached based on different methods. If the number of neurons is too much, it will over-fit, resulting in a complicated neural network and other problems in the training process. It dramatically reduces generalizability, which leads to significant deviations in forecasts. On the other hand, an insufficient number of neurons reduces prediction accuracy.


### 4.5. Neural Network Structure, Training, and Data Testing

The neural network structure used in this study is based on the neural network shown in Figure9. The network used is a multilayer perceptron. The data training in this network is based on the backpropagation algorithm. This algorithm is a learning method with more than one hidden layer in artificial neural networks that calculates the gradient of network weights. Wc1 is the weight connected between the input and hidden layers, and Wc2 is the weight combined between the hidden and the output layers. The activation function used here is of the sigmoid function type.
(18)gt=11+e−t.Figure 9
Schematic diagram of neural networks.Its derivative is as follows:(19)ġt=gt1−gt.For network training, the data obtained from the SPH model are randomly divided into three sets: 80% for network training, 10% to confirm that the network is being generalized, and to stop training before installation, and the remaining 10% is used as a network test that is completely independent of network generalization. The ANN training process obtains the optimal values for the adjustable weights and bias parameters to achieve the best fit between the input-output data. This is essentially a nonlinear optimization problem, and the cost function includes minimizing the mean square error (MSE). The root mean square errors (RMSEs) are shown in Figure10.Figure 10
The representation of neural network structure is based on the Tansig transfer function in the hidden layer and the Purelin transfer function in the output layer.


### 4.6. Neural Network Simulation Results

In this network, the number of hidden layer neurons is considered to be 10. Regression graphs are widely used to predict and identify the relationship between independent and dependent variables. Here, R is represented as the regression symbol. Several hidden layer neurons were assigned based on the result of network convergence and with several repetitions. Based on the regression graph, the accuracy of the data training is acceptable (Figure11). Figure 12 shows a comparison between actual results and network results. The application of this modeling is in control systems to evaluate and investigate the effects of fluid sloshing in fuel carrier tanks, such as spacecraft, ships, or vehicles. In artificial neural network modeling, simulation data is based on modes in motion.Figure 11
The regression plot for train, validation, and test data.Figure 12
Simulation results of the neural network for train and test data.The data used in the neural network, which are the actual data, are shown in Section4.3 according to Table 2. The neural network consists of 4 inputs and one output. The results of neural network prediction are shown in Figure 12. The critical point in neural network training is to use pervasive data in this process. However, due to the conditions of numerical simulations that take a long time to implement, there is this limitation in data collection. Therefore, this training has been done with the minimum data obtained from the simulation based on the SPH method.Given that the accuracy of neural network prediction results is acceptable, it may encounter issues such as falling in local minimums, over-fitting, or under-training. While a multilayer network with sufficient neurons can perform almost any function, training algorithms such as backpropagation algorithms may not find the optimal weights. Therefore, to find a suitable option, a neural network can be placed in the repetition of the educational process to form this problem in the best way. Neural networks used to predict loads created by fluid sloshing based on input and output data for neural network training are more accessible than other numerical methods, making them superior.The actual results with the results obtained from the neural network are shown in Figure13. As can be seen, the neural network prediction is close to the actual values and the network has acceptable accuracy. Output values and actual data are based on normalized status.Figure 13
Results comparison of the neural network and train data.Figure14 shows the neural network results for the test data. As mentioned earlier, 10% of the simulation data is used to evaluate the performance of the neural network to predict the actual data.Figure 14
Results comparison of the neural network and test data.


## 4.1. Results of SPH Modeling

This section contains the results of the SPH simulation. In this study, Fortran code is used for the simulated model. To execute the simulation, the required parameters based on the SPH method are shown in Table1. These values include selecting the kernel function, tank dimensions, fluid height, and more.Table 1
The results are based on.
Kernel functionCubicTime-stepping algorithmSymplecticViscosity treatmentLaminar+SPSFluid height0.18, 0.28, 0.38Coefficient of speed of sound16 (recommended 10 - 40)Boundary conditionsDalrympleGeometry of the tankBox dimension:1.3×0.9The simulation results using the SPH method are shown in Figures6 and 7. Figure 6 shows the pressure on the tank wall on the right and left. This sloshing behavior has been performed in response to a sinusoidal stimulus. Figure 7 shows the sloshing waveform at different time steps. The show was performed using Tecplot software.Figure 6
Results of SPH method for pressure in a rectangular tank.Figure 7
Simulation of fluid sloshing in a rectangular tank.


## 4.2. Results of SPH Simulation

A schematic representation of the fluid tank is shown in Figure8. As can be seen, changes are intended for the four parameters. These parameters are fluid volume, fluid displacement, tank displacement, and displacement amplitude value. The fluid sloshing model is simulated for each of these parameters, and the maximum force due to the fluid sloshing is obtained.Figure 8
Schematic diagram of a 2D rectangular tank.As mentioned, it is considered three modes of each parameter earlier. Parameter changes can be done more in smaller steps but will take a lot of time and volume to simulate. Therefore, by combining three modes for the four parameters, 81 modes are created and the maximum force is determined. According to the results obtained from the simulation of fluid sloshing with the SPH method, the next step will be the neural network method to model the fluid sloshing behavior. The results are shown in Table2.Table 2
The results are based on the parameters of fluid position in the tank, tank displacement, fluid mass, and displacement amplitude value.
xXmUFmax1-0.65-20.50.01-14.76052-0.65-20.50.26526.855813-0.65-20.50.5241.874614-0.65-210.01-15.94465-0.65-210.26521.623316-0.65-210.52-35.39317-0.65-21.50.01-17.09718-0.65-21.50.265-26.91939-0.65-21.50.52-42.158110-0.6500.50.01-1311-0.6500.50.26523.1253912-0.6500.50.5238.1441913-0.65010.01-1314-0.65010.26524.152615-0.65010.5237.115416-0.6501.50.01-1317-0.6501.50.26520.1122818-0.6501.50.5232.239319-0.6520.50.0111.8726320-0.6520.50.26519.3949821-0.6520.50.5234.4137822-0.65210.0113.719123-0.65210.26526.6818924-0.65210.5239.6446925-0.6521.50.0115.5324226-0.6521.50.26527.6594427-0.6521.50.5239.78645280-20.50.01-5.83135290-20.50.26519.33819300-20.50.5234.35699310-210.01-8.41395320-210.265-23.5699330-210.52-38.7781340-21.50.01-10.998350-21.50.265-26.2368360-21.50.52-41.475637000.50.01-0.592838000.50.265-15.709239000.50.52-30.8256400010.01-0.5964410010.265-15.8046420010.52-31.012843001.50.01-0.597644001.50.265-15.836445001.50.52-31.075246020.50.015.83135147020.50.265-13.496548020.50.52-28.6129490210.018.413948500210.26516.00043510210.5228.9632252021.50.0110.4071453021.50.26520.1497454021.50.5232.27676550.65-20.50.01-12.4766560.65-20.50.265-27.593570.65-20.50.52-42.7094580.65-210.01-13.8647590.65-210.265-26.9549600.65-210.52-42.1631610.65-21.50.01-15.1063620.65-21.50.265-25.5543630.65-21.50.52-40.7931640.6500.50.0113650.6500.50.265-25.3802660.6500.50.52-40.4966670.65010.0113680.65010.265-19.1896690.65010.52-34.3978700.6501.50.0113710.6501.50.265-15.1539720.6501.50.52-30.3927730.6520.50.0114.76049740.6520.50.265-23.1675750.6520.50.52-38.2839760.65210.0115.94465770.65210.26515.94465780.65210.52-26.6325790.6521.50.0117.09708800.6521.50.26517.09708810.6521.50.5224.76706


## 4.3. Modeling Artificial Neural Network

As mentioned earlier, the most important part of this research is using data related to sloshing simulation in the tank for modeling. Therefore, the artificial neural network has been used to achieve a suitable model of sloshing behavior. Artificial neural networks are an alternative way to solve and predict complex problems and are used in various programs such as control, production, and optimization. [35]. The neural network is a multilayered feed-forward type with an error propagation algorithm. Multilayered feed-forward (MLFF) neural networks comprise two or more layers of neurons. The output of each layer is simply fed to the next layer, hence the name of the feed-forward networks.MLFF neural network is a robust network used in many applications. It is easy to implement and can give good results. For approximation problems, the function as a general model has good accuracy. The training process is easy compared to the RBF network [36]. MLFF neural network is more popular than other methods due to its wide application in most issues. Compared to other methods available in neural networks, its simple structure is another reason for its use (Fung, 2005). The ability of online training to adjust network control parameters is another advantage of this method. One of the important issues in using neural networks is determining the number of neurons, which is one of the main challenges of neural networks. Many scientists have recently worked to determine the optimal number of neurons needed to build a neural network (Yotov, 2020). If the number of neurons is too much, it will over-fit, resulting in a complicated neural network and other problems in the training process. It dramatically reduces generalizability, which leads to significant deviations in forecasts.On the other hand, an insufficient number of neurons reduces prediction accuracy. From this point of view, determining the appropriate number of hidden layer neurons to prevent over-fitting plays an essential role in approximating the function. There are several methods, but the most common are determining the appropriate and sufficient number of hidden layer neurons, cross-validation, and initial stop [37]. The available data is divided into two independent sets in these methods: an educational set and a validation or test set. Only the training set participates in neural network learning, and the test set is used to calculate the test error.


## 4.4. Data Collection, Normalization, and Determination of Neurons

The data obtained from the simulation of the SPH method were performed with Fortran software, and then, the data were collected in MATLAB software. The data collection process is such that for each mode of simulation, for example, a tank with a volume of fluid with a height of 0.18 can be considered in 10 seconds. The maximum force is determined based on the generated wave. For all similar cases, this process is repeated, and finally, a set of data obtained from the simulation is used to train the neural network. One of the ways to reduce the difference between the simulation results based on the SPH method and the neural network method is to collect simulation data, which can be strengthened and improved by examining different modes of change of existing parameters.According to the status of the measurement parameters to normalize the sloshing behavior, normalization is used to standardize the data range. Data normalization is a database design technique. This method is to uniform the range of values related to different research variables and is also known as data scaling. If the unit of measurement of the studied variables is diverse, the data can be scaled using normalization methods [31]. The following formula is used to use this technique:
(17)Xn=xi−xminxmax−xmin,whereXmax and Xmin are the maximum and minimum values of X, respectively, and Xn is the X normalization value.Regarding the process of determining the neural network results based on the output layer, since the only output simulates the maximum amount of force generated by the fluid sloshing, the final layer neurons are a number. Regarding the number of hidden layer neurons, the appropriate number can be reached based on different methods. If the number of neurons is too much, it will over-fit, resulting in a complicated neural network and other problems in the training process. It dramatically reduces generalizability, which leads to significant deviations in forecasts. On the other hand, an insufficient number of neurons reduces prediction accuracy.


## 4.5. Neural Network Structure, Training, and Data Testing

The neural network structure used in this study is based on the neural network shown in Figure9. The network used is a multilayer perceptron. The data training in this network is based on the backpropagation algorithm. This algorithm is a learning method with more than one hidden layer in artificial neural networks that calculates the gradient of network weights. Wc1 is the weight connected between the input and hidden layers, and Wc2 is the weight combined between the hidden and the output layers. The activation function used here is of the sigmoid function type.
(18)gt=11+e−t.Figure 9
Schematic diagram of neural networks.Its derivative is as follows:(19)ġt=gt1−gt.For network training, the data obtained from the SPH model are randomly divided into three sets: 80% for network training, 10% to confirm that the network is being generalized, and to stop training before installation, and the remaining 10% is used as a network test that is completely independent of network generalization. The ANN training process obtains the optimal values for the adjustable weights and bias parameters to achieve the best fit between the input-output data. This is essentially a nonlinear optimization problem, and the cost function includes minimizing the mean square error (MSE). The root mean square errors (RMSEs) are shown in Figure10.Figure 10
The representation of neural network structure is based on the Tansig transfer function in the hidden layer and the Purelin transfer function in the output layer.


## 4.6. Neural Network Simulation Results

In this network, the number of hidden layer neurons is considered to be 10. Regression graphs are widely used to predict and identify the relationship between independent and dependent variables. Here, R is represented as the regression symbol. Several hidden layer neurons were assigned based on the result of network convergence and with several repetitions. Based on the regression graph, the accuracy of the data training is acceptable (Figure11). Figure 12 shows a comparison between actual results and network results. The application of this modeling is in control systems to evaluate and investigate the effects of fluid sloshing in fuel carrier tanks, such as spacecraft, ships, or vehicles. In artificial neural network modeling, simulation data is based on modes in motion.Figure 11
The regression plot for train, validation, and test data.Figure 12
Simulation results of the neural network for train and test data.The data used in the neural network, which are the actual data, are shown in Section4.3 according to Table 2. The neural network consists of 4 inputs and one output. The results of neural network prediction are shown in Figure 12. The critical point in neural network training is to use pervasive data in this process. However, due to the conditions of numerical simulations that take a long time to implement, there is this limitation in data collection. Therefore, this training has been done with the minimum data obtained from the simulation based on the SPH method.Given that the accuracy of neural network prediction results is acceptable, it may encounter issues such as falling in local minimums, over-fitting, or under-training. While a multilayer network with sufficient neurons can perform almost any function, training algorithms such as backpropagation algorithms may not find the optimal weights. Therefore, to find a suitable option, a neural network can be placed in the repetition of the educational process to form this problem in the best way. Neural networks used to predict loads created by fluid sloshing based on input and output data for neural network training are more accessible than other numerical methods, making them superior.The actual results with the results obtained from the neural network are shown in Figure13. As can be seen, the neural network prediction is close to the actual values and the network has acceptable accuracy. Output values and actual data are based on normalized status.Figure 13
Results comparison of the neural network and train data.Figure14 shows the neural network results for the test data. As mentioned earlier, 10% of the simulation data is used to evaluate the performance of the neural network to predict the actual data.Figure 14
Results comparison of the neural network and test data.


## 5. Conclusion

The behavior of the fluid sloshing phenomenon was investigated in a rectangular tank. Fluid sloshing was simulated using the SPH method. Different modes were considered based on fluid volume, amount of range of motion, and fluid displacement. Based on changes in existing parameters, the maximum force on the tank wall was obtained. In the next step, the model of fluid sloshing behavior was determined using an artificial neural network. Fluid sloshing in the tank is a nonlinear phenomenon, so one of the tools that can help predict its behavior is the use of artificial neural networks. The main and important reason for us to use this approach is to achieve a predictive block because we want to couple in the next step with a dynamic case. Extensive research in the field of fluid sloshing in the tank usually uses mechanical models equivalent to mass-spring or pendulum. This data plays an important role in neural network training. The obtained data have the ability to determine the appropriate results in exchange for changing various parameters. Limitations in simulating fluid sloshing in the tank and coupling all data to the dynamic system have led to the use of the neural network as a predictive block to apply force and load to the system. Simulation data were used to train the neural network. In this process, the network input consisted of 4 parameters and the output of one parameter. The purpose of fluid sloshing modeling using neural networks is to achieve an alternative model instead of mechanical equivalent models such as the mass-spring or pendulum models. This model can be used in control systems and induce the effects of fluid sloshing in liquid carrier tanks to the dynamic system.



---

*Source: 4121956-2022-04-11.xml*