1. Introduction
With the development of digital twin technology, the speed of conventional numerical calculation methods is far lower than people’s expectations, and solving physical field problems quickly has become the most urgent need, especially for the optimal design of electric machines [
1,
2,
3]. During the process of optimizations, the magnetic field approximation for the simulation of electric machines is computationally expensive since the models need a high resolution to yield accurate results. Besides the optimized solutions, most solved candidate models are useless. For example, many studies currently use the evolutionary strategy as the optimization algorithm for motor design. Evolutionary algorithms require many iterations, resulting in thousands of models with magnetic fields that need to be solved. However, only one model is needed, and the rest of the models that consume a lot of computational resources are wasted.
Therefore, the computational results can be reused to train the neural network, and many data-driven deep learning networks are already leading to multi-physics simulation calculations, such as fluid field [
4], stress [
5], sound [
6], and medicine [
7]. However, the application of AI in the magnetic field is underestimated. Consequently, a fast electric motor simulation method using AI is expected to be developed.
This study proposes a physics-informed generative adversarial network (PIGAN). The PIGAN employs several physics-informed loss functions to fit the magnetic field distribution. The generation process of the physics-informed dataset is presented. The dataset, LiM2D, represents linear machines’ two-dimensional (2-D) magnetic field, i.e., the flux density distribution (B) of the linear machines in operation. It consists of material distribution, current density, the magnetization of permanent magnets (PMs), motion area, and flux density on the x-axis and y-axis.
The specific details are in
Section 4. The definitions of multiple channels for the input are presented. Unlike the previous work, multiple channels with separated properties are defined, such as material, vectorized magnetization field, current density direction, and motion band, to achieve the scalability of the dataset. Different channels of input can interact in a way that influences the prediction. Therefore, the magnetic field problems for a given model with appropriate channels of materials, motion area, and source conditions over a finite region of space are solved.
Based on this dataset, some key challenges are also pointed out in
Section 6. In particular, the feasibility of dealing with large-scale problems such as three-dimensional (3-D) problems is discussed first. Second, the nonlinear material representation to make the magnetic field approximation meet more engineering problems is explored. Third, the setup of boundary conditions in magnetic field approximation is discussed. Lastly, the integration error of prediction is evaluated. Note that this paper does not aim to thoroughly tackle these challenges but rather expose them to the community for future research.
Overall, our main contributions are: (1) a physics-informed loss function, (2) a linear motor magnetic field dataset, and (3) an in-depth study of the channel definition of input and output metrics. We also aspire to highlight the challenges faced in the magnetic field approximation for linear motors, sparking innovations in applications such as real-time electromagnetic simulation, digital twins, and optimal design for the renewable energy system.
2. Related Works
2.1. Existing Physics-Based Datasets
Existing physics-based datasets can be broadly classified into three categories:
Parameter-level models. These datasets are the parameters collected using sensors or calculated based on conventional data, including the electric motor control parameter dataset [
8] and the electric motor temperature dataset [
9].
Particle-level models. These datasets are usually collected by short-range depth scanners, such as FlareNet [
10]. Apart from real-world data, particle-level models use simulation data, such as MLPF [
4,
11].
Field-level models. The majority of these datasets are generated explicitly for physics-based field approximation, such as the StreeNet dataset [
5], magnetic field dataset [
12,
13,
14], and flow dataset [
15]
2.2. Magnetic Field Approximation
Conventional magnetic field approximation methods include the analytical, finite difference (FD), and finite element (FE) methods. The FE method is the most prevalent and general tool, with a settled sequence of operations when analyzing different problems, among these methods. However, developing a fast FE solver for analyzing electric machines is not easy. Conventional FE simulation is a very high-computational-complexity task, especially when the number of meshes is enormous and the computation time can be very long. Moreover, due to the algorithm’s parallelism limitations, FE methods are not well accelerated, although they can be accelerated using domain decomposition methods. On the other hand, the analytical method is very fast in solving the motor performance parameters, but the accuracy is low due to the negligence of some conditions.
In recent years, machine learning-based field approximation development has shown a promising solution to this problem. Machine learning can extract the critical features and rules from the given simulation or experimental data, especially in data-driven process control, robotics control, and computational fluid dynamics [
16,
17,
18,
19,
20,
21]. Concerning the training method, most studies are based on supervised training with parameters obtaining more high-dimensional data, such as a magnetic field’s 2-D or 3-D flux density distribution in the real world [
16,
22,
23,
24,
25]. Furthermore, if simulated data are used, it also costs considerable computation time for the simulation.
Regarding network architectures, generative AI is the most promising technique for field approximation, which can generate new data based on conditional inputs and random noise. There are many innovative combinations of layers used for generative AI, such as fully connected networks (FCN), recurrent neural networks (RNN), convolutional networks (CNN), and generative adversarial networks (GAN) [
16,
26,
27].
These preliminary studies show that neural networks can learn the relationship between structural geometry and magnetic field distribution. However, some critical challenges to the approach should be noted [
28]. For example, generating or collecting enough data for training the network is difficult. Although the existing data generated from optimization using FE simulation can be applied for training the network, the preprocessing is complex and time-consuming since the well-organized training sample needs a structured mesh to interpolate the FE solution. In this regard, GAN-based technology can reduce the number of training samples and obtain better generalization capabilities among many neural networks [
22].
However, it is still unclear how to effectively generalize the field-based methods to a more complex electromagnetic model. In this regard, several critical challenges in
Section 6 are investigated.
3. Physics-Informed GAN
3.1. Problem Definition for Magnetic Field Approximation
In this study, since the linear motor works at low speeds, only the magnetostatic problem is considered. The governing equations for the permanent magnet linear synchronous motor (PMLSM) are shown as follows:
where
denotes the relative magnetic permeability,
is the vacuum permeability (i.e.,
), B is the magnetic flux density, and
is the remanence of the PM material (i.e., the residual magnetic flux density).
stands for the magnetic field strength,
represents the magnetization strength of PM, and
represents the current density vector.
3.2. Structure and Workflow of the PIGAN
The PIGAN is inspired by the image synthesis technique from the computer vision, where neural networks are trained to synthesize a new image based on labeled input images. The most reliable technology in this field is GAN. GAN is a technique that uses random factors to generate new things. In the original idea of GAN, two neural networks compete in a game. The idea is that a generator network G tries to fool a discriminator network D by generating samples that mimic the ones taken from the target space distribution. On the other hand, the discriminator network improves the recognition of natural from generated samples during training. The physics-informed GAN (PIGAN) is a conditional GAN. The generator can produce results that are almost identical to those calculated by the laws of physics through supervised learning. The training datasets can be produced by numerical computing or measured by actual instruments. A well-trained generator can give nearly identical training results and conform to the physical properties.
For example, in
Figure 1, the magnetic permeability, magnetization direction, and current density of the material are used as inputs to obtain the magnetic field produced by the linear machine. Then, the input matrices will be scaled and normalized before being fed to the generator. The generator of the PIGAN is a U-shaped neural network. The detailed structure of the PIGAN can be found in our previous work [
14].
3.3. The Physics-Informed Loss Functions
The loss function of cGAN is defined as:
where x is the input (c.f. the output of Step 1 in
Figure 1), y is the ground truth (
, c.f. the input of the discriminator
in
Figure 1), and z is the random noise vector [
27]. G tries to minimize this objective against an adversarial D that tries to maximize it.
Ideally, the generated magnetic field result
(c.f. the output of the generator
in
Figure 1) shall match the magnetic field
obtained using the FE method for each element. Hence, an
loss between the predicted result
and the given input image
is formulated based on the following equation:
Nevertheless, in this paper, not only is a visually appealing result generated, but the generated magnetic field governed by Maxwell’s equations is also generated. The proposed method is derived from the Maxwell equation system. At the same time, in order to meet the training requirements of GAN, some vectors are transformed into scalars through integration for gradient descent optimization. The first physical loss term is Gauss’s law for magnetism, which states that:
The loss function derived from Ampère’s circuital law can be simplified to:
where
is the predicted magnetic field from generator G, and
is the ground truth obtained by the FE solution.
The force is calculated using the Maxwell Stress Tensor (MST) method [
29,
30,
31]. In the case of the MST, the divergence of the following tensor can be calculated using the following equation:
where
is the magnetic flux density, and
is the Kronecker sign (
= 1 if I = j; otherwise,
= 0).
The Maxwell Stress Tensor (MST) is performed by calculating the force using a surface integration on
over a
domain. The force vector and the loss of force are listed in the following:
The vector n is the normal on the surface , stands for the force vector obtained by , and stands for the force vector obtained by .
The final loss function used during training is a scalar, which is formulated as follows:
where
,
,
,
, and
are the penalty coefficients for each single loss function and define their relative importance.
4. The Linear Machine Dataset
In this section, a linear machine model for the 2-D magnetic field approximation is presented, including how to generate, process, and define the input of the dataset. The dataset is a field-based dataset with multiple channels, differing from others directly using predefined parameters.
4.1. The Linear Machine Model
A PMLSM is considered in this study to evaluate the nonlinear material property of the proposed method. The geometry of the PMLSM is shown in
Figure 2, the iron core material is Electrical Steel DW310, and the nonlinear B–H curve is shown in
Figure 3. The fixed parameters are shown in
Table 1.
4.2. Definition of Physics-Based Channels
The channels are defined based on two criteria: (1) Each channel should have a clear and unambiguous physical meaning, and they should consist of the component in each axis or direction if the property is a vector, such as two channels for a 45-degree magnetization vector M = (1, 1) in the 2-D problem and three channels for a z-direction current density J = (0, 0, 100 A/mm
2) in the 3-D problem. (2) Different channels should have significant variance in geometric structure or property. These four types of channels are identified in the dataset, as listed below.
Figure 1 shows examples of our annotations.
- 1.
Current density (—The current excitation applied to the material on the mesh of the linear motor will be converted to the current density. The number of channels of current density is three in the 3-D problem. In the particular 2-D model, the number of channels of current density can be simplified to one (containing only the vertical direction, such as to ) or two (containing any two components, such as to ) to reduce the storage space occupation.
- 2.
Magnetization of magnetic materials ()—The relative permeability of the magnetic material is close to one, and this material involves channels for the magnetization direction vector. The magnetization will have two channels in the 2-D problem and three in the 3-D problem. If the magnetization has only one direction in the 2-D problem, one channel will be added to reduce the space complexity.
- 3.
Motion band ()—The moving part will be marked as 1, and the materials and approximated fields inside the moving band will be extracted after approximation. The number of channels of the motion band is 1.
- 4.
Permeability of permeable materials ()—The relative permeability of the permeable material is larger than one. The value of channels of the permeable material is one when the material is isotropic. The anisotropy material will have two channels in 2-D problems and three in 3-D problems.
The dataset contains two parts: the training dataset and the test dataset. The training dataset is used for training the neural network, and the test dataset is used for testing whether the model is well trained for magnetic field approximation.
4.3. Dataset Generation
The dataset is generated from a parametric linear motor model. This model is a conventional PMLSM. The initial configuration is shown in
Table 1. The input and output of the neural network are generated by the FEM software. The randomly changing variables of the linear motor model can be found in
Table 2.
The boundary condition is the Dirichlet boundary, whose value is 0 weber/m. The distance of the moving speed is set to 1 mm/s. As for the data generation process, all models should be generated from many random parameter combinations.
Six geometric parameters, namely, the width of the edge (We), the width of the slot (Ws), the width of the teeth (Wt), the height of the slot (hs), the pole pitch (τp), and the PM length (WPM), are chosen as the geometry design variables. In addition, the input current also varies from 1 A to 16 A.
The PMLSM training dataset has 5000 samples. The initialization process of a genetic algorithm (GA) is employed to generate initial models since the initialization naturally generates a random combination of given variables, i.e., set the number of maximum populations to 5000 directly.
The PMLSM test dataset has 30 samples. The investigated PMLSM is a flat iron core.
Table 3 lists some specifications of the test PMLSM. This PMLSM is a concentrated winding motor with a slot pitch τ
s = 14 mm, a pole pitch τ
p = 16 mm, and a force constant K
t = 88.8 N/A. The air gap thickness is about 0.8 mm, and the Neodymium-Iron-Boron (NdFeB) PMs have a residual flux density of approximately 1.23 Tesla.
Table 4 demonstrates the content of the test dataset. The test dataset contains all statuses of the test PMLSM, moving from 0 s to 30 s with a speed of 1 mm/s, and each step represents the status every second.
5. Results
This section presents the preliminary results of the PIGAN. The test model is a 2-D PMLSM model, as shown in
Table 4. Different FEM results are obtained by moving the iron core to change the position of the mover of the PMLSM model. The geometrical parameters given in
Table 1 and
Table 3 are considered.
The PIGAN is constructed using TensorFlow 2 [
32], trained by a stochastic gradient descent optimizer, Adam [
33], with a learning rate of 0.001. Five thousand datapoints from the FEA are preprocessed for the training dataset. The training process takes 200,000 iterations.
In addition, Pix2Pix [
27], another cGAN, is implemented for comparison. The loss function of the Pix2Pix uses the L1 loss recommended in the original paper and does not incorporate physical information. All other model parameters and optimization parameters are the same as those in PIGAN.
5.1. Evaluation Metrics
Two types of evaluation metrics are considered in this study, including image synthesis metrics and electromagnetic metrics.
5.1.1. Image Synthesis Metrics
There are no existing metrics for magnetic field synthesis. In order to objectively demonstrate the superiority of the proposed method, all the experiments were quantitatively evaluated using the mean absolute error (MAE), the structural similarity (SSIM) index, and the peak signal-to-noise ratio (PSNR). The MAE, also known as the L1 loss, is a measurement between two paired matrices. It calculates the sum of absolute errors divided by the matrices’ sizes in this study, which are intuitive metrics for similarity measurements. The SSIM index measures the similarity of structural information in two images, where 0 indicates no similarity and 1 indicates total positive similarity. SSIM can be used in physics-based image restoration [
34,
35,
36], and a higher SSIM index means that the synthetic fundus image is closer to the real one. PSNR measures the image distortion and noise level between two images. A higher PSNR value indicates a higher image quality.
5.1.2. Electromagnetic Metric
Magnetic force is one of the most critical performance indicators of linear motors. It can be obtained by flux density.
The force applied to the mover in the x direction
can be obtained by using the MST method and is given by:
where
is the x-component of the flux density in the airgap and
is the y-component of the flux density in the airgap of the PMLSM.
5.2. Predicted Results of the Linear Machine
It takes approximately 16 hours of training time for the proposed PIGAN. As for the evaluation process, the total magnetic field approximation time of the 30-step PMLSM model using the proposed PIGAN is 1 s; each step costs 33.3 ms on average. In comparison, the conventional 30-step FE simulation takes 45 s, and each step takes 1.5 s on average. Convergence is achieved in around 150 k to 200 k iterations depending on the network configuration, as shown in
Figure 4,
Figure 5 and
Figure 6.
It can be seen in
Figure 4 that the results using Pix2Pix have a higher loss in MAE. The curves of the PSNR and SSIM also show the same conclusion.
Although the image synthesis metrics of the final optimized models of both PIGAN and Pix2Pix are very close, they differ significantly in the electromagnetic metrics. As shown in
Table 5, for the x-axis thrust, with continuous current excitation, the FEM is calculated to be 190 N, the PIGAN is calculated to be 192 N, and the Pix2Pix is calculated to be 150 N, with an error of 21.05%. The same is true for the peak current excitation, with an error of 3.16% for the PIGAN but of 15.79% for the Pix2Pix. The specific PIGAN and FE calculations resulting in the air gap magnetic density distribution and thrust force on the
x-axis are shown in
Figure 7,
Figure 8,
Figure 9 and
Figure 10. This shows that the loss function based on physical information can benefit the magnetic field approximation.
6. Discussion
In this section, several critical challenges revealed by our proposed dataset are identified, and the possible solutions are explored to overcome them and eventually improve the performance of magnetic field approximation. Note that the aim is not to propose new algorithms in this section. Instead, it is to generalize the existing pipelines from the perspective of dataset characteristics.
- A.
3-D problem
For 3-D problems, the input size is at least several hundred times larger than it is for 2-D problems. Suppose the 3-D model with a structured mesh and its magnetic field is approximated using the image synthesis method. In this case, only the newly added axis will cause the number of input variables to be several hundred times, and the number of channels will also increase.
For example, if the axis of input of a 2-D problem is [100, 512, 512, 4], then the equivalent input of the 3-D model is [100, 512, 512, 512, 6] if the length of the z-axis is 512, and two 2-D channels are converted to 3-D channels. Moreover, as for the anisotropic material properties, the 3-D problem will be more complicated
In the future, it is suggested that 3-D problems can be processed as 3-D mesh segmentation or point cloud processing instead of using structured grids such as pictures. The data structure will also be more complicated. It is necessary to arrange the input data structure and memory location reasonably. If it is heterogeneous computing, it is necessary to consider sharing the same memory instead of the existing time-consuming and complex algorithms, such as copying the memory data to the GPGPU memory.
- B.
Materials
Nonlinear electromagnetic material is widely used, and researchers have deeply investigated the characteristic for decades. The nonlinear material properties that need to be considered will increase the number of input channels.
In addition, nonlinear materials require proprietary databases and formulas for fitting queries. As for anisotropic materials, the material properties in each direction can be a vectorized property, which is more complicated in data preprocessing. If a multi-physics problem is considered, the model’s input will change because the input dimension, such as the channels, will be added, leading the model being retrained.
- C.
Boundary conditions
Boundary conditions (b.c.) are constraints that are necessary to solve a boundary value problem. The significant influence of b.c. is that the input and output of the dataset cannot be cropped simply without the b.c. Our dataset uses the Dirichlet boundary condition, and the value is determined to be zero. Therefore, the initial b.c. channels are neglected in the input.
If a non-zero b.c. is considered, the channels should be added, making the problem even more complex. Some preliminary results [
37] show that the image inpainting technique from the computer vision can benefit this issue.
- D.
Integration error
When calculating the magnetic force, the integration will be performed, which will enlarge the total error, even if the error of each point is small. For example, the concepts of force and torque using the MST method in the electromagnetic field require producing and integrating the alternating magnetic field near the moving object, and the calculation error rises extremely quickly.
Furthermore, 64-bit floating numbers (FP64) for scientific calculation are pretty common, while machine learning algorithms use 16-bit (FP16) or 32-bit (FP32) floating numbers. The cost-performance ratio will be meager if the dedicated hardware trains the model.
7. Conclusions
In this study, a PIGAN for electromagnetic field approximation is proposed. The proposed method of generating FE model data and defining input channels achieves a better electromagnetic field approximation accuracy. A physics-informed loss function outperforms the naive benchmark models through extensive benchmarking, improving forecasting performance. The mean absolute percentage error of the thrust force between the prediction using the PIGAN and the FE solution is less than 4%. At the same time, the calculation time of the PIGAN is almost forty times faster than that of the FE method. Moreover, several open challenges are highlighted, including 3-D problems for electromagnetic field approximation, material property consideration, and integration error in fundamental performance estimation.
Additionally, the PIGAN, as a neural network, has a standard development process. The standardized development process can significantly reduce the difficulty of software development, and it will be easier to put the PIGAN into industrial applications than FE solvers. With the accumulation of data, the PIGAN can evolve itself to improve its computational accuracy further. The PIGAN is expected to be a steppingstone towards advancing research in related areas.