Propagation and reflection of internal gravity waves in conducting fluids and in flow through porous media