This question is part of my attempt to use an answer to another question I've posted on this site.
If I have two materials with complex indices of refraction, $\widetilde{n}_0$ and $\widetilde{n}_1$, with $A_i$ representing the amplitude of a forward-propagating EM wave, and $B_i$ representing the amplitude of the backward-propagating EM wave, and assuming that the system is illuminated from only the left side (so $B_1 = 0$), I can write the amplitudes on the left side of the interface in terms of those on the right using the well-known Fresnel coefficients as
$$ A_0 = \left( \frac{\widetilde{n}_0 + \widetilde{n}_1}{2 \widetilde{n}_0} \right) A_1 $$ and $$ B_0 = \left( \frac{\widetilde{n}_0 - \widetilde{n}_1}{2 \widetilde{n}_0} \right) A_1, $$ for normally-incident, $s$-polarized light.
If I compute the time-averaged Poynting flux, $S_i$, using $$ S_i = \frac{n_i}{2 Z} |E_i|^2, $$ where $n_i$ is the real part of the complex index of refraction and $Z$ is the impedance of free space, the total flux on the left side of the interface is $$ \begin{align} S_0 &= \frac{n_0}{2 Z}\left( |A_0|^2 - |B_0|^2 \right) \\ &= \frac{n_0}{2 Z}\left(\left| \frac{\widetilde{n}_0 + \widetilde{n}_1}{2 \widetilde{n}_0} \right|^2 - \left| \frac{\widetilde{n}_0 - \widetilde{n}_1}{2 \widetilde{n}_0} \right|^2 \right)|A_1|^2 \\ &= \frac{n_0}{2 Z} \left( \frac{\widetilde{n}_0 \widetilde{n}_1^* + \widetilde{n}_0^* \widetilde{n}_1}{2} \right) \left| \frac{A_1}{\widetilde{n}_0} \right|^2 \end{align} $$ which is not equal to the flux on the right-hand side, $$ S_1 = \frac{n_1}{2 Z} |A_1|^2, $$ unless $\widetilde{n}_0$ is real, so where did the energy go?
I've included the above calculation as an example, but my actual problem is that flux isn't being conserved numerically in my Python simulation that I'm developing.
At first I thought my expression for the Poynting flux was wrong, but after returning to the definition and recalculating using a complex index of refraction, I arrive at the same result.
I also thought that the energy might be getting transformed into the other polarization state, but that has the same problem.