  We quantify and explain the effects of both anti-phase boundaries and twin
defects in as-transformed $\tau$-MnAl by carrying out micromagnetic simulations
based closely on the results of microstructural characterization. We
demonstrate that magnetic domain walls nucleate readily at anti-phase
boundaries and are strongly pinned by them, due to anti-ferromagnetic coupling.
Likewise, twin boundaries reduce the external field required to nucleate domain
walls and provide strong pinning potentials, with the pinning strength
dependent on the twinning angle. The relative strengths of the known twin
defect types are quantified based on the anisotropy angles across their
boundaries. Samples that have undergone heat treatment are imaged using
electron back-scatter diffraction. The precise crystallographic orientation is
mapped spatially and converted into a number of realistic finite element
models, which are used to compute the effects of large concentrations of twin
domains in a realistic morphology. This is shown to have a negative effect on
the remanence coercivity and squareness. The maximum energy product
$(BH)_{\mathrm{max}}$ is therefore significantly lower than the theoretical
limit of the material and much lower than MnAl permanent magnets that have been
further processed to remove twin defects. The knowledge gained in this study
will allow the optimization of processing routes in order to develop permanent
magnets with enhanced magnetic properties.
