The Results Comparison of Numerical and Analytical Methods for Electric Potential on Rectangular Pipes

Two methods can be used to solve the problem of electric potential distribution in a rectangular pipe: numerical and analytical. The analytical solution is obtained using the Laplace equation and the given boundary conditions to complete the solution in the form of a linear combination of sinusoidal and hyperbolic functions. While the numerical solution is obtained using the finite difference method in the Python programming language. The comparison between the analytical and numerical solutions shows that the two have a good fit. This can be seen from the graph of the electric potential distribution in the rectangular pipe produced by the two methods. Numerical solutions obtained using the finite difference method in the Python programming language provide accurate and efficient results in solving the problem of the electric potential distribution in rectangular pipes. The use of the first four terms in the analytical method and the selection of 4 observation points on the pipe, namely points A (3.33, 1.67), B (3.33, 3.34), C (6.67, 1.67), and D (6.67, 3.34) produces a difference in the electric potential value between analytical and numerical methods each point is 35.91%, 51.96%, 51.96%, and 35.91%. The value difference between analytical and numerical methods will be smaller if more terms are taken in the analytical calculation, and more observation points are considered on the pipe.


Introduction
Electromagnetic problems are increasingly interesting to study because there are more and more applications in engineering fields such as Maxwell fluid electro-osmotic flows [1], electrically conductive ferrofluid flows [2,3], incompressible liquid metal MHD flows [4,5], metal beam pipe waveguides [6], and many more.For this application, it is necessary to analyze the distribution of electric and magnetic fields in the space of a particular object [7].If the distribution of the electric and magnetic fields has been obtained, it will be possible to determine the electrically charged liquids' pattern and trajectory of motion.The opposite can also be done.An electrically charged liquid's motion pattern and trajectory can be made by adjusting the distribution pattern of the electric and magnetic fields.
Recent developments have provided various analyses of the distribution of electric and magnetic fields, which are better than previous methods.Some examples include MHD analysis of LLCB TBM [8], hybrid techniques combining ray tracing and FDTD methods [9], and expansion methods based on Rayleigh-Ritz [10].
Two approaches can be used to analyze the distribution of electric and magnetic fields, namely the analytical and numerical methods.The analytical approach method is based on solving differential equations with standard techniques found in calculus and solving boundary conditions of the physical system [11][12][13][14].The numerical approach method is based on a numerical solution using a computer program carried out iteratively until the required accuracy is obtained [15].Both of these approaches have their advantages and disadvantages.The advantage of the analytical method is that it can provide more exact values.
Meanwhile, the disadvantage of analytical methods is that they can only be applied to certain systems.The advantage of numerical methods is that they can be applied to systems more generally.Meanwhile, the disadvantage of numerical methods is that they provide less accurate values.One thing that needs to be studied from these two approaches is the accuracy of the results of each method.This paper will discuss the comparative results between the analytical and numerical approaches in the case of electric potential distribution in rectangular pipes.The novelty of the results of this study is related to the use of the latest open-system software such as Python.Not many electrostatic studies have used the latest open-system software such as Python as a tool.

Method
In this paper, two methods are used, analytically and numerically.In the analytical method, the Laplacian equation that represents the physical system is solved analytically, which referred to a similar process in [11][12][13] by some mathematical tool, whereas in the numerical method using FDTD (Finite Different Time Domain) analysis to solve the boundary value problem, with the similar algorithm to [15].

Analytical Method
This part gives a rectangular pipe with infinite length on the z-axis.This pipe is represented in Figure 1.From the corresponding figure, it can be expressed mathematically as: .Since there is no free charge at this arbitrary point, it satisfies the Laplacian equation: By separation of variables, take an ansatz and define and then both sides are divided by The solution satisfies the previous equation only when both terms are constants.Considered the case when 0 Given that the boundary condition in the previous section that Where n C are eigen-constant.The complete solution is the sum of all eigen-solution, thus Here is the final analytical solution by looking at the condition where

Comparison between analytical and numerical solutions
In reviewing the accuracy of the numerical solution, a comparison between the numerical and analytical solutions is needed.The analytical solution used in this experiment takes the first four terms of the numerical solution to be compared against the results obtained from the running program.To simplify the calculation, only 4 observation points are taken on the pipe, dividing the interval on each axis into 4 points.The observed points are point A(3.33, 1.67), B(3.33, 3.34), C(6.67, 1.67), and D (6.67, 3.34).The analytical calculation yields the analytical solution for the electric potential values in alphabetical order, which are 58.512V, 26.019 V, 26.019 V, and 58.512 V.Meanwhile, the numerical results obtained are 37.499 V, 12.499 V, 12.499 V, and 37.499 V.The results of these two methods are presented in Figure 2. Thus, the difference in values between the two numerical solutions is 35.91%,51.96%, 51.96%, and 35.91%.The comparison between these two solutions can reduce the error value when more terms are taken in the analytical calculation, and more observation points are considered on the pipe, resulting in the numerical solution approaching the analytical solution in terms of accuracy.The differences in electric potential calculation results between analytical and numerical methods in Figure 2 can also be presented in three dimensions.Dimensional presentation only needs to add a third axis which states the potential magnitude at each position of the observation point.So in a threedimensional presentation, the electric potential values presented in the form of colors will be presented as graphic curves according to the values on the electric potential axis.The three-dimensional presentation of the differences in electric potential calculation results between analytical and numerical methods is shown in Figure 3.

Discussion
The problem to be solved in this experiment is the electric potential distribution in a 2-dimensional square pipe.To solve this problem, a second-order differential equation is needed to obtain the electric potential distribution at certain points in the pipe.The electric potential distribution in this pipe satisfies the Laplace equation because the charges on the conductor surface are fixed point charges so that the resistivity () is zero.The electric potential is distributed according to the boundary conditions given on the pipe.
A potential difference is given on the pipe, where the negative pole is placed at y = 0 at each x on the pipe's length axis, while the positive pole is placed at y = b at each x on the pipe's length axis.Then, the right and left sides of the pipe are not given a potential difference.Thus, the boundary conditions given on the pipe are V(x, 0) = V 0 , V(x, b) = V(0, y) = V(a, y) = 0. Next, the second-order differential equation is separated by variables so that the solution for each variable is obtained.The boundary conditions simplify the combined solution of the X and Y functions.Thus, substituting the boundary conditions results in the solution to the differential equation on the square pipe.
The obtained analytical solution will be projected into data visualization, such as graphs, so that the process of electric potential distribution in the square pipe can be observed.In this case, a programming method is needed to numerically solve the given square pipe problem as an approximation of the analytical solution.The method that can solve this second-order differential equation is a finite difference.The finite difference is a numerical method used to approximate the derivative of a function using the difference in values at discrete points.
In numerical methods, the finite difference approximates the solution of partial differential equations by discretizing the domain and approximating the derivative with a finite difference.This method is often used in numerical calculations because it is simple and easy to implement.Finite difference approximates the second-order differential equation that uses Taylor series expansion.This finite difference method has three approaches: forward, backward, and center.The finite difference center approach approximates the solution of the partial differential equation by using the function value at the point between two discrete points before and after the center point.Therefore, the finite difference center becomes a numerical calculation with accurate results.
Based on the final numerical results, the review of the electric potential distribution in a graph shows conformity with the analytical solution obtained.Thus, the numerical solution obtained from the finite difference method has results that are quite accurate with the analytical solution.However, it should be noted that this approach can be more accurate if more terms are taken in the analytical calculation, and the division of the interval on the pipe axis is increased.This can be seen in

Conclusions
The comparison between the analytical and numerical solutions shows that the two have a good fit.This can be seen from the error value of the electric potential distribution in the rectangular pipe produced by the FD method.However, it should be noted that this approach can be more accurate if more terms are taken in the analytical calculation, and the division of the interval on the pipe axis is increased.Numerical solutions obtained using the finite difference method in the Python programming language provide accurate and efficient results in solving the problem of the electric potential distribution in rectangular pipes.

Figure 1 .
Figure 1.Electrical potential boundary values in twodimensional x and y-axis cross-section rectangular pipe.
is the final analytical solution.

Figure 2 .
Figure 2. Graphic of electric potential for (a) analytic (exact) and (b) numeric solution in 2D.

Figure 3 .
Figure 3. Graphic of electric potential for (a) analytic (exact) and (b) numeric solution in 3D.

Figure 4 .
In this Figure, the electric potential graph is made with a greater number of points (101 points) compared to the number of points in Figure2.It can be seen that the electric potential graph in Figure4looks smoother than the electric potential graph in Figure2.

Figure 4 .
Figure 4. Graphic of electric potential with 101 points in (a) 2D and (b) 3D.