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

offer DFT decimation option #1678

Closed
stevengj opened this issue Jul 15, 2021 · 4 comments · Fixed by #1720
Closed

offer DFT decimation option #1678

stevengj opened this issue Jul 15, 2021 · 4 comments · Fixed by #1720

Comments

@stevengj
Copy link
Collaborator

stevengj commented Jul 15, 2021

To improve performance, it would be nice to offer the option to to "decimate" the DFT sum: accumulate the DFT coefficients on every n-th timestep instead of on every timestep. (Note: we should also increase the dt_factor by n on this line.)

We can default to n=1 (the current behavior) for now, and then run some tests to see what the impact of different n values is. Possibly in the future we may be able to default to a larger n (it should depend in the highest DFT frequency and on the source bandwidths, in principle), but in the meantime users can just try doubling this and see if it affects the results significantly

@stevengj
Copy link
Collaborator Author

In particular, if all of the sources have known narrow bandwidths (e.g. all are Gaussian sources), then we can calculate the largest Δt that will not alias a source frequency into the DFT bandwidth.

@stevengj
Copy link
Collaborator Author

In principle, we could make this a parameter of each DFT object, but it might be easer to use if it is per-Simulation?

@stevengj
Copy link
Collaborator Author

In particular, if the Meep timestep is Δt, and we DFT using NΔt (every N-th) step, then frequencies f that differ by 1/NΔt will be aliased.

Suppose that the source bandwidth is within (f1,f2). For real simulations, we take the real part of the source and this means that the bandwidth also covers (-f2,-f1) along the negative-frequency axis. Suppose that the DFT bandwidth is for frequencies within (F1,F2).

We want to make sure that no source frequency is aliased to a DFT frequency. If I understand this correctly, this means we want F2-(-f2) < 1/NΔt, and hence N < 1/Δt(f2 + F2).

@stevengj
Copy link
Collaborator Author

It would be nice to try this "by hand" for a sample calculation with a Gaussian source, and check that making N too large indeed causes aliasing artifacts, with the threshold being about what is predicted above.

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

Successfully merging a pull request may close this issue.

1 participant