srmainwaring / asv_wave_sim

This package contains plugins that support the simulation of waves and surface vessels in Gazebo.
GNU General Public License v3.0
110 stars 29 forks source link

Waves: optimise FFT wave simulation current amplitude update #110

Closed srmainwaring closed 1 year ago

srmainwaring commented 1 year ago

This PR optimises the update of current amplitudes in the FFT wave simulation.

Details

Instrumentation reveals that updating sin(wt) and cos(wt) contributes > 50% of the amplitude update. This change reduces the number of evaluations by maintaining a list of the unique values of the angular frequency and a reverse lookup index. Because the wavenumber magnitude is evaluated on a regular grid the number of unique values of the angular frequency is approx 1/5 - 1/10 of the full nx * ny array.