Spectra to Surfaces: 1D
The previous page showed the major features of the Fourier analysis of a sea-surface elevation record. We started with a sample of a random sea surface and ended with the corresponding discrete variance spectrum (or estimate of the variance spectral density after division by the frequency interval). This page shows how to go in the reverse direction: start with a variance spectrum and generate a random realization of the corresponding sea surface. We ﬁrst outline the theory, and then show a speciﬁc example.
Theory for 1-D Surfaces
To create a one-dimensional (1-D) slice through a sea surface, the essence of the process is as follows:
- Choose the domain size. To create a sea surface over a spatial domain at a given time, we pick the length of the region . To generate a time series at a given point, we pick the length of the time series.
- Choose the number of points for the DFT. This number is the number of frequencies at which we will sample the variance spectrum, and equals the number of samples of the sea surface that will be generated. In normal usage, pick to be a power of 2 so that an inverse FFT routine can be used to evaluate the inverse DFT.
- Choose the frequency variable. To generate a sea surface over a spatial domain at a given time, we can use either wavenumber or angular spatial frequency . To generate a time series at a given point, we can use either or .
- Choose a variance spectrum The variance spectrum must be expressed in terms of the chosen frequency variable.
- Choose the wind speed. Pick a wind speed, and perhaps other physical parameters such as the age of the waves to be generated if required by the chosen variance spectrum.
- Create random Hermitian amplitudes. This is the tricky part. We must create an array of randomized discrete Hermitian Fourier amplitudes , starting with the chosen continuous variance spectrum.
- Take the inverse DFT of the random amplitudes. The inverse DFT converts the Fourier amplitudes to the physical wave heights.
- Extract the sea surface heights. The inverse DFT of the complex amplitudes returns a complex array. The real part of this array is the random realization of the sea surface heights, and the imaginary part is zero.
- Check your results. This is extremely important during code development. For example, take the DFT of the generated surface heights to see if you get back to the Fourier amplitudes and variance spectrum you started with.
We now proceed through these steps and discuss them in detail for a speciﬁc example.
Steps 1 and 2: Let us generate a sea surface over the region from to . The longest wavelength that can be resolved is then 100 m. We use , which gives a spatial grid resolution of . This means that the shortest wavelength that can be resolved, the two-point wave or Nyquist wavelength, is .
Step 3: We used wavenumber in the previous pages because of its easy interpretation. Now let’s use angular spatial frequency , which is more commonly used. The fundamental frequency is then . The highest frequency sampled, the Nyquist frequency, is . Note that which, as noted above, is the wavelength of the two-point wave.
Step 4: For this example, we use the Pierson-Moskowitz variance spectrum in terms of angular spatial frequency . This is given by Eq. (1) of the Wave Variance Spectra: Examples page. Note that this is a one-sided spectrum, which is deﬁned for positive values.
Step 5: The wind speed at 10 m elevation is . The wind speed is the only input to the Pierson-Moskowitz spectrum.
Step 6: We now discuss in detail how to generate a set of random discrete Fourier amplitudes that are physically consistent with the chosen variance spectrum. These amplitudes must be deﬁned for both positive and negative frequencies, and the amplitudes must be Hermitian. We ﬁrst deﬁne
Here denotes the continuous spectral density evaluated at . is the spatial frequency sampling interval. must be deﬁned for both positive and negative discrete frequencies in order to create the Hermitian amplitudes for use in the inverse DFT. As was mentioned on the previous page, we must convert the one-sided continuous spectrum into a two-sided discrete variance function by
- dividing its magnitude by 2, assuming that ;
- multiplying the continuous spectral density by the fundamental frequency interval , which gives the variance contained in a ﬁnite frequency interval at each frequency .
To emphasize the discrete vs continuous functions, and for brevity of notation, let us write the frequency index for the frequency . Then Eq. (1) becomes
where denotes the two-sided discrete variance spectrum at frequency . can now be evaluated for both positive and negative . The 0 and Nyquist frequencies are always special cases: set and . and are independent random numbers drawn from a normal distribution with zero mean and unit variance, denoted . A diﬀerent pair is drawn for each value.
is a random variable. Let denote the expectation of the enclosed variable. The expected value of , , gives back whatever variance function is used for :
because for random variables. Thus is consistent with the chosen variance spectrum. However, is not Hermitian, so the inverse DFT would not give a real sea surface.
Next deﬁne as
This function is clearly Hermitian, so the inverse DFT applied to will give a real-valued . Moreover, this is consistent with the variance spectrum:
Here we have noted that , etc., because the random variables are uncorrelated for diﬀerent values.
Equations (1) and (3) are the key to generating random sea surfaces from variance spectra. deﬁned by these equations contains random noise, which leads to a sea surface with random amplitudes and phases for the component waves of diﬀerent frequencies. Any one of these surfaces has a variance spectrum that looks like the chosen spectrum plus random noise. However, on average over many realizations, the the noise in these spectra will average out, leaving the variance spectrum. Figure 1 below illustrates these important ideas, but ﬁrst we must complete the surface generation.
Step 7: Compute the inverse DFT of the of Eq. (3). The result is a complex function :
A crucial warning to this step is that the elements of the array must be in the FFT frequency order given by Eq. (13) of the Fourier Transforms page when using an FFT routine to evaluate the DFT. is returned with values in the order from to .
Step 8: Extract the surface. The inverse DFT returns a complex array whose real part is the surface elevations and whose imaginary part is 0. The surface elevations are extracted as the real part of :
Step 9: Check the results! There are many places along the way to lose a or to mess up array indexing. At the minimum, it is worthwhile to check that the mean of the generated surface is zero, and that the imaginary part of (to within a small amount of numerical roundoﬀ error).
When developing computer code, or when ﬁrst learning this material, it is also a good idea to take the forward DFT of to make sure that the input Fourier amplitudes are recovered, and that the variance spectrum corresponding to is consistent with the one chosen in Step 4. Indeed, it was the failure of this check in surfaces I was generating using equations from the literature that led me to develop the Mobley (2016) tutorial and these web pages.
Equations (1) and (3) are, with minor changes in notation, Eqs. (42) and (43), respectively, of Tessendorf (2004). However, Tessendorf’s version of Eq. (1) appears to use a one-sided variance spectrum (his example used the one-sided Phillips spectrum of his Eq. (40)) without the division by 2 seen in Eq. (1), which is needed to convert the one-sided spectrum to a two-sided spectrum. Nor does he show the factor needed to convert a continuous spectral density to a discrete function. His version of Eq. (3) does not contain the overall factor of seen above. These missing factors mean that in a round-trip calculation
you do not get back to the original variance spectrum. In other words, the Tessendorf equations do not conserve wave variance (i.e., wave energy). Even if he included the factor in his actual computations, the missing factors of in his versions of our Eqs. (1) and (3) give an overall factor one-half on the amplitudes, which corresponds to a factor of four error in the variance. That is, waves generated using the Tessendorf equations have amplitudes that are too large.
Tessendorf (2004) discusses much more than just Fourier transform techniques, and his notes have been very inﬂuential in the computer graphics industry. In 2008 he deservedly received an Academy Award for Technical Achievement for showing the movie industry how to generate and render sea surfaces, as well as for his many other pioneering accomplishments in eﬃciently computing and rendering ﬂuid motions into visually appealing images. (The ﬁrst movie to use his techniques was Waterworld, followed by dozens of others including Titanic.) When I checked with him about the missing numerical factors, he readily acknowledged that Eqs. (1) and (3) are the correct ones, but pointed out that “Hollywood doesn’t care about conservation of energy.” I suppose that should be no surprise, since movies seem to have no problem with rockets going faster than the speed of light, sound propagating through the vacuum of outer space, or time travel that violates causality. Tessendorf’s equations are widely cited (especially in the computer graphics literature), always without comment about the missing scale factors. Even if Tessendorf had included the needed numerical factors in his equations, graphics artists would distort the resulting images to make them look “better,” e.g., to make the ocean waves look bigger than nature would allow. That may be acceptable in a fantasy world, but such laxness is not permissible if we wish to use numerically generated waves to compute sea surface optical properties.
Example: A Roundtrip Calculation
Figure 1 shows an example of 1-D surface waves generated using the Pierson-Moskowitz spectrum for a wind speed of 5 m/s, and the recovery of the variance spectrum from the generated surface. The blue curve in the upper-left panel shows the Pierson-Moskowitz spectrum as deﬁned by Eq. (1) on page Wave Variance Spectra: Examples. The red dots show the frequencies at which the continuous spectrum is sampled. Those dots blur together at the higher frequencies because of the log scale, but the points are equally spaced at intervals of the fundamental frequency . The last sampled frequency is . The bottom panel shows the sea surface elevations generated for a particular sequence of random numbers .
The red line in the upper-right panel shows the function
is the discrete variance function for this particular surface. Schuster (1898) called a periodogram. The periodogram contains random noise because is a random realization of the sea surface, which was generated by applying random noise to the the variance spectrum. This particular is analogous to a particular measurement of the sea surface. Had we drawn a diﬀerence sequence of random numbers for use in Eq. (2), we would have generated a diﬀerent sea surface, and a diﬀerent . However, we can expect that if we average together many diﬀerent , corresponding to many diﬀerent sets of , the noise would average out and we would be left with a curve close to the variance spectrum we started with, which is shown in blue. Numerical experimentation shows that averaging 100 generated from 100 independent sea surface realizations gives an average that is almost indistinguishable from the blue curve at the scale of this plot. Thus is an approximation of the variance density spectrum , denoted . This averaging processes leads to the topic of spectrum estimation, which considers such problems as how many sets of measurements of are needed to estimate the variance spectrum to within certain error bounds. Fortunately, we need not pursue that here. (The noise is the upper right panel is Gaussian distributed about the theoretical spectrum. However, the log axis makes it look asymmetric about the blue curve.)
At the minimum, you should always check to see that Parseval’s relation, Eq. (17) of the Fourier Transforms page, is satisﬁed. For the simulation of Fig. 1, we have
There are sometimes other checks that can be made. For example, the Pierson-Moskowitz spectrum is simple enough that it can be analytically integrated over all frequencies. This gives
where we have recalled that the variance spectral density is related to the variance of the sea surface. The variance of the generated zero-mean sea surface can be computed from
and compared with the analytical expectation. For the surface seen in Fig. 1, Eq. (6) gives vs. the theoretical value of from Eq. (5). This agreement to within a small amount of random noise indicates that all is probably well with the calculations. Indeed, the average one standard deviation for 100 independent simulations is , which agrees well with the theoretical value.
The signiﬁcant wave height is by deﬁnition the height (trough-to-crest distance) of the highest one-third of the waves. To a good approximation, this is related to the expectation of the variance by
In the present example, this formula gives . The average signiﬁcant wave height for 100 simulations is (average one standard deviation). If you spend enough time in a sea kayak to develop intuition about wave heights as a function of wind speed, a half-meter height for the largest waves is about right for a or 10 knot wind speed.
To summarize this page: we have learned how to start with a wave variance spectral density function and generate random discrete Fourier amplitudes. The inverse DFT of those amplitudes gives a random realization of a sea surface that is physically consistent with the chosen variance spectrum. That is all that we can ask of the Fourier transform technique.