Help me with 3D FDTD simulation to find the eigen frequencies of a rectangular cavity
I am now doing a course project with 3D FDTD simulation to find the eigenfrequencies of a rectangular cavity. It should be a easy job. However, no matter what kind of sources and cell size I use, the final results do not match the analytical solutions at all. I am now very confused. Can you help me a little bit?
cavity geometry size:
x-axis(height): 3 cm
y-axis(width): 4 cm
z-axis(length): 5 cm
the cell size I choose is delta_x(=delta_y=delta_z) = 2.5 mm
nx=12, ny=16, nz=20;
This cavity is lossless and filled with air. Analytical results are something like:
f1=4.xxGHz, f2=5.xxGHz ......
My results are quite large as to 10.xxGHz, and larger and larger...
I attached my matlab file and if you can help me, I really appreciate it. (type 'cavity' to run)
By the way, the source to excite the cavity I choose is a differential gaussian pulse current along z-axis. You can see this in my code. This is really another thing which makes me confused. I donot know the excitation will or not affect my simulation results. I once tried a randomly value at every node inside the cavity, and got different eigenfrequencies. Of coz, they are not correct either.
let me think about ur work then see
thanks.
Hi
From a first look what I feel is that you have not implemented any domain termination conditions (like ABCs) in your code.
This will definitely lead to erraneous results.
You can use absorbing boundary conditions like Mur, PML, Higdon, Liao etc.
Another thing I observed is that you have used so many unwanted arrays (like exini, eyini, ezini etc. These can be replaced with ex, ey, ez etc. (In fact it will not make any difference in the results).
Best Regards
Jithesh
Added after 34 minutes:
Hi
Are you using PEC walls to terminate your computation domain?
In that case you don't have to use any other boundary condition (like PML).
Regards
Jithesh
Hi,
First of all, thank you for your post.
Yes, I implemented PEC boundary to terminate the cavity, you can see that I do not update the boundary nodes in my code.
As to the unwanted variables like exini, eyini and ezini, yes, they are not necessary.
Hi,
Why don't you try the Matlab code (3D) provided by Taflove (which comes along with the Second or third editions of his text book: Computational Electrodynamics: The FDTD Method)?
It also models a Cavity backed by PEC walls.
The code is available in EDA board.
Best Regards
Jithesh
Yes, I have tried that.
But the final results are also not correct. Maybe I made error in fourier transform.
Sorry for being lazy, but I have not looked at your code. If you are new to FDTD you need to be very careful implementing the PEC boundary condition. It is not sufficient to assume fields outside the grid are zero due to the staggered nature of the Yee grid. If you do this, you will actually have a PEC boundary along 3 boundaries and a perfect magnetic conductor (PMC) along the other three boundaries. You should be able to recognize that you have PMC because the electric fields will have large values right up the boundary as if they go right through it. The electric field will be zero at a PEC boundary.
Also, when computing eigen-frequencies it is important to excite the resonator with a field that is able to excite the mode. For example, if you used a simple single-point dipole source, but placed it where a mode has a null, it will not excite that mode. I suggest using five to ten dipole sources scattered randomly around your resonator.
Do you have sufficient grid resolution?
I assume you are recording the response at several points in your resonator, computing fft's, adding them up, and seeking the peaks in the fft. How are you doing this? Are you interpretting your FFT correctly? Are your answers correct, but off by some constant factor?
-Tip
Thanks for your reply.
However, I am not very clear about the PMC boundary you said, actually I have no PMC here and H field lies in the center of the six faces of a cube, so on the boundary surface there shoud be no H field but only E field.
Added after 4 hours 22 minutes:
Ns = 2^nextpow2(maxstep); eft1 = fft(erec1,Ns)/nmax; eft2 = fft(erec2,Ns)/nmax; eft3 = fft(erec3,Ns)/nmax; eft4 = fft(erec4,Ns)/nmax; eft5 = fft(erec5,Ns)/nmax; Fs = 1/dt; freq = Fs/2*linspace(0,1,Ns/2); S = abs(eft1(1:Ns/2))+abs(eft2(1:Ns/2))+abs(eft3(1:Ns/2))+abs(eft4(1:Ns/2))+abs(eft5(1:Ns/2)); figure; plot(freq,S,'r'); grid on;
Hello,
you have to be careful when implementing the computational domain, if your cavity filled up the whole of your fdtd domain then U don't need to use any ABC at the boundary, except for the PEC BC that will represent the walls of the cavity, however, if your cavity does not fill the entire domain, you have to use ABC to terminate the computational domain. You must make sure that the reflection from the boundary of the domain is small enough (0.001 %) so that by the time it propagate back to the position of the cavity it will not contaminate the result of the computation. Also, as rrumpf said, you must make sure that the PEC walls of your cavity are truly PEC and there is no element of PMC on it.That is to say the update of the magnetic field must not be zero near or on the walls of the cavity and that the electric field is truly zero on the wall of the cavity.
Check the frequency spectrum of your source to make sure that its bandwith encompasses the frequency spectrum you are interested in and make sure that your grid cell is the right size required for the simulation and that the time of simulation is enough for the transient to die out leaving only the steady state solution.
Regards