  We optimised the magnetic field homogeneity of two canonical designs for
mobile microfluidic NMR applications: two parallel magnets with an air gap and
a modified Halbach array. Along with the influence of the sample length,
general design guidelines will be presented. For a fair comparison the
sensitive length of the sample has been chosen to be the same as the gap size
between the magnets to ensure enough space for the transmitting and receiving
unit, as well as basic electric shimming components. Keeping the compactness of
the final device in mind, a box with an edge length 5 times the gap size has
been defined, in which the complete magnet configuration should fit. With the
chosen boundary conditions, the simple parallel cuboid configuration reaches
the best homogeneity without active shimming (0.5$\mathrm{B_{s}}$, 41 ppm),
while the Pseudo-Halbach configuration has the highest field strength
(0.9$\mathrm{B_{s}}$, 994 ppm), assuming perfect magnets. However, permanent
magnet configurations suffer from imperfections, such as magnetisation,
fabrication and positioning errors, which results in worse magnetic field
homogeneities than expected from simulations using a fixed optimised parameter
set. We present a sensitivity analysis for a magnetic cube and the results of
studies of the variations in the magnetisation and angle of magnetisation of
magnets purchased from different suppliers, composed of different materials and
coatings, and of different sizes. We performed a detailed Monte Carlo
simulation on the effect of the measured distribution of magnetic properties on
the mentioned configurations. The cuboid design shows a mean homogeneity of 430
ppm (std dev. 350 ppm), the Pseudo-Halbach has a mean homogeneity of 1086 ppm
(std dev. 8 ppm).
