\chapter{Examples and Verification}

\section{Coulombic Magnetic Potential}
		In the absence of external current densities, we may write $\nabla \times \mathbf{H} = 0$.
		This allows the $H$ field to be represented using a scalar potential term  
		\begin{align} 
			\mathbf{H} = \nabla \phi_M.
		\end{align}
		Static magnetics problems (in linear media) can be solved using a scalar potential term obeying the 
		following relationship \cite[e.g.,][]{Jackson1998}
		\begin{align} \label{eq:permMagnet}
			%-\nabla \cdot \mu(\mathbf{r}) \nabla \phi_M(\mathbf{r}) = \mu(\mathbf{r}) M_0(\mathbf{r}).
			-\LAPL{\phi_M} = \rho_M(\mathbf{r}).
		\end{align}
		Where $\phi_M$ represents the Coulomb magnetic potential (appropriate for static magnetics problems) 
		and $\rho_M$ is the effective magnetic charge density (=$\nabla \cdot \mathbf{M}$).
		This formulation is particularity useful in calculating the fields of permanent magnets, where the 
		magnetisation of the magnet is given by $\mathbf{M}(\mathbf{r})$.
		The left hand side of (\ref{eq:permMagnet}) can easily be solved using {\bf{FEM4EllipticPDE}}, however 
		the right hand side requires some special care. 

	\subsection{Calculation of Charge Density}
		For uniformly magnetised media $\rho_M$ vanishes everywhere except at the boundaries of the magnet.  
		In truth, $\mathbf{M}$ is well behaved and there are no truly uniformly magnetized magnets, but the 
		true nature of $\mathbf{M}$ is rarely known, and the assumption of uniform magnetisation becomes necessary. 
		Practical permanent magnets are \emph{effectively} uniformly magnetised, and this assumption is completely 
		reasonable, and even necessary. 

		We can therefore apply the divergence theorem to to the boundaries to calculate the surface charge density
		$\sigma_M = \hat{\mathbf{n}} \cdot \mathbf{M}$ which exists on the 2D surface of the media and has zero 
		Riemann measure, formally necessitating a Lebesgue integral. 
		We may then let $\rho_M \rightarrow \sigma_M$ in 
		(\ref{eq:permMagnet}). 
		The FEM variational formulation for an particular element in the load vector $g$ that spans 
		the boundary of the media at point $\mathbf{r}_0$  can be written
		\begin{align}
			[g]_i & = \left< \rho_M, \phi_i \right> = \int \rho_M \phi_i \\
			      %//& = \int_L \delta\{\hat{\mathbf{r}_0}\} \sigma_M \phi_i \\ 
			      & = \int_L \sigma_M \phi_i \\ 
			      & = \sigma_M \phi_i(\mathbf{r}_0). 
		\end{align}

	\subsection{Uniformly Charged Sphere}
	The scalar potential of a uniformly charged sphere is given \cite[p. 198, ][]{Jackson1998} 
	\begin{align}
		\phi_M(\rho, \theta) = \frac{1}{3} M_0 a^2 \frac{r_<}{r_>^2} \cos(\theta).
	\end{align}
	Where the notation $r_<, r_>$ represents the smaller or larger of the distance $\rho$ and sphere radius $a$.

	Inside the sphere
	\begin{align}
		%\phi_M &= \frac{1}{3} M_0 \rho \cos \theta  & \text{inside the sphere} \\
		\phi_M &= \frac{1}{3} M_0 z  & \text{inside the sphere} \\
		\phi_M &= \frac{1}{3} M_0 a^3 \frac{\cos \theta}{\rho^2}  & \text{outside the sphere} 
	\end{align}
	

 
