Next Article in Journal
Global Tracking Control for High-Order Odd-Rational-Powers Systems with Unknown Nonlinearities and Powers
Next Article in Special Issue
Projectile Motion in Special Theory of Relativity: Re-Investigation and New Dynamical Properties in Vacuum
Previous Article in Journal
Remarks on the Coefficients of Inverse Cyclotomic Polynomials
Previous Article in Special Issue
New Physical–Mathematical Analysis of Cardiac Dynamics and Temperature for the Diagnosis of Infectious Disease
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Calculation of the Magnetic Field of a Current-Carrying System

Joint Institute for High Temperatures of Russian Academy of Sciences, Izorskaya St. 13, 125412 Moscow, Russia
*
Author to whom correspondence should be addressed.
Mathematics 2023, 11(17), 3623; https://doi.org/10.3390/math11173623
Submission received: 9 July 2023 / Revised: 16 August 2023 / Accepted: 18 August 2023 / Published: 22 August 2023

Abstract

:
With regard to the study of the characteristics of electrovortex flows occurring indirect current electric arcs and electroslag smelting furnaces, a method has been developed for calculating the magnetic field in a current-carrying medium based on the calculation of the Biot–Savart–Laplace integral. The developed technique is focused on the use of unstructured grids and does not require a priori information about the shape of the computational domain. The technique has been tested on problems that have an analytical solution, i.e., the calculation of the distribution of the magnetic field in the cylinder and the calculation of the magnetic field of the ring with the current. The distributions of the magnetic field are obtained for the two-dimensional and three-dimensional cases. We used NVIDIA CUDA technology on graphic processor units (GPUs) to speed up calculations. A comparison of the calculation times on various CPUs and GPUs is given.

1. Introduction

The problem of accelerating the calculation of the magnetic field is important for the study of various natural and technical systems. Since the calculations of the magnetic field are quite expensive, so far, despite the development of computer technology, researchers prefer to find analytical algorithms for calculations [1], which indicates the relevance of improving numerical methods. In our work, we are focused on the numerical calculation of the magnetic field in relation to current-carrying systems that take place in various problems of electrometallurgy, where the problems of electrodynamics must be solved simultaneously with the problems of hydrodynamics [2,3]. There are also other areas where the approach described below can be applied. In terms of technical applications, for example, this includes the design and study of such a new object as a liquid metal battery [4,5]. As for the problem of studying natural systems, one can indicate the problem of studying the magnetic field in galaxies [6]. Moreover, the need to determine the magnetic field occurs in the domain of physiology, and in particular, in neuroscience [7].
Let us consider the problem of the occurrence of a flow under the action of an electromagnetic force in a conducting medium.
The electromagnetic force arises as a result of the interaction of the electric current passing through the molten metal with its own magnetic field (MF) in electrometallurgical installations designed for melting metal via the electroslag or electric arc method. This force causes an electrovortex flow (EVF), which significantly affects the hydrodynamics and heat transfer in the system [8].
The problem of electrovortex flow has been studied in various formulations and in many publications. The flow in a cylinder was extensively investigated in ref. [3]. A linear problem in a hemisphere was considered analytically in ref. [9]. In refs. [10,11], the problem in the hemisphere is considered both experimentally and numerically.
The scheme of EVF formation is shown in Figure 1, where B denotes magnetic field; J, the electric current density; U, the velocity; and F, the electromagnetic force.
In the numerical simulation of the hydrodynamics of EVF, it is necessary to solve the equation of motion in the liquid metal volume:
ρ U t + U U = p + ρ ν U + F ,
where p is pressure; ν is the coefficient of kinematic viscosity; ρ is density; and F is the electromagnetic force causing fluid movement: F = J × B. It is believed that the melt is not magnetic.
The current density can be found from the solution of the Laplace equation:
σ Φ = d i v U × B ,
J = σ Φ + J i n d
where Φ is the electrical potential; σ is the electrical conductivity of the medium; B is the total magnetic field in the liquid metal; J is the density of the electrical conduction current; and Jind is the electric current induced by the movement of the electrically conductive medium (Jind = σ(U × B)). Note that the induced current should not always be taken into account but only starting from certain values of the electric conduction current and the external magnetic field, as is described in more detail in refs. [12,13].
In the simplest case, such a problem requires a single calculation of the magnetic field, but taking into account the induced currents requires recalculating the magnetic field at each iteration of the calculation of the hydrodynamic problem to ensure the consistency of the current density field, magnetic field, and velocity. Since problems of this type are usually significantly non-stationary, the calculation speed of the magnetic field requires special attention.
A similar difficulty occurs in magnetohydrodynamic (MHD) problems with a deformable surface, when a change in the shape of the surface leads to a change in the distribution of the current density and, accordingly, a change in the distribution of the magnetic field (and, as a result, the acting electromagnetic force and the hydrodynamic pattern that affect the shape of the surface).
The total magnetic field has the following form:
B = B s e l f + B e x t + B i n d ,
where Bself is the magnetic field created by the conduction current J; Bext is the external magnetic field (which can include the Earth’s magnetic field [14], the magnetic field created by current leads, and the field created by mixing devices); and Bind is the magnetic field created by the induced current Jind.
The calculation of the magnetic field is an especially laborious task. At present, there are several main approaches to the numerical calculation of the magnetic field. These are differential methods that require solving the Laplace–Poisson equation and an integral method based on the Biot–Savart–Laplace law. The first class of methods can be more economical but more difficult to program, has difficulties in taking into account the boundary conditions, and requires a significant increase in the size of the computational grid. The fact is that differential methods require setting boundary conditions. A zero magnetic field at infinity is known a priori, so we have to find the magnetic field not only in the area under study but also in some part of space “to infinity”. To some extent, this drawback of differential methods can be overcome by using absorbing boundary conditions, when the area under study is surrounded by a wall of a specific anisotropic material at some distance, and the magnetic field lines entering this wall behave as if the wall is at infinity [15]. Perhaps the most efficient way can be as follows: using the integral method to determine the magnetic potential (or field) at the boundaries of the region and then solving differential equations inside the region within the found boundary conditions. This approach requires further research.
Moreover, these methods require the solution of the linear system, and the solution of the linear system is not parallelized very efficiently. Below, we present some comparisons between the performance of the differential and integral methods.
The method based on the Biot–Savart–Laplace law, due to its integral nature, can be parallelized to any number of threads (with corresponding proportional acceleration of computation), which can significantly increase the calculation speed through the use of parallel computing technology, for example, using graphics processors. Moreover, this method allows one to find the magnetic field only in the required area, without requiring the calculation of the magnetic field in the entire system of conductors that create a magnetic field. Finally, the integral method is easier to implement on unstructured grids, which is important because industrial devices usually have rather complex geometries.
Therefore, in this paper, we considered a method for calculating the magnetic field via the Biot–Savart–Laplace method using NVIDIA CUDA technology.

2. Method for Calculating the Magnetic Field for a Three-Dimensional System

Let us write the Biot–Savart–Laplace law and the components of the magnetic field in the Cartesian coordinate system:
B R 0 = μ 0 4 π V J × ( R 0 R ) R 0 R 3 d V ,
B x x 0 , y 0 , z 0 = μ 0 4 π V J y z 0 z J z y 0 y x x 0 2 + y y 0 2 + z z 0 2 3 2 d V ,
B y x 0 , y 0 , z 0 = μ 0 4 π V J z x 0 x J x z 0 z x x 0 2 + y y 0 2 + z z 0 2 3 2 d V ,
B z x 0 , y 0 , z 0 = μ 0 4 π V J x y 0 y J y x 0 x x x 0 2 + y y 0 2 + z z 0 2 3 2 d V .
Passing from continuous to discrete values, we obtain the expressions for the magnetic field for numerical calculation:
B x x 0 , y 0 , z 0 = μ 0 4 π j = 1 , i j N J y j z i z j J z j y i y j x i x j 2 + y i y j 2 + z i z j 2 3 2 V j ,
B y x 0 , y 0 , z 0 = μ 0 4 π j = 1 , i j N J z j x i x j J x j z i z j x i x j 2 + y i y j 2 + z i z j 2 3 2 V j ,
B z x 0 , y 0 , z 0 = μ 0 4 π j = 1 , i j N J x j y i y j J y j x i x j x i x j 2 + y i y j 2 + z i z j 2 3 2 V j ,
where J is the electric current density in the volume element dV; x0, y0, z0, R0, and i are coordinates, the radius vector, and the index of the point (the center of the grid cell) where the magnetic field is calculated; x, y, z, R, and j are similar values for an element with a current that creates a magnetic field at the desired point; V and ΔV are the total volume and volume of the computational cell; and N is the number of cells of the computational grid.
Since the order of summation does not matter, the method can be used on an unstructured grid when the grid is an array containing the coordinates of the vertices and centers of the cells and, a priori, there is no information about their order, shape, and size. The calculation of the magnetic field by the Biot–Savart–Laplace method on structured grids is presented in ref. [16].

3. Method for Calculating the Magnetic Field for an Axisymmetric System

Let us consider the calculation of the magnetic field for the cases when the current is distributed axisymmetrically, i.e., ∂Jr/∂φ = 0, ∂Jφ/∂φ = 0, ∂Jz/∂φ = 0. The Jr and Jz components result from the axisymmetric current spreading between the electrodes, and the Jφ component can be part of the induced current or the current specially created by the ring conductor.
Let us derive expressions for calculating the MF in an axisymmetric system. The expression for the magnetic field in an axisymmetric (cylindrical) coordinate system is easy to obtain from the Maxwell equation. However, in numerical calculations, this method is limited by the need to orient the sides of the cells along the coordinate axes; that is, it is necessary to use a regular grid in at least one direction, which may be unacceptable for solving other problems. Approximation of an irregular grid to a regular one results in a loss of accuracy. The question of transferring values to a new grid with the implementation of conservation laws also remains open. The method described below is relevant specifically for an irregular grid.
The current density vector in cylindrical coordinates has the following components: J(Jr, Jφ, Jz). Let the radius-vector of the point A0(r0, φ0, z0) where the MF is searched for be given: R0(r0, φ0, z0); the radius vector of the point (r, φ, z), whose current element creates the MF at the point A0: R(r, φ, z); and the vector directed from point A to point A0: R′ = R0R.
When working with expression (5) (Biot–Savart–Laplace law), one should be careful and remember that this form of notation is valid only in Cartesian coordinates.
We write the Cartesian components of the current density and vector R′ by expressing them in terms of the variables of cylindrical coordinates:
J = J r cos φ J φ sin φ ; J r sin φ + J φ cos φ ; J z ,
R = r 0 cos φ 0 r cos φ ; r 0 sin φ 0 r sin φ ; z 0 z ,
R = r 2 + r 0 2 2 r r 0 c o s ( φ 0 φ ) + ( z z 0 ) 2 ,
and we write expressions for each component of the magnetic field. The volume integral is expressed in terms of repeated ones as follows:
V   d V = 0 r ( z ) Z 1 Z 2 0 2 π   d φ d z d r ,
then:
B r r 0 , z 0 = μ 0 4 π 0 r ( z ) Z 1 Z 2 0 2 π J r sin ψ z 0 z + J φ c o s ψ z 0 z + J z r sin ψ r ( r 2 + r 0 2 2 r r 0 c o s ψ + ( z z 0 ) 2 ) 3 2 d ψ ,
B φ r 0 , z 0 = μ 0 4 π 0 r ( z ) Z 1 Z 2 0 2 π J r c o s ψ z 0 z + J φ sin ψ ( z 0 z ) + J z r 0 r c o s ψ r ( r 2 + r 0 2 2 r r 0 c o s ψ + ( z z 0 ) 2 ) 3 2 d ψ ,
B z r 0 , z 0 = μ 0 4 π 0 r ( z ) Z 1 Z 2 0 2 π J φ r r 0 c o s ψ J r r 0 s i n ψ r ( r 2 + r 0 2 2 r r 0 c o s ψ + ( z z 0 ) 2 ) 3 2 d ψ d z d r .
Here, ψ is the difference between the angular coordinates of the radius vectors R0 and R; ψ = φ0φ, r(z) is the dependence of the current radius of the computational domain on the axial coordinate; and Z1 and Z2 are the coordinates of the computational domain along the z axis.
Let us represent the integral (15) as the integral over the surface of the integral over the angle:
0 r ( z ) 0 Z 0 2 π   d φ d z d r = S 0 2 π r d ψ d S .
The integral over the surface can be calculated by sequential enumeration of all cells of the surface, and, obviously, the order of summation does not matter, then:
S G r 0 , z 0 , r , z d S i = 1 N G i Δ S i
G i = 0 2 π r d ψ ,
where ΔSi is the area of a cell in a two-dimensional grid; and Gi is the value of the function given in the center of the cell. This method of calculating the double integral is a two-dimensional analogue of the method of central rectangles and does not require information about the shape of the computational domain—the sum in formula (20) is, in fact, the summation of the elements of a one-dimensional array.
Consider the internal integrals (over the angle):
G r r 0 , z 0 , r , z = 0 2 π J r sin ψ z 0 z + J φ c o s ψ z 0 z + J z r sin ψ r ( r 2 + r 0 2 2 r r 0 c o s ψ + ( z z 0 ) 2 ) 3 2 d ψ ,
G φ r 0 , z 0 , r , z = 0 2 π J r c o s ψ z 0 z + J φ sin ψ ( z 0 z ) + J z r 0 r c o s ψ r ( r 2 + r 0 2 2 r r 0 c o s ψ + ( z z 0 ) 2 ) 3 2 d ψ ,
G z r 0 , z 0 , r , z = 0 2 π J φ r r 0 c o s ψ J r r 0 s i n ψ r ( r 2 + r 0 2 2 r r 0 c o s ψ + ( z z 0 ) 2 ) 3 2 d ψ ,
and parts of integrals with factor sin(ψ) are equal to zero:
0 2 π s i n ψ r 2 + r 0 2 2 r r 0 c o s ψ + z z 0 2 3 2 d ψ = 1 r r 0 r 2 + r 0 2 2 r r 0 c o s ψ + z z 0 2 0 2 π = 0 .
Here, we have discerned that only the φ-component of the current density contributes to the r and z components of the magnetic field, and the integrals are reduced to the following form:
G r r 0 , z 0 , r , z = 0 2 π J φ c o s ψ z z 0 r ( r 2 + r 0 2 2 r r 0 c o s ψ + ( z z 0 ) 2 ) 3 2 d ψ ,
G φ r 0 , z 0 , r , z = 0 2 π J z r 0 r c o s ψ J r c o s ψ z z 0 r ( r 2 + r 0 2 2 r r 0 c o s ψ + ( z z 0 ) 2 ) 3 2 d ψ ,
G z r 0 , z 0 , r , z = 0 2 π J φ r r 0 c o s ψ r ( r 2 + r 0 2 2 r r 0 c o s ψ + ( z z 0 ) 2 ) 3 2 d ψ .
In discrete form, the expressions for integrals have the following form:
B r r 0 , z 0 = μ 0 4 π S G r r 0 , z 0 , r , z d S = i = 1 N G r i Δ S i ,
B φ r 0 , z 0 = μ 0 4 π S G φ r 0 , z 0 , r , z d S = i = 1 N G φ i Δ S i ,
B z r 0 , z 0 = μ 0 4 π S G z r 0 , z 0 , r , z d S = i = 1 N G z i Δ S i .
The calculation of integrals over the surface presents no particular difficulties, and what is practically important does not require information about the shape of the computational domain.
The result of the analytical solution for the function G can be obtained using the elliptic Legendre integrals of the first and second kind:
E k = 0 π 2 1 k 2 s i n 2 ξ d ξ ,   0 k 1 ,
K k = 0 π 2 1 1 k 2 s i n 2 ξ d ξ ,   0 k 1 ,
where
k = 2 r r 0 ( r + r 0 ) 2 + ( z 0 z ) 2 .
Note that since only the j-component of the current density contributes to the r and z components of the magnetic field, the solution completely coincides with the expressions obtained in [17] for the magnetic field of the ring current. The expression for the j-component is also integrated analytically, and the result can be represented through special functions. Thus, the expressions for calculating the volume integrals over the angle ψ will look like the following:
G r r 0 , z 0 , r , z = μ 0 J φ 4 π 2 z 0 z r 0 r + r 0 2 + z 0 z 2 · K k r 0 , z 0 , r , z + r 2 + r 0 2 + z 0 z 2 r r 0 2 + z 0 z 2 E k r 0 , z 0 , r , z ,
G φ r 0 , z 0 , r , z = f 1 ( f 2 J r + f 3 J z E k r 0 , z 0 , r , z + ( f 4 J r + f 5 J z ) K ( k ( r 0 , z 0 , r , z ) ) ) ,
G z r 0 , z 0 , r , z = μ 0 J φ 4 π z 0 z r + r 0 2 + z 0 z 2 · K k r 0 , z 0 , r , z + r 2 r 0 2 z 0 z 2 r r 0 2 + z 0 z 2 E k r 0 , z 0 , r , z ,
where f1, f2, f3, f4, f5 are functions of r0, z0, r, z:
f 1 = 1 ( r 0 ( r r 0 ) 2 + ( z 0 z ) 2 ) 3 2 ( r r 0 ) 2 + ( z 0 z ) 2 ( r + r 0 ) 2 + ( z 0 z ) 2 ,
f 2 = z 0 z r 0 2 + r 2 + z 0 z 2 ,
f 3 = r 0 r r 2 r 0 2 + z 0 z 2 ,
f 4 = z 0 z r 0 r 2 + z 0 z 2 ,
f 5 = r ( r 0 r 2 + z 0 z 2 ) .
To calculate elliptic integrals, we used a method based on the expansion of integrands in a series using Chebyshev polynomials [18] (according to our estimates, this method provides somewhat greater accuracy than the arithmetic-harmonic mean method).
We express the elliptic integrals in terms of the hypergeometric function:
K k = π 2   F 1 2 , 1 2 , 1 ,   k 2 ,
E k = π 2 F 1 2 , 1 2 , 1 ,   k 2 ,
where
F a , b , c , d = 1 + k = 1 l = 0 k 1 a + l b + l 1 + l c + l z k = 1 + a b c z 1 ! + a a + 1 b b + 1 c c + 1 z 2 2 ! +
With the introduction of a new variable η=1 − k2, the integrals turn into expressions of the following form:
K k = K 1 η + K 2 η ln 1 η ,   0 η 1 ,
K 1 η = ln 4 + n = 1 1 2 3 2 2 n 1 2 2 2 4 2 2 n 2 ln 4 2 j = 1 2 n 1 j 1 j η n ,
K 2 η = 1 2 1 + n = 1 1 2 3 2 2 n 1 2 2 2 4 2 2 n 2 η n .
Expansion for the integral E(η):
E k = E 1 η + E 2 η ln 1 η ,       0 η < 1
E 1 η = 1 + η 2 [ ln 4 1 ] + n = 2 1 2 3 2 2 n 3 2 2 n 1 2 2 2 4 2 2 n 2 2 2 n 2 · · ln 4 2 1 + 2 2 2 2 n 3 + 2 2 n 2 1 2 n 1 + 1 2 n η n
E 2 η = η 4 + 1 2 n = 2 1 2 3 2 2 n 3 2 2 n 1 2 2 2 4 2 2 n 2 2 2 n 2 η n .
The approximation form looks like this:
K η = i = 0 n a i η i + ln 1 η j = 0 m b j η j = ln 4 + i = 1 n a i η i + ln 1 η 1 2 + i = 0 n b i η i
E η = 1 + i = 1 n c i η i + ln 1 η 1 2 + i = 0 n d i η i
The accuracy increases as the number of terms n increases. We have programmed an algorithm with ten terms: n = 10. The error in this case is about 10−18; such accuracy allows us to integrate the original function with sufficient accuracy for our problem. The coefficients ai, bi, ci, and di are given in the Table 1.
Further, the obtained expressions for the magnetic field were used when writing the program code using the NVIDIA CUDA technology.

4. Verification of Expressions for Magnetic Field on a Graphics Accelerator

4.1. Calculation of the Magnetic Field in a Cylinder and a Ring

CUDA is a software and hardware architecture that allows for parallel computing using graphics processors (GPU—Graphics Processing Unit). The calculations used NVIDIA GeForce RTX 3080 and RTX4090 video cards with a performance of 25067.5 GFLOPS and 75000 GFLOPS, respectively. We used CUDA ver. 10.1.105.
For verification, the magnetic field was calculated in a cylinder with finite dimensions—radius R = 0.01 m and length L = 1 m (Figure 2)—while an electric current with density Jz = 106 A/m2 flowed through the cylinder. This current created a magnetic field with components Bx, By in the Cartesian coordinate system (or Bj in the cylindrical coordinate system). To verify the magnetic field Bz and Br created by the current Jφ in the cylindrical coordinate system and the currents Jx, Jy in the Cartesian coordinate system, a ring with a current located in the z = 0 plane with a radius Rring = 0.05 m was placed in the computational domain; the current density in the ring was equal to 106 A/m2, and the cross-sectional area S =10−6 m2.
The results obtained were compared with the analytical solution for the magnetic field in an infinite cylinder: Bφ = μ0Jzr/2, and the analytical expressions from ref. [17] for the ring current were used for the Bz and Br components.

4.2. Calculation of the Magnetic Field in a Frustrum

Let the current be injected into a truncated cone of height L through a platform with radius r1. The current density distribution inside the cone can be found from geometric considerations (see Figure 3), we need only Jz component:
J z = I z 2 π r 1 2 z + z 2 .
Using Maxwell’s equation,
c u r l   B = μ 0 J ,
we can write:
c u r l   B z = 1 r r B φ r = μ 0 J z ,
and then the expression for the magnetic field has the following form:
B φ r , z = μ 0 I z 2 2 π r 1 2 z + z 2

4.3. Calculation of the Magnetic Field in a Hemisphere

Now, let us consider magnetic fields in the hemisphere. This geometry is very popular to consider because it is similar to the shape of molten metal in an electric arc furnace. We consider two concentric hemispheres and current I propagating from the inner hemisphere with radius R1 to the outer hemisphere with radius R2 (see Figure 4) Obviously, the current has a single component Jr (in spherical coordinates) and creates a single field component Bφ.
The distribution of the magnetic field in a hemisphere is also very easy to find. Let us take Equation (55); in a spherical coordinate system, taking into account axial symmetry, this equation will look like:
1 R sin θ θ B φ sin θ = I 2 π R 2 .
Given that the field is zero on the axis, we obtain the following:
B φ R , θ = μ 0 I 1 cos θ 2 π R sin θ .
This expression reaches its maximum at q = π/2, so we will use it for validation.
In all cases, the magnetic field of the current leads should be added to the field numerically calculated directly inside the region of interest according to the Biot–Savart–Laplace law. In the case of the cylinder, a sufficiently long one can be taken. In such cases, it should be clearly understood that in the contact zone of the supply wire and the computational domain, it may also be necessary to calculate the current density field.

5. Results of Calculations for a Three-Dimensional System

5.1. Results of Calculations in 3D-Cylinder with Ring

The verification of expressions for the three-dimensional cylinder is shown in Figure 5 (see Figure 5a). Component By (corresponding to component Bφ in cylindrical coordinates) is created by the current Jz in the cylinder.
The magnetic field of the ring is shown in Figure 5b. The By component (corresponding to the Bφ component in cylindrical coordinates) is calculated as a test; it is equal to zero since the azimuthal current should not create an azimuthal field component. Figure 5c presents the Bz component and Figure 5d presents the Bx component (corresponding to the Br component in cylindrical coordinates).
Calculations were performed on three different grids (244,000 cells; 2.5 million cells; and 10 million cells), and the calculation results agree satisfactorily. The discrepancy can be explained by the fact that the size of the computational domain along the z-axis is 100 times larger than along the xy axes, which leads to a significant increase in the size of the grid, with an increase in the number of cells due to the requirement that the dimensions of the cell faces should be approximately equal. It is impossible to build a grid of cubic elements in a round cylinder; however, the situation was improved by using square cells on the surface of the cylinder evenly distributed along the axis and increasing the number of cells to 10 million.

5.2. Results of Calculations in 3D-Frustum

Here we present the results of calculating the magnetic field for a three-dimensional frustum. The small radius of the cone was 0.01 m, the large radius of the cone was 1 m, and the height of the cone was 1 m. Moreover, thin current wire was attached from the side of the small radius cone. For analysis, a region of about 10 cm is used. The rest of the cone is needed for the problem to be formulated close to the analytical one.
Figure 6 shows the dependence of the calculated magnetic field in the cone on the radius and comparison with the analytical dependence. We pay attention to the following point, in a three-dimensional system, the points in which the field was calculated do not lie exactly on the output line, so the field values must be approximated, and the accuracy of the approximation depends on the number and size of cells. The analytical dependence was also calculated from the coordinates of the center of the cells, as a result of which sections of convexity and concavity are observed on the curve.

5.3. Results of Calculations in 3D-Hemisphere

We considered a hemisphere with a radius of 1 m. A current lead with a radius of 0.005 m enters the hemisphere.
Figure 7 shows the dependence of the calculated magnetic field in the hemisphere on the radius and comparison with the analytical dependence. The data are plotted along the radius at q = π/2 where the magnetic field is maximum.

5.4. Perfomance in 3D-Cases

Figure 8 shows performance histograms (acceleration) for various devices, where a performance factor of 1 corresponds to an Intel Core i5-12400f CPU when computed in 12 threads. The graph shows that using the Intel i9-13900k CPU (32 threads) allows you to increase performance by 4 times, and using NVIDIA RTX 3080 and RTX 4090 GPUs allows you to increase performance by 40–50 and 130 times, respectively. When we plotted the diagrams, we used the time to calculate the magnetic field in the cylinder; it does not matter what geometry is used; only the number of calculation cells is important.

6. Results of Numerical Calculations for an Axisymmetric System

The verification of expressions for the axisymmetric case in the cylinder and the ring is shown in Figure 9. Calculations were performed on three different grids (53 thousand cells; 250 thousand cells; and 1 million cells), and the results are in good agreement. The good agreement can be explained by the use of completely square cells and sufficiently large mesh sizes for the two-dimensional case.
Figure 10 presents the distribution of the magnetic field in the 2D frustum.
Figure 11 presents the distribution of the magnetic field in the 2D hemisphere.
Figure 12 shows performance histograms for various devices. From the graph, it can be seen that using the Intel i9-13900k CPU allows for a 3.5× increase in performance, and using NVIDIA RTX 3080 and RTX 4090 GPUs allows for a 173–216× and 270–530× increase in performance, respectively. The greater increase in the performance factor for the GPU relative to the 3D case (2–4 times faster) is most likely due to the features of the compiler.
Let us discuss possible ways to further increase productivity. The most obvious way is an extensive increase in hardware capacity. The use of multiple video cards should increase the effect of acceleration, while the complexity of programming will increase slightly. It also makes sense to use specialized accelerators such as specialized multicore processors such as NVIDIA Tesla (and the like). Intensive acceleration paths involve algorithmic optimization, and in particular, in our case, the most time-consuming operation is the calculation of the elliptic integral. Perhaps the use of new algorithms [19] can improve this situation. It is also possible to optimize other calculations; however, for example, our experiments have shown that using the “fast inverse root” operation does not speed up calculations with the compiler used (Microsoft Visual C++). Maybe modifying this method will help [20]. Moreover, the choice of compiler and operating system is a possible way to increase performance [21].

7. Notes on Using Commercial Codes

It is also interesting to compare the performance of our technique with some commercial code (see Table 1).
We calculated the magnetic field in a 2D cylinder with 232,000 cells in COMSOL 6.1 and compared the calculation time. Calculation times are presented in Table 2. Taking into account the quadratic law of the dependence of the solution time on the number of cells, for a similar number of cells (232 thousand), the calculation time using our method should be 16% less. COMSOL uses a differential method. This approach is faster than the integral method when using the CPU but much slower than our integral method on the GPU. Note that even the latest version of COMSOL does not support GPU calculations. Moreover, since, when using differential methods, we have to solve systems of linear equations, and parallel algorithms for them are much less efficient than for integrals, the prospects for significantly speeding up calculations when using GPUs are not so obvious. Moreover, the question of the equality of computational grids (in evaluating calculation performance) is not obvious, since COMSOL requires the calculation of an unnecessary magnetic field “in the air”, and the integral method must take into account the magnetic field of current leads.
Finally, we will touch upon the issue of heterogeneous computations. For example, when using ANSYS FLUENT for the calculation of hydrodynamics, it is impossible to effectively use the results found in other software products; thus, it is necessary to adapt ANSYS FLUENT by writing our own programs in C (for example, a program for calculating the magnetic field). In the latest versions of ANSYS, it is possible to exchange data between the Maxwell (electromagnetic module) and the FLUENT (hydrodynamic module), but this solution is also not efficient enough.

8. Conclusions

We have developed a method for the numerical calculation of the magnetic field on unstructured grids and adapted it for use in multithreaded calculations. The developed technique makes it possible to calculate stationary magnetic fields in relation to various industrial problems. For example, this is a study of electrovortex flows in electric welding processes, as well as in such devices such as a DC electric arc furnace, an electroslag melting furnace, and a liquid metal battery.
It has been found that modern graphic processors provide a significant increase in the speed of calculations on problems of this type (related to the calculation of integrals), even in comparison with the latest central processors (Intel i9-13900K).

Author Contributions

Conceptualization, I.T. and Y.I.; methodology, I.T.; software, D.V.; writing—original draft preparation, D.V.; writing—review and editing, I.T.; supervision, Y.I. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

All data obtained in the article can be reproduced using the methodology and the above formulas. In any case, the data that support the findings of this study are available on request from the corresponding author.

Acknowledgments

The authors are grateful to Anna Guseva for help with the calculations. This work was supported by the Ministry of Science and Higher Education of the Russian Federation (State Assignment No. 075-01129-23-00).

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Zhao, F.; Wang, W.; Zhou, W.; Zhou, X. Analytical model for calculation of the magnetic field of triaxial uniform coils in magnetically shielded cylinder. J. Phys. D Appl. Phys. 2022, 55, 345005. [Google Scholar] [CrossRef]
  2. Bojarevish, V.; Freibergs, Y.; Shilova, E.I.; Shcherbinin, E.V. Electrically Induced Vortical Flows; Kluwer Academic Publishers: Dordrecht, The Netherland; Boston, MA, USA; London, UK, 1989. [Google Scholar]
  3. Frick, P.; Mandrykin, S.; Eltishchev, V.; Kolesnichenko, I. Electro-vortex flows in a cylindrical cell under axial magnetic field. J. Fluid Mech. 2022, 949, A20. [Google Scholar] [CrossRef]
  4. Wu, S.; Zhang, X.; Wang, R.; Li, T. Progress and perspectives of liquid metal batteries. Energy Storage Mater. 2023, 57, 205–227. [Google Scholar] [CrossRef]
  5. Liu, G.; Kim, J.; Wang, M.; Woo, J.; Wang, L.; Zou, D.; Lee, J. Soft, Highly Elastic, and Discharge-Current-Controllable Eutectic Gallium–Indium Liquid Metal–Air Battery Operated at Room Temperature. Adv. Energy Mater. 2018, 8, 1703652. [Google Scholar] [CrossRef]
  6. Mikhailov, E.A.; Andreasyan, R.R. Initial Galactic Magnetic Fields and the Biermann Battery Mechanism. Astron. Rep. 2021, 65, 715–722. [Google Scholar] [CrossRef]
  7. Isakovic, J.; Dobbs-Dixon, I.; Chaudhury, D.; Mitrecic, D. Modeling of inhomogeneous electromagnetic fields in the nervous system: A novel paradigm in understanding cell interactions, disease etiology and therapy. Sci Rep. 2018, 8, 12909. [Google Scholar] [CrossRef] [PubMed]
  8. Yachikov, I.; Karandaeva, O.; Larina, T. Simulation of Electrovortex Flows in the Bath of the DC Electric Arc Furnace; NMSTU: Magnitogorsk, Russia, 2008; p. 231. [Google Scholar]
  9. Malyshev, K.; Mikhailov, E.; Teplyakov, I. Rapidly Convergent Series for Solving the Electrovortex Flow Problem in a Hemispherical Vessel. Comput. Math. Math. Phys. 2022, 62, 1158–1170. [Google Scholar] [CrossRef]
  10. Kharicha, A.; Teplyakov, I.; Ivochkin, Y.; Wu, M.; Ludwig, A.; Guseva, A. Experimental and numerical analysis of free surface deformation in an electrically driven flow. Exp. Therm. Fluid Sci. 2015, 62, 192–201. [Google Scholar] [CrossRef]
  11. Teplyakov, I.; Vinogradov, D.; Ivochkin, Y. Experimental Study of the Velocity of the Electrovortex Flow of In-Ga-Sn in Hemispherical Geometry. Metals 2021, 11, 1806. [Google Scholar] [CrossRef]
  12. Shcherbinin, E. Induction-free approximation in the theory of electrovortex flows. Magnetohydrodynamics 1991, 27, 308–311. [Google Scholar]
  13. Teplyakov, I.; Vinogrdov, D.; Ivochkin, Y.; Kharicha, A.; Serbin, P. Applicability of different MHD approximations in electrovortex flow simulation. Magnetohydrodynamics 2018, 54, 403–416. [Google Scholar] [CrossRef]
  14. Vinogradov, D.; Ivochkin, Y.; Teplyakov, I. Influence of the Earth’s Magnetic Field on the Structure of the Electrovortex Flow. Dokl. Phys. 2018, 483, 24–27. [Google Scholar] [CrossRef]
  15. Mur, G. Absorbing Boundary Conditions for the Finite-Difference Approximation of the Time-Domain Electromagnetic-Field Equations. IEEE Trans. Electromagn. Compat. 1981, EMC-23, 377–382. [Google Scholar] [CrossRef]
  16. Yachikov, I.; Zalyautdinov, R. Magnetic field in a dc arc-furnace bath with different current leads at the bottom electrode. Steel Transl. 2014, 44, 203–208. [Google Scholar] [CrossRef]
  17. Landau, L.D.; Lifshitz, E.M. Electrodynamics of Continuous Media, 2nd ed.; Nauka: Moscow, Russia, 1992; p. 164. [Google Scholar]
  18. Cody, W. Chebyshev Approximations for the Complete Elliptic Integrals K and E. Math. Comput. 1965, 19, 105–112. [Google Scholar] [CrossRef]
  19. Fukushima, T. Precise and fast computation of complete elliptic integrals by piecewise minimax rational function approximation. J. Comput. Appl. Math. 2015, 282, 71–76. [Google Scholar] [CrossRef]
  20. Walczyk, C.J.; Moroz, L.V.; Cieśliński, J.L. A Modification of the Fast Inverse Square Root Algorithm. Computation 2019, 7, 41. [Google Scholar] [CrossRef]
  21. Bolotnov, A.; Garifullina, S.; Nurislamova, E. The comparison of the effectiveness of the executable code generated by various compilers. In Proceedings of the 28th International Scientific-Practical Conference “Mathematical Modeling of Processes and Systems”, Sterlitamak, Russia, 30 October–1 November 2019. [Google Scholar]
Figure 1. Formation of the electrovortex flow in the electric arc furnace. 1—furnace shell; 2—unmolten metal; 3—molten metal; 4—electric arc; 5—electrodes.
Figure 1. Formation of the electrovortex flow in the electric arc furnace. 1—furnace shell; 2—unmolten metal; 3—molten metal; 4—electric arc; 5—electrodes.
Mathematics 11 03623 g001
Figure 2. Scheme of the cylindrical computational domain.
Figure 2. Scheme of the cylindrical computational domain.
Mathematics 11 03623 g002
Figure 3. Scheme of the conical computational domain.
Figure 3. Scheme of the conical computational domain.
Mathematics 11 03623 g003
Figure 4. Scheme of the hemispherical computational domain.
Figure 4. Scheme of the hemispherical computational domain.
Mathematics 11 03623 g004
Figure 5. The distribution of the different components of the magnetic field along the radius (z = 0.5 m) in the calculation on grids of different sizes: (a) field from Jz− By; field from the ring: (b) By, (c) Bz, (d) Bx. 1—244k cells; 2—2.5M; 3—10M. 4—analytical solution.
Figure 5. The distribution of the different components of the magnetic field along the radius (z = 0.5 m) in the calculation on grids of different sizes: (a) field from Jz− By; field from the ring: (b) By, (c) Bz, (d) Bx. 1—244k cells; 2—2.5M; 3—10M. 4—analytical solution.
Mathematics 11 03623 g005
Figure 6. The distribution of the component Bφ of the magnetic field in the 3Dfrustum along the radius at different distances from the small cone base: (a) 0.03 m; (b) 0.05 m; (c) 0.07 m. Grid sizes: 1—250k cells; 2—900k; 3—2.5M. 4—analytical solution.
Figure 6. The distribution of the component Bφ of the magnetic field in the 3Dfrustum along the radius at different distances from the small cone base: (a) 0.03 m; (b) 0.05 m; (c) 0.07 m. Grid sizes: 1—250k cells; 2—900k; 3—2.5M. 4—analytical solution.
Mathematics 11 03623 g006
Figure 7. The distribution of the component Bφ of the magnetic field in the 3D-hemisphere along the radius at θ = π/2. Grid sizes: 1—250k cells; 2—900k; 3—2.5M. 4—analytical solution.
Figure 7. The distribution of the component Bφ of the magnetic field in the 3D-hemisphere along the radius at θ = π/2. Grid sizes: 1—250k cells; 2—900k; 3—2.5M. 4—analytical solution.
Mathematics 11 03623 g007
Figure 8. Comparison of performance of the 3D problem on different CPUs and GPUs on the different grids. 1—Intel Core i5-12400f; 2—Intel Core i9-13900k; 3—NVIDIA GTX 3080; 4—NVIDIA GTX 4090.
Figure 8. Comparison of performance of the 3D problem on different CPUs and GPUs on the different grids. 1—Intel Core i5-12400f; 2—Intel Core i9-13900k; 3—NVIDIA GTX 3080; 4—NVIDIA GTX 4090.
Mathematics 11 03623 g008
Figure 9. The distribution of the different components of the magnetic field along the radius in the calculations on grids of different sizes:(a) Bφ; (b) Bz; (c) Br. 1—53k cells; 2—250k; 3—1M. 4—analytical solution.
Figure 9. The distribution of the different components of the magnetic field along the radius in the calculations on grids of different sizes:(a) Bφ; (b) Bz; (c) Br. 1—53k cells; 2—250k; 3—1M. 4—analytical solution.
Mathematics 11 03623 g009
Figure 10. The distribution of the component Bφ of the magnetic field along the radius in the frustum at different distances from the small cone base. (a) 0.03 m; (b) 0.05 m; (c) 0.07 m. Grid sizes: 1—53k cells; 2—250k; 3—1M; 4—analytical solution.
Figure 10. The distribution of the component Bφ of the magnetic field along the radius in the frustum at different distances from the small cone base. (a) 0.03 m; (b) 0.05 m; (c) 0.07 m. Grid sizes: 1—53k cells; 2—250k; 3—1M; 4—analytical solution.
Mathematics 11 03623 g010
Figure 11. The distribution of the component Bφ of the magnetic field in the 2Dhemisphere along the radius at q = π/2. Grid sizes: 1—53k cells; 2—250k; 3—1M. 4—analytical solution.
Figure 11. The distribution of the component Bφ of the magnetic field in the 2Dhemisphere along the radius at q = π/2. Grid sizes: 1—53k cells; 2—250k; 3—1M. 4—analytical solution.
Mathematics 11 03623 g011
Figure 12. Comparison of performance of 2D problems on different CPU and GPU on the different grids. 1—Intel Core i5-12400f; 2—Intel Core i9-13900k; 3—NVIDIA GTX 3080; 4—NVIDIA GTX 4090.
Figure 12. Comparison of performance of 2D problems on different CPU and GPU on the different grids. 1—Intel Core i5-12400f; 2—Intel Core i9-13900k; 3—NVIDIA GTX 3080; 4—NVIDIA GTX 4090.
Mathematics 11 03623 g012
Table 1. Coefficientsof the approximation form.
Table 1. Coefficientsof the approximation form.
iaibi
11.494662175718133 × 10-43.185919565550157 × 10−5
20.0024685033304607239.898332846225385 × 10−4
30.0086384421736040740.006432146586438302
40.010770635039866460.01680402334636338
50.0078204040609595540.02614501470031388
60.0075950934225594330.03347894366576163
70.01156959574529540.0427178905473831
80.021831811676130480.05859366125553149
90.056805194567559160.09374999972120314
100.44314718056088950.2499999999999018
icidi
11.393087857006647 × 10-42.970028096655561 × 10−5
20.0022966348983969599.215546349632498 × 10−4
30.0080030039806499860.005973904299155429
40.0098489293221768940.0155309416319772
50.0068479092826245060.02393191332311079
60.0061796274460533180.03347894366576163
70.014938013532687170.03012484901289893
80.0308851462713051980.0373777397586236
90.096573590280856260.0488280419068624
101.3862943611198910.07031249973903836
Table 2. Comparison of the calculation time according to our method and in COMSOL.
Table 2. Comparison of the calculation time according to our method and in COMSOL.
Used MethodTime, s
Intel 12400f415
Intel 13900k125
AMD RTX 30802.4
AMD RTX 40900.84
COMSOL (12400f)7
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Vinogradov, D.; Teplyakov, I.; Ivochkin, Y. Calculation of the Magnetic Field of a Current-Carrying System. Mathematics 2023, 11, 3623. https://doi.org/10.3390/math11173623

AMA Style

Vinogradov D, Teplyakov I, Ivochkin Y. Calculation of the Magnetic Field of a Current-Carrying System. Mathematics. 2023; 11(17):3623. https://doi.org/10.3390/math11173623

Chicago/Turabian Style

Vinogradov, Dmitrii, Igor Teplyakov, and Yury Ivochkin. 2023. "Calculation of the Magnetic Field of a Current-Carrying System" Mathematics 11, no. 17: 3623. https://doi.org/10.3390/math11173623

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop