# Design and developement of a 3D Cylindrical FDTD Code - Optimization

Status
Not open for further replies.

#### peponas

##### Junior Member level 3
First of all I've managed to build from scratch a 3D FDTD code for modelling waves travelling in cylindrical waveguides. The problem comes when I have to calculate nr, nf and nz where ni; i=r,f,z are the spatial steps in the computational grid. I use a modified version of an earlier adoption of the same issue, regarding cartesian coordinates. So, that's my assumptions:
Users input a number, the so-called cells per wavelength, which denotes the number of cells per a free space wavelength. Then this number (it acts as a basic spatial steps) is compared with the appropriate metrics to calculate spatial steps. Thus, dr is the timestep that is calculated with the following algorithm

while((dr)>=lamda/cellspw )
{
nr++;
}

From that, dr will be equal or smaller than the basic spatial step
In a similar way, dz is calculated.
BUT, for the azimuthial cells this relation becomes

while (((df*radius)>=lamda/(cellspw)) || (nf % 4!=0))
{
nf++;
df=2*M_PI/nf;
}

(nf has to be a product of 4 to avoid singular point at r=0)

So, df is the angle whose arc (at a radial point equal to the radius) is equal or smaller to that basic step referred before. With this method we are sure that we've taken in account the largest possible distance within our grid in the azimuthial direction.

With this logic, comparing a rectangular waveguide with similar characteristics as cutoff frequency of TE10 mode and dimensions we can make an assignment like that one given below

big dimension of the waveguide assigns to half the perimeter. That's because in the big dimension of the rectangular waveguide is corresponded half wavelength and in the perimeter two wavelengths
small dimension of the waveguide to the radius
length to the length

With this logic, we obtain similar cell number for the propagation direction and the radius, but a larger enough number for the azimuthial direction (nf). In other words, nf is considerably larger than the rectangular equivalent, when using similar dimensions and approach.

And here comes my question. What is wrong? This as you can assume makes timestep very small leading my simulations to last longer. How can azimuthial step (nf) number can be calculated instead? This number I think is very large and we don't need such a big number. One obvious answer is to reduce resolution in the azimuthial direction. But I want a more systematical approach.