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.
This PR optimises the update of current amplitudes in the FFT wave simulation.
Details
Instrumentation reveals that updating
sin(wt)
andcos(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 fullnx * ny
array.