## 1 Introduction

Scientific visualization is used to assist in the estimation and evaluation of computational results and in the understanding of their physical meaning. Accurate and reliable visualization results should obey the physical rules. The key goal of three dimensional magnetic field visualization is to provide insight into field structures while an aesthetic image helps the user quickly recognize field patterns without visual distractions. A magnetic flux line is the most popular way to visualize a magnetic field, and it can be regarded as streamline. Most papers related to the streamline only discuss the placement quality, such as discontinuities, closure, cavities, speed, etc. Some papers have discussed the density of streamlines from an aesthetic aspect instead of discussing the physical accuracy (**Salzbrunn & Scheuermann, 2006**). Very few papers have discussed the accuracy of the magnetic flux line density, especially in 3-D space. As we know, the density of magnetic flux lines accurately represents the magnitude of magnetic induction intensity in visualization results. Seed points (**Verma & Kao, 2000**; **Ye & Kao, 2005**; **Liu & Moorhead, 2006**) are the starting points of flux lines, and they determine the density of the lines. To get accurate and reliable magnetic field visualization results, we must solve this seeding problem. In 1996, Vlatko Cingoski et al. proposed a traditional seeding algorithm for 3-D space that is a statistical algorithm based on data (**Cingoski & Ichinose, 1994**; **Cingoski & Kuribayashi, 1996**; **Noguchi & Yoshigai, 2005**). This method is simple and feasible. The main step is to divide plane *S* into *n* sub-planes and then derive the number of magnetic flux lines that cross the sub-planes, according to the idea that the magnetic flux of a plane is proportional to the number of magnetic flux lines that cross it.

However, in this traditional seeding algorithm, subdividing the plane is difficult, and approximations must be used in the process of computing the magnetic fluxes after division. This kind of approximation reduces the accuracy of understanding the field. To get higher accuracy, more subdivisions must be made, but this reduces the computation efficiency. Our paper presents an improved algorithm with which to solve this conflict. We first analyzed the error made by the traditional algorithm and found that the shape of the subdivision relates to this error. Therefore, choosing an appropriate subdivision according to the distribution of the magnetic field will improve accuracy. Based on this discovery, we proposed a feasible way to improve accuracy. Finally we compared the results computed from the two algorithms with that computed from the equivalent magnetic flux algorithm, which is based on analytic expressions and introduces no errors. Our work validates the accuracy and efficiency of the improved algorithm.

## 2 Traditional Seeding Algorithm Errors

### 2.1 The Traditional Seeding Algorithm

The procedure of the traditional algorithm is as follows:

- Define the value of the total number of flux lines
*N*_{total}and a plane*S*in 3-D space from which flux lines will emerge. - Divide plane
*S*into sub-planes using a lattice division, which will aid in the ease of computation of the number of lines and their starting position (Figure 1).

- Calculate the average magnetic flux value for each sub-plane
*i*using the following equation(1)${{\displaystyle \Phi}}_{i}^{average}=\frac{{\displaystyle {\sum}_{j=1}^{4}{{\displaystyle B}}_{j}}}{4}\cdot {{\displaystyle S}}_{i}$

where i is the number of the sub-plane, B*j*is the magnetic induction intensity at the four vertexes, and Sis the area of sub-plane_{i}*i*(Figure 1). - d. Compute the number of flux lines in each sub-plane
*i*using the following equation(2)${{\displaystyle N}}_{i}=\frac{{{\displaystyle \Phi}}_{i}^{average}}{{\displaystyle {\sum}_{k=1}^{n}{{\displaystyle \Phi}}_{k}^{average}}}\cdot {{\displaystyle N}}_{total}$

where *n* is the total number of sub-planes and
${{\displaystyle \Phi}}_{i}^{average}$ is the average flux value for each sub-plane.

In this way, the plane is divided into foursquares, and the average fluxes for each sub-plane are computed using the magnetic induction intensity values of the four vertexes. In this approximation process, error is introduced.

### 2.2 Error Analysis

While discussing the intrinsic error caused by discrete points that contain only partial information about the magnetic field, the error brought about by the subdivision of the plane in the traditional seeding algorithm should be discussed as well. However, very few papers have discussed this issue. The average value of the magnetic induction intensity of the four vertexes is used to obtain the approximate magnetic flux of this lattice in the algorithm based on data. In this process, the error has been introduced, and we find that the accuracy of the approximation can actually be affected by the subdivision of the plane. Therefore, to improve accuracy we need to choose an appropriate subdivision according to the distribution of the magnetic field. This section presents the error analysis process.

First, we define the magnetic flux error as:

where ΔΦ = Φ – Φ’, Φ is the real magnetic flux, and Φ’ is the approximate magnetic flux.

As shown in Figure 2, we suppose that the magnetic flux lines pass through plane X-Y vertically and that rectangle ABCE is a sub-plane, where (*n*_{1}, *m*_{1}), (*n*_{1}, *m*_{2}), (*n*_{2}, *m*_{1}) and (*n*_{2}, *m*_{2}) are the coordinates of the vertexes *n*_{1}<*n*_{2}, *m*_{1}<*m*_{2}.

Under this assumption, the real and approximate magnetic fluxes are:

We will discuss the relationship between the shape of sub-planes and the approximation error in the following two situations.

A. *B*(*x*, *y*) is a linear function of *x* and *y*:

(6)$B(x,y)=ax+by+c$

where *a*, *b*, *c* are constants.

Substitute *B*(*x*, *y*) into Eq. (4), and we get the real magnetic flux:

Under this distribution of magnetic induction intensity, we use the average magnetic induction intensity of four vertexes to compute the approximate magnetic flux of the sub-plane. The result is as follows:

Therefore, the error can be deduced:

(9)$\Delta \Phi ={\Phi}^{\prime}-\Phi =0$

This demonstrates that the approximate magnetic flux will always be equal to the real magnetic flux no matter which side is longer under linear conditions.

B. *B*(*x*, *y*) is a nonlinear function of *x* and *y*

(1) *B*(*x*, *y*) varies linearly along one direction, non-linearly along the other direction.

We suppose:

(10)$B(x,y)=a{x}^{2}+by+c,$

where *a*, *b*, *c* are constant and positive numbers.

By substituting *B*(*x*, *y*) into Eq. (4), we get the real magnetic flux:

Then we select the average of four vertexes to compute the approximate magnetic flux:

Therefore,

If we define S as the area of the sub-plane, *p* is a variable:

(14)$S=({n}_{2}-{n}_{1})({m}_{2}-{m}_{1}),$(15)${n}_{2}-{n}_{1}=p({m}_{2}-{m}_{1}),$

Thus, the error becomes:

It is easy to get an error range 0 < *ε* < 50%, and the magnitude of the error is closely related to the shape of the sub-plane and the starting point. If S is a constant and the starting point (*n*_{1},*m*_{1}) is fixed, the smaller *p*

becomes, the smaller the error will be. In addition, the error will vary with starting point changes. Thus, the error of each lattice is different. Suppose the real magnetic flux of lattice 1 is Φ_{1} and that of lattice 2 is Φ_{2} ; then the magnetic fluxes become 1.5Φ_{1} and 1.1Φ_{2} with their errors *ε*_{1} = 15% and *ε*_{2} = 10%, respectively (see Figure 3). Finally, the proportion of magnetic fluxes in the two lattices is different from their real proportion. If we use this proportion to calculate the number of magnetic flux lines in each lattice, the wrong results will be obtained.

From Eqs. (16) and (17), we know that the shorter the side of the sub-plane along direction X, the higher the accuracy. This is because the exponent of variable *x* is higher than that of *y* and the quadratic variation is more complex than the linear one; therefore the approximation along *x* introduces more errors. We know that the longer side of the rectangle should correspond to the variable that causes the function value to change more slowly.

We can also discuss the error when the exponent of *x* is more than 2 according to the above explanation.

(2) *B*(*x*, *y*) varies non-linearly along axis X and axis Y.

(3) Take *B*(*x*, *y*) to be:

(17)$B(x,y)=a{x}^{n}+b{y}^{n-1},n\ge 3.$

Discussion is difficult under this condition. Perhaps the lattice is not suitable, and we need to use other kinds of curvilinear meshes, such as a rhombus. Thus the issue remains to be examined in further study.

There are also other non-linear functions we have not discussed, but we aim to present one idea rather than discuss all the specific relationships between error and the shape of the sub-plane. In conclusion, to improve accuracy, variations of the magnetic induction intensity on a plane should be analyzed. Then we can divide the plane into appropriate sub-planes.

## 3 Improved Seeding Algorithm and Validation

### 3.1 Improved Seeding Algorithm Procedure

According to the analyses in the above section, we propose an improved seeding algorithm that uses a more appropriate subdivision of the plane to reduce the approximate error in order to improve the accuracy of the magnetic flux lines density. The procedure of the improved algorithm is as follows:

- Define the value of the total number of flux lines N and a plane S in 3-D space from which flux lines will emerge.
- Analyze the distribution of the magnetic induction intensity in the entire space and find the type of variation, either linear or nonlinear.
- According to the variation type, choose the appropriate subdivision to get a high degree of precision.
- Compute the approximate magnetic flux of each sub-plane and determine the number of flux lines in each sub-plane according to the flux result.

The final visualization result from the improved seeding algorithm can represent the physical property more accurately.

### 3.2 Improved Seeding Algorithm Validation

#### 3.2.1 The Equivalent Magnetic Flux Algorithm

To validate the improved seeding algorithm, we use the results of the equivalent magnetic flux algorithm as an objective reflection of the magnetic field. The equivalent flux algorithm always chooses the areas that have the same flux according to the rule that the same flux value maps the same number of flux lines. The shape of the area should make the integration of the flux easy to compute, and the seed points are at the vertexes of each area. We choose as an example a magnetic field that can be represented accurately and objectively by an analytic expression because computation of the equivalent magnetic flux algorithm through analytic expression has no approximation. We believe that the magnetic flux of each sub-plane computed by this method is the real magnetic flux while the error of the seeding algorithm based on data comes from discrete points.

Thanks to the symmetry of the magnetic dipole field, the density distributions of the magnetic flux lines have the same symmetry. In this section we use the equivalent flux algorithm in a dipole field as an example. As shown in Figure 4, the green center area is the Earth, and O is the magnetic dipole center (geocenter). We select two small fan-shaped areas ABED (red area) and BCFE (yellow area) in the magnetic equatorial plane through which the magnetic flux lines pass through vertically. The distances from A, B, C (the points where magnetic flux lines *F _{n}*,

*F*

_{n}_{+1},

*F*

_{n}_{+2}cross the magnetic equatorial plane) to O are

*r*

_{n}_{,0},

*r*

_{n}_{+1,0},

*r*

_{n}_{+2,0}, respectively. D, E, F are the cross points of the magnetic flux lines on the other side of the fan-shaped areas. θ is the angle between the direction vector from O to some point in the magnetic equatorial plane and the

*OX*axis.

The formula for computing the magnetic flux is as follows:

Thus the magnetic fluxes of red area ABED and yellow area BCFE can be computed:

According to equivalent magnetic flux condition:

Finally we get the relationship:

From the analyses above, we can see that the magnetic flux lines pass vertically through the magnetic equatorial plane. Because the magnetic induction intensity does not change along the same magnetic latitude in a circle, the density distribution of the lines is uniform along the circle. Under the equivalent magnetic flux condition, the stronger the magnetic induction intensity is, the denser the magnetic flux lines and the smaller the area will be. This obeys the rule that the density of magnetic flux lines maps the magnetic induction intensity.

#### 3.2.2 Traditional and Improved Algorithm Errors

Due to the accuracy of the equivalent magnetic flux algorithm, the distribution of seed points computed from it can be used as the standard. To compare the accuracies of the traditional and improved algorithms using the equivalent magnetic flux algorithm as a standard, an equal number of magnetic flux lines should be used to express the magnetic field in the same area. If the numbers computed by these methods in the same subdomain of this area are equal to that computed by the equivalent magnetic algorithm, these two algorithms are both correct: otherwise, the errors should be analyzed.

We also take the magnetic dipole field as an example. First, Figure 5 shows the distribution of the seed points calculated by the equivalent magnetic flux algorithm; the magnetic dipole center is O, and plane XOY is a magnetic equatorial plane. When calculating the seed points from axis X, we find that the longitude interval is 1.8^{°} and *r*_{1.0}=2, *r*_{2.0}=2.08. The distribution of subsequent seed points is shown as follows. The blue area $(x\in (2.0,3.0),y\in (0.0,1.0),z=0.0)$ is a foursquare in the magnetic equatorial plane. We choose this area to examine the accuracy of the seeding algorithm based on data.

The number of seed points in the blue area is 107 so we use 107 seed points to express the magnetic field in the blue area and compare the distributions in the subdomain of the blue area as calculated using the traditional algorithm and the equivalent magnetic flux algorithm.

We choose the subdomains as follows:

$SubdomainA:x\in (2.0,2.0+4.0/9),y\in (0.0,4.0/9),z=0.0;$

$SubdomainA:x\in (2.0,2.0+5.0/9),y\in (0.0,5.0/9),z=0.0;$

$SubdomainA:x\in (2.0,2.0+7.0/9),y\in (0.0,7.0/9),z=0.0;$

#### A. Traditional Seeding Algorithm

We need to divide the blue foursquare area into many small lattices before calculating the seed point distribution. Tables 1 and 2 below show the results of three subdomains calculated from different subdivisions of the blue area. Taking 9x9 as an example, the first number ‘9’ means nine equally divided parts along axis Y, and the second number ‘9’ expresses nine equally divided parts along axis X. Thus we get 81 little foursquares. We define *N* as the number of seed points calculated from the traditional algorithm; *N*_{0} represents the number calculated from the equivalent magnetic flux algorithm, and the error is

4/9x4/9 subdomain A | 5/9x5/9 subdomain B | 7/9x7/9 subdomain C | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|

18x18 | 27x27 | 36x36 | 18x18 | 27x27 | 36x36 | 18x18 | 27x27 | 36x36 | |||||

N |
30.1211 | 30.1197 | 30.1192 | N |
43.6988 | 43.6973 | 43.6967 | N |
74.2201 | 74.2189 | 74.2185 | ||

ε (%) |
7.5754 | 7.5705 | 7.5688 |
ε (%) |
1.6251 | 1.6216 | 1.6204 |
ε (%) |
0.2975 | 0.2959 | 0.2953 | ||

9x36 | 9x81 | 18x72 | 9x36 | 9x81 | 18x72 | 9x36 | 9x81 | 18x72 | |||||

N' |
30.1136 | 30.1128 | 30.1174 | N' |
43.6903 | 43.6895 | 43.6946 | N' |
74.2134 | 74.2127 | 74.2168 | ||

ε' (%) |
7.5486 | 7.5458 | 7.5621 |
ε' (%) |
1.6053 | 1.6034 | 1.6155 |
ε' (%) |
0.2884 | 0.2874 | 0.2931 |

4/9x4/9 subdomain A | 5/9x5/9 subdomain B | 7/9x7/9 subdomain C | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|

18x18 | 27x27 | 36x36 | 18x18 | 27x27 | 36x36 | 18x18 | 27x27 | 36x36 | |||||

N |
30.1211 | 30.1197 | 30.1192 | N |
43.6988 | 43.6973 | 43.6967 | N |
74.2201 | 74.2189 | 74.2185 | ||

ε (%) |
7.5754 | 7.5705 | 7.5688 |
ε (%) |
1.6251 | 1.6216 | 1.6204 |
ε (%) |
0.2975 | 0.2959 | 0.2953 | ||

9x18 | 18x27 | 27x36 | 9x18 | 18x27 | 27x36 | 9x18 | 18x27 | 27x36 | |||||

N' |
30.1165 | 30.1189 | 30.1189 | N' |
43.6937 | 43.6963 | 43.6964 | N' |
74.2160 | 74.2182 | 74.2183 | ||

ε' (%) |
7.5592 | 7.5675 | 7.5677 |
ε' (%) |
1.6132 | 1.6194 | 1.6196 |
ε' (%) |
0.2919 | 0.2949 | 0.2950 |

#### B. Improved Seeding Algorithm

The subdomain after subdivision is one foursquare in the traditional algorithm. Because *B* = *M · r|*^{-3} (*r* is the distance between one point and magnetic dipole center and *M* is the size of the moment of magnetic dipole), the attenuation of the magnetic induction intensity in the blue area along the radial direction of the magnetic equatorial plane (namely axis X) is rapid; however, it is slow along axis Y. Therefore, we divide the subdomain into a rectangle with the longer side along axis Y and the shorter side along axis X, according to the improved algorithm. This means the subdivisions along axis Y are fewer than those along axis X. The following tables show the number of seed points and the error after different subdivisions along axis X and axis Y. The first number in the types of subdivisions represents the subdivisions along axis Y, and the second represents the subdivisions along axis X. (for example, 9x18 means nine subdivisions along axis Y and eighteen along axis X.). Now *N'* represents the number of seed points calculated by the improved algorithm, and the error is

We compute the numbers of seed points in the subdomains with both algorithms using different types of subdivisions. The results are represented by the following two tables.

From Table 1, we can see that different types of subdivisions with the same numbers of grids will get different precisions. For example, subdivision 18x18 of the traditional algorithm in subdomain A has an error of 7.5754% while the error of subdivision 9x36 of the improved algorithm is 7.5486%. With fewer subdivisions along axis Y, we get higher precision. Furthermore, Table 2 illustrates that the smaller number of grids using the improved algorithm may get a higher precision than those with the traditional algorithm. For subdivisions 9x18 and 18x18, the errors are 7.5592% and 7.5754%, respectively. Therefore, we obtain more accurate and quicker subdivisions with the improved traditional algorithm.

From the tables above, we conclude:

- In the same area, the improved algorithm can get a higher accuracy than the traditional algorithm with the same number of grids;
- A greater accuracy in the distribution of magnetic flux lines can be obtained from the improved algorithm with fewer subdivisions than from the traditional algorithm;
- When choosing the larger subdomain of the blue area to be calculated, the results of both algorithms are closer to the equivalent magnetic flux algorithm.

The results verify the higher precision obtained by using the improved traditional algorithm.

## 4 Conclusion

This paper tells of our work in improving the traditional seeding algorithm to obtain more accurate visualization results and more computation efficiency. We found that the shape of the subdomain has an effect on the approximation of the computed magnetic flux. To get a more highly accurate magnetic flux, subdivisions of the plane should not always be foursquare. The shape should relate to the distribution of the magnetic induction intensity. Subdivisions along the direction in which the magnetic induction intensity changes more quickly should be smaller. Finally, we used the results computed by the equivalent magnetic flux algorithm based on analytic expression as an objective reflection of the magnetic field and compared the accuracies and efficiencies of the unimproved traditional algorithm with those of the improved algorithm. The results demonstrate that the improved algorithm is feasible.

We discussed only two types of magnetic fields, omitting discussion of other complex magnetic fields. In practice, choosing the appropriate subdivision according to the characteristics of the specific magnetic field is difficult. We need to choose appropriate coordinate systems and an optimal subdivision strategy, according to the distribution of the magnetic induction intensity. Perhaps we can choose rhombus-shaped sectors, not just simple rectangles, for the shape of the sub-planes. These issues need further study while this paper only reaches preliminary conclusions. We have aimed to propose an idea to improve accuracy, not to give concrete details appropriate for all cases.

The equivalent magnetic flux algorithm is based on analytic expressions and has no approximation. It provides a new idea about visualizing the 3-D magnetic field by using the seeding algorithm based on analytic expressions. In the future we would like to extend the algorithm to other magnetic field types and discuss its applicability.