Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance optimization for computing the radiation pattern of a non-axisymmetric point dipole in cylindrical coordinates #2898

Open
oskooi opened this issue Sep 2, 2024 · 1 comment

Comments

@oskooi
Copy link
Collaborator

oskooi commented Sep 2, 2024

In cylindrical coordinates, computing the response from a point dipole $\delta(r - r_0)\delta(\phi)\delta(z - z_0)$ involves a Fourier-series expansion of the fields from a ring current source requiring $M+1$ simulations ($M$ is an integer determined by the cutoff threshold of the power radiated by the current source) as demonstrated in Tutorial/Nonaxisymmetric Dipole Sources. Computing the radiation pattern of a point dipole, as demonstrated in Tutorial/Extraction Efficiency of a Collection of Dipoles in a Disc, currently involves performing a near-to-far field transformation $M+1$ times for each point (or rather each polar angle $\theta$) in the far field using get_farfield. The near-to-far field calculations can be expensive when: (1) the near-field DFT monitor involves many grid points, (2) there are a large number of far field points, and (3) there are multiple frequencies (though this can be sped up using multithreading).

For reference, the current approach to computing the radiation pattern is described in the tutorial as follows:

Screenshot 2024-09-01 at 23 24 35

As a performance optimization, it would be better to: (1) accumulate the DFT near fields from the Fourier-series expansion and (2) perform a single near-to-far field transformation using the total DFT near fields from (1) at the end of the run. This is equivalent to computing the equivalent current sources from the total DFT near fields for $\vec{E_+}$ and $\vec{H_+}$:

Screenshot 2024-09-01 at 23 30 22

To support this feature, we would need to provide a new method add_near2far_data(self, near2far, n2fdata) to the DftObj class to add n2fdata to near2far, objects which are returned by the meep.Simulation.add_near2far method. The new method would be similar to the existing load_near2far_data(self, near2far, n2fdata) method but instead of replacing the near2far object with n2fdata would add to it. (Note that there is already a scale_near2far_fields(s, near2far) method which can be used to weight the DFT near fields near2far by a complex number s.)

@stevengj
Copy link
Collaborator

stevengj commented Sep 5, 2024

As a performance optimization, it would be better to: (1) accumulate the DFT near fields from the Fourier-series expansion and (2) perform a single near-to-far field transformation using the total DFT near fields from

The problem is that you can't simply sum the near fields in the rz plane (i.e. at φ=0), because they have different φ dependencies.

So, I think you would still need to safe the DFT near fields separately for each m. You might gain some speed by putting the sum over m inside the near2far transform (so that for each point r,z,φ in the near field, you first sum over m to get the near-field amplitude, and then compute the far-field contributions once for that point).

Assuming the FDTD simulation is the majority of the time, however, you still won't gain much overall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants