Proposal for the implementaion of Fraunhofer far field
Moderators: thorsten, sebastian
Proposal for the implementaion of Fraunhofer far field
Hi,
I would like to add an FFT accelerated far field calculation to the Python interface. It would calculate the Fraunhofer far field approximation which is valid for large distances >> lambda. The current nf2ff implementation calculates the exact far field, given a certain radius. This approach accounts for the radiating near field. The reactive near field should be enclosed by the FDTD domain anyway.
However, in many cases one is interested in the far field for very large radii >> lambda. In these cases the Fraunhofer approximation is valid. I.e. the field at a point can be obtained by just multiplying the angular distribution by exp(jkr)/r. The former can be obtained via FFT. The advatage would be a fast calculation for many directions (phithetacombinations), in fact as many as we have sampling points on the faces of the nf2ff box. The disadvantage would be inaccuracies when r is not so much larger than lambda.
Technically we can do this by introducing a new keword for nf2ff.CalcNF2FF, e.g. "method". It could take the the values "exact" (default) which is the current nf2ff implementation. When it takes the value "Fraunhofer", a class _nf2ff_Fraunhofer would be used instead of _nf2ff. The former can be a subclass of the latter. Although a certain radius is not needed for the Fraunhofer approximation, the given radius can be used for the calculation of the field at a dedicated point via the above multiplication.
Do you think this would be a proper way for the implementation? Do you think this is a desirable feature at all?
Cheers
Georg
PS: There would be a nice offspring. When the angular distribution is known, it would be easy to implement a method which calculates the field of paraxial beams (e.g. Gaussian beams or the radiation patterns of strongly directional antennas) in arbitrary planes outside the FDTD domain. This in turn can be the beginning of a physical optics extension (mirrors, lenses and the like).
I would like to add an FFT accelerated far field calculation to the Python interface. It would calculate the Fraunhofer far field approximation which is valid for large distances >> lambda. The current nf2ff implementation calculates the exact far field, given a certain radius. This approach accounts for the radiating near field. The reactive near field should be enclosed by the FDTD domain anyway.
However, in many cases one is interested in the far field for very large radii >> lambda. In these cases the Fraunhofer approximation is valid. I.e. the field at a point can be obtained by just multiplying the angular distribution by exp(jkr)/r. The former can be obtained via FFT. The advatage would be a fast calculation for many directions (phithetacombinations), in fact as many as we have sampling points on the faces of the nf2ff box. The disadvantage would be inaccuracies when r is not so much larger than lambda.
Technically we can do this by introducing a new keword for nf2ff.CalcNF2FF, e.g. "method". It could take the the values "exact" (default) which is the current nf2ff implementation. When it takes the value "Fraunhofer", a class _nf2ff_Fraunhofer would be used instead of _nf2ff. The former can be a subclass of the latter. Although a certain radius is not needed for the Fraunhofer approximation, the given radius can be used for the calculation of the field at a dedicated point via the above multiplication.
Do you think this would be a proper way for the implementation? Do you think this is a desirable feature at all?
Cheers
Georg
PS: There would be a nice offspring. When the angular distribution is known, it would be easy to implement a method which calculates the field of paraxial beams (e.g. Gaussian beams or the radiation patterns of strongly directional antennas) in arbitrary planes outside the FDTD domain. This in turn can be the beginning of a physical optics extension (mirrors, lenses and the like).
Re: Proposal for the implementaion of Fraunhofer far field
Hi,
you can certainly give it a try and I will have a look at it. But I'm still not convinced that this will work.
As mentioned and asked in another thread, we use a DTFT (not a normal DFT) because we do not have a periodic signal and thus I still think that a FFT is not a good idea or even possible.
But give it a try, I'm curious to see if it works or not... After all the Fraunhofer far field could just as easily be calculated using the ordinary D(T)FT...
regards
Thorsten
you can certainly give it a try and I will have a look at it. But I'm still not convinced that this will work.
As mentioned and asked in another thread, we use a DTFT (not a normal DFT) because we do not have a periodic signal and thus I still think that a FFT is not a good idea or even possible.
But give it a try, I'm curious to see if it works or not... After all the Fraunhofer far field could just as easily be calculated using the ordinary D(T)FT...
regards
Thorsten
Re: Proposal for the implementaion of Fraunhofer far field
OK, I will first try to reproduce the pattern of the horn antenna tutorial with only the zp face of the nf2ff box. This would be the easiest way to benchmark the code against the current nf2ff. As mentioned, the advantage of using the FFT is just speed and I think it makes only sense if the whole 3D pattern with many sampling points is to be calculated.
Regarding the FFT it seems to me there is some misunderstanding. The Fraunhofer formula uses the 2D Fourier transform with respect to the wavenumber. It expects the data on the faces of the nf2ff box which is already Fourier transformed with respect to time for one specific frequency. This can be done by giving the 'Frequency' keyword to CreateNF2FFBox. I will report here when I have a result.
Cheers
Georg
Regarding the FFT it seems to me there is some misunderstanding. The Fraunhofer formula uses the 2D Fourier transform with respect to the wavenumber. It expects the data on the faces of the nf2ff box which is already Fourier transformed with respect to time for one specific frequency. This can be done by giving the 'Frequency' keyword to CreateNF2FFBox. I will report here when I have a result.
Cheers
Georg
Re: Proposal for the implementaion of Fraunhofer far field
Hi,
meanwhile I did some work on the FFT thingie for the far field calculation. In this context I discovered that nf2ff calculates P_rad always for r=1m, no matter what radius is given to CalcNF2FF. I guess this is a bug. The E field components depend correctly on r. They agree with P_rad only for r==1.
In the following I try to explain why the FFT accelerated Fraunhofer solution for the far field is useful. I only use the zp plane of the horn tutorial at 15GHz (i.e. the radiating aperture of the horn). I calculated the z component of the Poynting vector via E_x and E_y on the zp face of the nf2ff box (z=0.14m). This is shown in Figure 1. It has two maxima which reflects the nature of the horn antenna. Then I use the plane wave decomposition to propagate the field onto an aperture at z=0.4m. This position is still in the Fresnel region (radiating near field) where a far field approximation is not appropriate. The plane wave decomposition can be efficiently implemented. It uses two 2DFFT's (256x256, milliseconds on a standard PC) to propagate the field and is is exact in the sense that it makes no far field approximation. (Of course it needs to discretize the field beacause the computer is a digital device.) We can still see the remainings of these two maxima in the power density, see Figure 2.
Now I calculate the field on a sphere with r=0.4m. So the point r=0.4, theta=0 is in the center of this aperture. The field is calculated with the nf2ff code, the Fraunhofer integral and the RayleighSommerfeld (RS) integral. The Fraunhofer integral can be calculated efficiently via the FFT but is only valid in the far field region (which is not the case at 0.4m). The RayleighSommerfled integral is exact but there is no efficient algorithm for it (although it is not too slow when using vectorized Python code). The result of the power density over theta at phi=pi/2 is shown in Figure 3. The zprojection of this theta arc lies on the yaxis. The RS integral reflects the two little side lobes correctly as it is exact, just like the plane wave decomposition. As expected, this is not the case for the Fraunhofer integral as it is not valid in this region. Nevertheless it agrees quite well with the solution of nf2ff which also seems to make use of some far field approximation.
When we do the same at r=z=2m, then we are in the far field region and obtain the result in Figure 4. The according plane power distribution at 2m is shown in Figure 5.
Now all three codes agree quite well and reflect the field distribution on the plane aperture at 2m. This is beacuse at 2m the far field approximation is legitimate. The results agree even more at 10m (definite far field).
So my proposal would be to implement two versions of the field calculation outside the FDTD domain: RS for an exact solution in the radiating near field and FFT accelerated Fraunhofer for the far field. The Fraunhofer far field can be calculated very fast for many points (only a single 32x32 FFT for the horn tutorial). So we can efficienly calculate a full 3D far field on a dense grid. The r dependency of the Fraunhofer solution is just the factor exp(jkr)/r. So it would be sensible to omit this factor in the result and let it to the user apply an appropriate r dependency. In this way the field can be efficiently calculated in the whole 3D space once the solution on the thetaphi mesh is provided by the FFT routine. This could be useful e.g. for the calculation of the field on the surface of a large reflector antenna when the feed is modeled with FDTD.
The RS variant cannot be used for an efficient 3D far field calculation. Nevertheless, it is valid in regions outside the FDTD domain which are not yet in the far field. So it might be useful for some field probes in the vicinity of the FDTD domain.
In a later step, we could implement a third variant with the plane wave decomposition in order to efficiently calculate the field in (oblique) planes outside the FDTD domain. This can be the beginning of a "Physical Optics Toolbox".
What do you think?
Cheers
Georg
meanwhile I did some work on the FFT thingie for the far field calculation. In this context I discovered that nf2ff calculates P_rad always for r=1m, no matter what radius is given to CalcNF2FF. I guess this is a bug. The E field components depend correctly on r. They agree with P_rad only for r==1.
In the following I try to explain why the FFT accelerated Fraunhofer solution for the far field is useful. I only use the zp plane of the horn tutorial at 15GHz (i.e. the radiating aperture of the horn). I calculated the z component of the Poynting vector via E_x and E_y on the zp face of the nf2ff box (z=0.14m). This is shown in Figure 1. It has two maxima which reflects the nature of the horn antenna. Then I use the plane wave decomposition to propagate the field onto an aperture at z=0.4m. This position is still in the Fresnel region (radiating near field) where a far field approximation is not appropriate. The plane wave decomposition can be efficiently implemented. It uses two 2DFFT's (256x256, milliseconds on a standard PC) to propagate the field and is is exact in the sense that it makes no far field approximation. (Of course it needs to discretize the field beacause the computer is a digital device.) We can still see the remainings of these two maxima in the power density, see Figure 2.
Now I calculate the field on a sphere with r=0.4m. So the point r=0.4, theta=0 is in the center of this aperture. The field is calculated with the nf2ff code, the Fraunhofer integral and the RayleighSommerfeld (RS) integral. The Fraunhofer integral can be calculated efficiently via the FFT but is only valid in the far field region (which is not the case at 0.4m). The RayleighSommerfled integral is exact but there is no efficient algorithm for it (although it is not too slow when using vectorized Python code). The result of the power density over theta at phi=pi/2 is shown in Figure 3. The zprojection of this theta arc lies on the yaxis. The RS integral reflects the two little side lobes correctly as it is exact, just like the plane wave decomposition. As expected, this is not the case for the Fraunhofer integral as it is not valid in this region. Nevertheless it agrees quite well with the solution of nf2ff which also seems to make use of some far field approximation.
When we do the same at r=z=2m, then we are in the far field region and obtain the result in Figure 4. The according plane power distribution at 2m is shown in Figure 5.
Now all three codes agree quite well and reflect the field distribution on the plane aperture at 2m. This is beacuse at 2m the far field approximation is legitimate. The results agree even more at 10m (definite far field).
So my proposal would be to implement two versions of the field calculation outside the FDTD domain: RS for an exact solution in the radiating near field and FFT accelerated Fraunhofer for the far field. The Fraunhofer far field can be calculated very fast for many points (only a single 32x32 FFT for the horn tutorial). So we can efficienly calculate a full 3D far field on a dense grid. The r dependency of the Fraunhofer solution is just the factor exp(jkr)/r. So it would be sensible to omit this factor in the result and let it to the user apply an appropriate r dependency. In this way the field can be efficiently calculated in the whole 3D space once the solution on the thetaphi mesh is provided by the FFT routine. This could be useful e.g. for the calculation of the field on the surface of a large reflector antenna when the feed is modeled with FDTD.
The RS variant cannot be used for an efficient 3D far field calculation. Nevertheless, it is valid in regions outside the FDTD domain which are not yet in the far field. So it might be useful for some field probes in the vicinity of the FDTD domain.
In a later step, we could implement a third variant with the plane wave decomposition in order to efficiently calculate the field in (oblique) planes outside the FDTD domain. This can be the beginning of a "Physical Optics Toolbox".
What do you think?
Cheers
Georg
 Attachments

 Zeichnung.png (225.15 KiB) Viewed 8245 times
Re: Proposal for the implementaion of Fraunhofer far field
Hi,
EDiT: By the way, if you are already preparing your git commits. If you have not done it yet you may want to wait a bit? I'm currently considering to merge the python branch to master including some cleanup and changes (concerning meshing)...
But it's not yet ready...
regards
Thorsten
That might be the case, I will have a closer look.In this context I discovered that nf2ff calculates P_rad always for r=1m, no matter what radius is given to CalcNF2FF. I guess this is a bug. The E field components depend correctly on r. They agree with P_rad only for r==1.
The nf2ff calculates a farfield only. The supplied radius has no influence on this. If you ask for the far field at 0.5m you get the same result just with a different weighting... The nf2ff does not care for which distance the solution is correct or not, it will give you only a farfield.Nevertheless it agrees quite well with the solution of nf2ff which also seems to make use of some far field approximation.
I'm not that deep in this topic. I pretty much only know the nf2ff for calculation the farfield radiation pattern. That said, feel free to continue working on this improved approaches. Having more options is never a bad thing we only need to create a proper documentation explaining the pro's and con's and when to use what.What do you think?
EDiT: By the way, if you are already preparing your git commits. If you have not done it yet you may want to wait a bit? I'm currently considering to merge the python branch to master including some cleanup and changes (concerning meshing)...
But it's not yet ready...
regards
Thorsten
Re: Proposal for the implementaion of Fraunhofer far field
Well it seems that neither the Matlab nor the python interface (yet) allow any changing of the radius. Thus my question is how did you even come to that conclusion?That might be the case, I will have a closer look.
In any case the user can easily just multiply the result with 1/r for the Efield and 1/r^2 for P_rad and all is well and good
regards
Thorsten
Re: Proposal for the implementaion of Fraunhofer far field
Hi Thorsten,
for P_rad just try the following in the horn tutorial after RunOpenEMS and play with the 'Radius' parameter.
From the result above, my suspicion is that nf2ff already uses the Fraunhofer approximation, just not under its name and without FFT acceleration. This is because as you mention the radius does not influence the angular distribution (this would not be the case for the RSIntegral).
As the FFT and interpolation routines in Octave and Python are fast enough, I think there is no necessity for a binary program like nf2ff just to speed up the calculation. Maybe RS can profit from a binary code, but I am even not sure in this case.
My code is far from being mergeable. It is just a quickanddirty proggy to demonstrate the suitability of the algorithm and to compare with the current nf2ff. My next step would be to implement this properly in the Python Interface and to write a litte demo for it. Maybe I will omit the Octave interface as it makes me crazy to switch between Octave and Python every now an then because of the different paradigms.
Cheers
Georg
for P_rad just try the following in the horn tutorial after RunOpenEMS and play with the 'Radius' parameter.
Code: Select all
thetaRange = (90:2:90);
nf2ff = CalcNF2FF(nf2ff, Sim_Path, f0, thetaRange*pi/180, [90]*pi/180, 'Radius',1 , 'Mode', 1);
Z0 = 376.73;
p_rad_from_e = (nf2ff.E_phi{1}.*conj(nf2ff.E_phi{1}) + nf2ff.E_theta{1}.*conj(nf2ff.E_theta{1}))/Z0/2;
disp (["P_rad comparison: " ,num2str(max(nf2ff.P_rad{1}(:))), " ", num2str(max(p_rad_from_e(:)))])
As the FFT and interpolation routines in Octave and Python are fast enough, I think there is no necessity for a binary program like nf2ff just to speed up the calculation. Maybe RS can profit from a binary code, but I am even not sure in this case.
My code is far from being mergeable. It is just a quickanddirty proggy to demonstrate the suitability of the algorithm and to compare with the current nf2ff. My next step would be to implement this properly in the Python Interface and to write a litte demo for it. Maybe I will omit the Octave interface as it makes me crazy to switch between Octave and Python every now an then because of the different paradigms.
Cheers
Georg
Re: Proposal for the implementaion of Fraunhofer far field
This should be fixed with: 9741b654e05e1f11d89c9bb3839d7a472d7fa863for P_rad just try the following in the horn tutorial after RunOpenEMS and play with the 'Radius' parameter.
Maybe, maybe not Would be interesting to find out what the differences are.From the result above, my suspicion is that nf2ff already uses the Fraunhofer approximation, just not under its name and without FFT acceleration
regards
Thorsten
Re: Proposal for the implementaion of Fraunhofer far field
Can you give me a literature reference for the method that is used in nf2ff? There are some equation references in the comments. Then I could tell whether it's equivalent to the Fraunhofer formula. It would be a bit tedious to grasp it from the source code.
Cheers
Georg
Cheers
Georg
Re: Proposal for the implementaion of Fraunhofer far field
I think it was from the FDTD "bible": Computational Electrodynamics: The FiniteDifference TimeDomain Method, Third Edition
But from your comments I can only guess that the method may be quite different.
regards
Thorsten
But from your comments I can only guess that the method may be quite different.
regards
Thorsten