Solution (source code)

= Solution

Work in a meridional $R,z$ plane and denote the interface height by $Z(R)$, to distinguish it from an observation coordinate. Put
$$
s=z_0(\alpha-\alpha_f),\qquad d=\sqrt{\alpha^2-\alpha_f^2},\qquad
D(R)=\sqrt{s^2+d^2R^2}.
$$
The interface is $Z=(\alpha s+\alpha_fD)/d^2$, so $Z'=\alpha_fR/D$. Its unit normal into the fluid is proportional to $(-Z',1)$. Consequently the angle between this normal and the vertical satisfies
$$
\boxed{\tan\theta_z=Z'=\frac{\alpha_fR}{D}.}
$$
The outgoing source <P wave> has ray direction proportional to $(R,Z)$, tilting outwards by $\arctan(R/Z)$ from the vertical, while the normal tilts inwards. Thus $\theta_P=\arctan(R/Z)+\theta_z$. The tangent addition formula gives
$$
\tan\theta_P=\frac{R+ZZ'}{Z-RZ'}.
$$
Direct substitution simplifies its denominator to $s(\alpha D+\alpha_fs)/(d^2D)$ and its numerator to $\alpha R(\alpha D+\alpha_fs)/(d^2D)$. Hence
$$
\boxed{\tan\theta_P=\frac{\alpha R}{s}=\frac{\alpha R}{z_0(\alpha-\alpha_f)}.}
$$
The denominator is positive, so these are the physical incidence angles in $[0,\pi/2)$; the transmitted <P wave> reaches the fluid rather than propagating back into the solid.