Hi Thorsten,

my idea is to set up the voltages and currents as usual and to "hide" the imaginary parts of "volt_im" and "curr_im" in my "engine_ext_pbc" like you suggested.

The imaginary parts are initialized to 0 but once the main engine comes to the points on the grid which touch a periodic boundary we would need field values which are one step outside of the grid, e. g. to update volt[n][nX-1,j,k] we would need currents from outside the grid, for example curr[nP][i,Ny,k]. The PBC tells us that those can be obtained by taking curr[nP][i,1,k] and multiplying it by exp(i * k_y * L_y). On the first iteration, where the curr_im and volt_im are all zero we simply multiply by cos(k_y * L_y) to update the real part, but from there on an imaginary part arises which is volt_im[n][nX-1,j,k] = volt[n][nX-1,j,k]*sin(k_y * L_y). Once we have a nonzero imaginary parts, we have to use:

curr[nP][i,Ny,k] = cos(k_y * L_y) * curr[np][i,1,k] - sin(k_y * L_y) * curr_im[np][i,1,k] to update the real part of the current and:

curr_im[np][i,Ny,k] = sin(k_y * L_y) * curr[np][i,1,k] + cos(k_y * L_y) curr_im[np][i,1,k] to update the imaginary parts.

Does anything I am trying to explain make sense to you, Thorsten?

Best regards

## Periodic Boundary Conditions (PBC)

**Moderator:** thorsten

### Re: Periodic Boundary Conditions (PBC)

Wrong forum?My feap version is 8.4.