# Expressing magnetostatic equation as a partial differential equation

Hi,

I am trying to model the magnetic field from two permanent magnets using Matlab, although my particular problem here relates to the physics/maths involved (though if someone could also give me advice on how to implement this particular problem in Matlab that would be awesome!). My system consists of two square magnetic regions (each of side length 5mm and gap between magnets of 1mm - although this is variable), which I have successfully modelled (although at a too low mesh density) using other PDE/FEM software using the equation:

curl(curl(A)-Br)/mu[0]) + J = 0

Where Br is the remnant magnetisation, mu[0] is the permeability of free space and J is the free charge density, which is zero in this case. I know Br is 1.24T and is parallel to the axis that runs through both magnet centres.

However, I really want to be able to use Matlab, but this requires that I express the equation above in what I presume is the standard PDE format. This is something like:

Where u is the variable to be solved and a and f are constants. (There are other types of PDE, but they all seem to be of the same general form)

Does anyone know how I can express my equation, in which 'A' is the thing to be solved for in the form of the second equation. I've spent absolutely hours on this and have no idea how to do it, so any help would be greatly appreciated.