Let's say we are looking at a waveguide with a perfect electric conductor as boundary (red), filled with air and another perfect conductor (red) inside. Say this waveguide is homogeneous in the longitudinal direction and infinitely long. We can look at the transverse plane of this waveguide:
If we look at the whole plane, one can say with confidence that $$\nabla \cdot D(x,y,z) =0 $$ But if we look at the static mode transverse electromagnetic wave (TEM) and take into account only a part of this plane, say only the green area, then the formula no longer holds.
So my question is: when calculating the electrical field of a waveguide using eigenvalue equations like $ \nabla \times \nabla \times E(x,y,z) = \omega^2 E(x,y,z) $, when can one assume that $ \nabla \cdot D(x,y,z) =0 $?
I am considering a 3D case, whereas the calculation of the eigenmodes can be limited to a 2D case. For this one often sets $\nabla \cdot D=0$. And this is why I need to know the answer to my question.