I am trying to find the possible modes of a 2d rectangular waveguide by solving the equation, $$\Big(\frac{\partial^2}{\partial x^2} + \frac{\partial^2}{\partial y^2} + \gamma^2 \Big)\psi = 0$$ where $\psi$ would be $H_z$ or $E_z$ depending upon whether the mode to be solved for is TE or TM.

My approach has been to use the Finite Difference method to solve the equation, so as to convert the PDE into a set of Simultaneous equation and solve for the eigenvalues ($\gamma$).

The boundary condition is Neumann, $\frac{\partial \psi}{\partial n} = 0$ if $x = 0, a$ or $y = 0, b$, where x and y are the dimensions of the Wave-guide.

My question is how do I include this boundary condition in my code if $H_z = h(x,y)e^{i(kz-\omega t)}$?

Please provide a reference too if possible. Thanks.


1 Answer 1


If you consider your solution you end up with the following problem

$$(\nabla^2 + \gamma^2) h(x, y) = 0\, .$$

And the boundary conditions would be

$$\frac{\partial h(x, y)}{\partial n} = 0\, ,$$

for each line segment. That translates to

\begin{align} \frac{\partial h(x, y)}{\partial x} = 0\, ,\quad x = 0 \text{ or } x = a\, ,\\ \frac{\partial h(x, y)}{\partial y} = 0\, ,\quad y = 0 \text{ or } y = b\, .\\ \end{align}

Since you are using a finite difference method these boundary conditions won't appear naturally. A common approach is to use phantom nodes, that is, nodes outside your domain, to get these boundary conditions.

Let's consider that you have a rectangular grid and enumerate first in the $x$ direction and then in the $y$ direction. So, using a centered finite difference for the derivative with respect to $x$ at $x=0$ you get

$$\frac{u_{1, j} - u_{-1, j}}{2\Delta x} = 0\, ,$$


$$ u_{-1, j} = u_{1, j}\, .$$

You do the same for the other boundaries and get: $u_{m+1, j} = u_{m-1, j}$, $u_{i, -1} = u_{i, 1}$, $u_{n+1, i} = u_{n-1, i}$. After that, you modify your matrix for the entries that are centered in the borders with phantom nodes.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.