Magnetostatics in 2D
Setup
This simulation finds the magnetic field and vectors in a 2D region from a set of currents, magnetic materials, and ferromagnets. Ampere's law states that $$ \nabla \times \mathbf{H} = \mathbf{J}_f $$ where \(\mathbf{B} = \mu \mathbf{H}\) and \(\mathbf{J}_f\) is the free current. In terms of the vector potential \(\mathbf{B} = \mathbf{\nabla} \times \mathbf{A}\) for out-of-plane currents \(J_f\) this can be written in terms of only the out of plane part \(\mathbf{A} = A \mathbf{\hat{z}}\) as $$ \nabla \cdot \left(\frac{1}{\mu} \nabla A \right) = -J_f, $$ where \(\mu = \mu_r\mu_0\) and we have used that \(\nabla \cdot \mathbf{A} = 0\) in this geometry. Once \(A\) is known, the \(\mathbf{B}\) field can be found from \(\mathbf{B} = \partial_y A \mathbf{\hat{x}} -\partial_x A \mathbf{\hat{y}}\). The outer boundary of the domain is clamped to \(A = 0\). Finite \(\mathbf{M}\) can be included via the bound currents \(\mathbf{J_b} = \nabla \times \mathbf{M}\) giving total current \(\mathbf{J} = \mathbf{J_f} + \mathbf{J_b}\).
Methods
We discretize these equations on a square grid \(A(\mathbf{r}) \rightarrow A_{i,j}\) and use finite differences to approximate the derivatives. This yields a set of linear equations for the \(A_{i,j}\). These linear equations are solved iteratively using a Gauss-Seidel method with successive over-relaxation (SOR). To parallelize the computation on the GPU, we use a two pass red-black scheme. The over-relaxation parameter is set to \(\omega = 1.985\).
← Back