Abstract With the rapid development of deep learning, its application in physical field simulation has been widely concerned, and it has begun to lead a new model of meshless simulation. In this paper, research based on physics-informed neural networks is carried out to solve partial differential equations related to the physical laws of electromagnetism. Then the magnetic field simulation is realized. In this method, the governing equation and the boundary conditions containing physical information are embedded into the neural network loss function as constraints, and the backpropagation of neural networks is realized based on automatic differentiation to solve partial differential equations. The high-precision simulation of tile-shaped and rectangular permanent magnet magnetic fields of permanent magnet motors based on physical information neural network is studied, and the error is within 5%. We consider the simulation of magnetic field in two coordinate systems, and realize the joint training of multiple neural networks in multiple sub-domains and different media.