-
Notifications
You must be signed in to change notification settings - Fork 45
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
Improve execution time for surface elevation computation #229
Comments
That is an incredible time improvement and we should use this assuming there are no other tradeoffs. @cmichelenstrofer could you comment on @mbruggs proposed approach? |
@ssolson The IFFT is the better approach for this. The only limitation is that the frequencies have to be evenly spaced (but I believe the current function enforces this anyways). In some applications (rare in practice tbh) you might want uneven spacing, such as the "equal energy binning". So maybe there is still an advantage to keeping a separate function that uses the sum of sines? @ryancoe thoughts? |
I'd say it'd be relatively easy to check that frequency spacing and then select either the |
Previously the surface elevation was only computed using the 'sum of sines' method. This has been found to be prohibitively slow when computing long duration surface elevation traces. This commit introduces the capability to compute the surface elevation using the more computationally efficient IFFT. The IFFT routine is used by default if no frequency bins are provided and the input frequency vector is equally spaced. For example a 1hr sea state realisation at 20Hz took 11s to compute using the 'sum of sines' and 0.007s using the IFFT. Fixes MHKiT-Software#229
This is primarily placeholder, I'm happy to contribute this improvement when I get a moment. The code below needs generalising to properly use the Dataframe that is passed in.
Describe the bug:
The computation of the surface elevation from a spectrum uses a 'sum of sines' approach which is prohibitively slow. During some experiments, trying calculate a 3hr sea state at 20Hz resolution crashed the python process on my machine, a 1hr sea state took 11s.
Alternative approach
Alternatively, we can use an approach using an
ifft
. For the same calculation that previously took 11s, theifft
version took 0.007s.The code below (loosely adapted to match current MHKit structure) gave the same results as the previous surface_elevation method using the sum of sines.
The text was updated successfully, but these errors were encountered: