Direction of $\textbf{H}$ and $\textbf{B}$ inside and outside a bar magnet I seem to have encountered a contradiction when thinking about the directions of $\textbf{H}$ and $\textbf{B}$ inside and outside a bar magnet.
Suppose that a bar magnet has a roughly constant magnetisation M pointing along the positive z direction. Suppose also that the magnet is made from an isotropic material, i.e. $\textbf{M}=\chi_m
\textbf{H}$ (1). Therefore $\textbf{H}$ should be pointing in the same direction as $\textbf{M}$, provided that $\chi_m$ is positive, which should be the case for most magnetic materials? From the definition $\textbf{H}=\frac{1}{\mu_0}\textbf{B}-\textbf{M}$ and substituting using (1), we get $\textbf{B}=\mu_0(1+\chi_m)\textbf{H}=\frac{\mu_0(1+\chi_m)}{\chi_m}\textbf{M}=\frac{\mu_0\mu_r}{\mu_r-1}\textbf{M}$. Unless $\mu_r$ is less than 1, $\textbf{B}$ should also be parallel to $\textbf{M}$. Therefore so far we get that both $\textbf{H}$ and $\textbf{B}$ should point in the same direction as direction as $\textbf{M}$ inside the magnet, that is along the positive z direction.
We know that $\nabla\cdot\textbf{B}=0$ and thus applying boundary conditions on the top and bottom surfaces of the magnet (normal to the z axis) using an infinitesimally thin gaussian pillbox, we get that $\textbf{B}^\perp_\textrm{outside}=\textbf{B}^\perp_\textrm{inside}$. Therefore $\textbf{B}$ immediately outside the top surface should also point in the positive z direction. Assuming that there are no free currents near the magnet, $\nabla\times\textbf{H}=\textbf{J}_\textrm{free}=\textbf{0}$. Applying boundary conditions to the side surfaces of the magnet (parallel to the z axis), $\textbf{H}^\parallel_\textrm{outside}=\textbf{H}^\parallel_\textrm{inside}$. Therefore $\textbf{H}$ immediately outside the side surfaces must also point along the positive z direction. However, the field lines must also curl around and meet the top surface of the magnet, where $\textbf{H}$ will therefore need to point in the negative z direction. Since $\textbf{M}=\textbf{0}$ outside, $\textbf{H}=\frac{1}{\mu_0}\textbf{B}-\textbf{M}=\frac{1}{\mu_0}\textbf{B}$ and $\textbf{H}$ needs to be parallel to $\textbf{B}$ but we just argued that they point in opposite directions due to the boundary conditions. How do we resolve this contradiction?
 A: You are completely confused about magnetisation and what is meant by a permanent magnet. Permanent bar magnets have an H-field in their interiors that is opposite to their B-fields and is (approximately) independent of the B-field. The H-field in a permanent magnet is not given by the LIH (Linear Isotropic Homogeneous) approximation ${\bf M} = \chi_m {\bf H}$.
Instead the H-field can be calculated (in SI) as
$$ \mu_0 {\bf H} = {\bf B} - \mu_0 {\bf M}$$
If ${\bf M}$ is considered large and roughly uniform and points along the axis of the bar magnet and the B-field perpendicular to the end of the magnetic is continuous, then because ${\bf M}=0$ outside the magnet, then we can also see that there must be a discontinuity in ${\bf H}$ (a magnetic pole).
If we let $H_{\rm in}$ and $H_{\rm out}$ be the fields perpendicular to the interface just inside and outside the magnet, let $B$ be the magnitude of the perpendicular field just inside and outside the surface and $M$ be the magnitude of the magnetisation just inside the surface, then
$$ \mu_0 H_{\rm in} = B - \mu_0 M$$
$$ \mu_0 H_{\rm out} = B$$
so
$$ H_{\rm in} = H_{\rm out} - M$$
If $M > H_{\rm out}$, which is usually the case for a bar magnet, then the H-field inside the bar magnet is in the opposite direction to the magnetisation.
See the diagram below (by Edgar Bonet: https://commons.wikimedia.org/wiki/File:Fields_bar_magnet.png )

A: $B$ actually behaves as you explain, however there's a problem 
with $H$.
You say:
"However, the field lines must also curl around and meet the top surface of the magnet, where $H$ will therefore need to point in the negative z direction."
Why the field lines need to meet the top surface of the magnet?
Outside the magnet $B$ and $H$ are proportional so we can use the picture.
If you take a line in the upper half of the magnet, the field lines 
go away from the magnet, then curl and point in the
minus z direction, then go near to the magnet and curl.
If you take a line in the lower half of the magnet
(the figure doesn't apply), the field
goes into the magnet and because we have
$div \vec{H} \ne 0$ there is no continuity of the field lines.
Therefore $H$ doesn't point in the minus z direction at the top surface.

