Solution (source code)

= Solution

For the <homologous spherical flow> $\mathbf u=q\mathbf r$, the <ideal magnetohydrodynamic induction equation> and $\nabla\mathbin\cdot\mathbf B=0$ give the <material derivative>
$$
\frac{D\mathbf B}{Dt}
=(\mathbf B\mathbin\cdot\nabla)\mathbf u
-\mathbf B\nabla\mathbin\cdot\mathbf u
=-2q\mathbf B.
$$
Let $x=r/R(t)$ and use the <self-similar ansatz>
$$
B_r=B_0f(x)\cos\theta,
\qquad
B_\theta=-B_0g(x)\sin\theta.
$$
Part (b) gives $q=3\dot R/(4R)$, and therefore
$$
\frac{Dx}{Dt}=x\left(q-\frac{\dot R}{R}\right)
=-\frac14\frac{\dot R}{R}x.
$$
The radial induction equation becomes $xf'=6f$. The boundary value $f(1)=1$ gives $f=x^6$. The <solenoidal vector field> condition requires
$$
g=f+\frac x2f'=4x^6,
$$
which also matches the tangential shock value in part (c). Hence the interior field is
$$
\boxed{B_r=B_0\left(\frac rR\right)^6\cos\theta,
\qquad
B_\theta=-4B_0\left(\frac rR\right)^6\sin\theta,
\qquad B_\phi=0}.
$$

Outside the shock, the uniform-field lines obey $r\sin\theta=\text{constant}$. Inside, the <magnetic-field-line equation> gives
$$
\frac{dr}{r\,d\theta}=\frac{B_r}{B_\theta}
=-\frac14\cot\theta,
$$
so
$$
\boxed{r^4\sin\theta=\text{constant}}.
$$
A sketch therefore shows straight exterior lines refracting at the spherical shock into north-south symmetric curves that bow toward the equatorial interior before leaving through the opposite hemisphere. The field strength falls as $r^6$ toward the centre.