CVEN 30-501 Computer Applications in Engineering and Construction Programming Assignment #4 Analysis of Wave Data Using Root-Finding Methods Date distributed: 9/30/016 Date due: 10/14/016 at 3:00 PM (electronic copy only) Submit your solution on turnitin.com by the due date and time shown above. Please show all your work and follow the rules outlined in the course syllabus. The health and resilience of U.S. coastlines and beaches are essential to the economy. Many states are dependent on tourism commerce stemming from coastal tourism, and industries such as shipping and fishing are only viable near a coastline. During major meteorological events, such as hurricanes and nor easters, or seismic-induced events such as tsunamis, the energetic ocean waves can cause tremendous erosion of the beach face. Added to enhanced surge levels, they can undermine building foundations and destroy coastal roads and infrastructure. One method engineers use to make viable designs of coastal structures is laboratory testing. In this laboratory, we will analyze wave data from a laboratory test to determine the properties of the waves. Section 1 presents a little background on wave description and theory, and Section details the steps of the data analysis. The contents of the memorandum are described in Section 3. 1. Wave Theory Ocean waves are generated by an impulse applied to the bounding surface (free surface and bottom boundary) of the ocean. Everything from wind stress to ships and undersea landslides can generate surface waves. Ocean waves are characterized by their: Length, L: the lateral distance between two successive crests. Height, H: the vertical distance between the crest and the trough. Period, T: the time it takes for two successive wave crests to pass a given point. Water depth, h: depth to the zero-crossing of the wave profile. Figure 1 summarizes these quantities for a typical wave. When the ratio of the wave height to the wave length is sufficiently small, waves can be analyzed using a linear wave theory. This theory is a simplification of the full, nonlinear theory for ocean waves, but has proven to be quite robust and is used very often. 1
Figure 1: Spatial and Temporal Description of Water Waves From linear theory, we can derive a relationship between the wave length L and period of a wave T, called the linear dispersion relation, given by ω = gk tanh( kh) (1) where ω = π /T is the radian frequency of the wave, k = π / L is the wave number, g is the acceleration of gravity, and h is the water depth.. Data Analysis.1 Evaluate the Linear Dispersion Relation In the laboratory, it is generally quite easy to measure the wave frequency ω by placing a wave gauge at a point of interest and recording the wave height over time. In order to find the related wave length, we must solve Equation (1) for the wave number k. Since the linear dispersion relation is transcendental in k, we must use a root finding method. In this laboratory, we will use the Newton-Raphson method. In order to use this method, we need a good initial guess for k; this is provided by Eckart (1951) as ω k = () g tanh( ω h/ g) We want to program this in a general way, so we will pass the parameters to our functions using an array defined as follows: parms = [omega, g, h];
Hence, to get the Newton-Raphson solution to Equation (1), do the following: 1. Write a user-defined function called kguess.m to evaluate Equation () in order to provide the initial guess to the Newton-Raphson method. This function has one input variable parms.. Re-write Equation (1) in the form of a root finding problem f( k ) = 0. Then, write a second user-defined function called my_func.m to evaluate this function. This function has two input variables: k and parms. 3. The Newton-Raphson method requires estimates of the derivative of the function in order to find the roots. Calculate the derivative fʹ ( k), and then write a third user-defined function called my_fprime.m to evaluate the derivative. This function likewise has two input variables: k and parms. 4. Finally, write a user-defined function to find the roots of an equation loosely following Figure 6.7 in the Chapra Numerical Methods book. You should also write a wrapper program named LastName134.m (using your last name and last four digits of your UIN) to test these programs. An example wrapper program is provided in the following % Set up parameters of the functions omega = *pi/10; % 1/s g = 9.81; % m/s^ h = 0; % m parms = [omega, g, h]; % Set up the root finding variables etol = 1e-6; % convergence criteria iter = 100; % maximum number of iterations f = @my_func; % function pointer to my_func fp = @my_fprime; % function pointer to my_fprime k0 = kguess(parms); % initial guess for root % Find the root [k, error, n_iterations] = newtraph(f, fp, k0, etol, iter, parms); % Get the wavelength if n_iterations < iter % Converged correctly L = * pi / k; else % Did not converge disp('error: Maximum number of iterations exceeded') return end Check your program using the Java-based Wave Calculator at http://www.coastal.udel.edu/faculty/rad/wavetheory.html 3
(NOTE: There is some indication that the wave calculator at the link above might not work due to a reliance on an obsolete version of Java. In that case, recourse can be made to using the wave tables here: https://ceprofs.civil.tamu.edu/jkaihatu/teaching/ocen671/wavenum ber_tables.pdf An example is included for your use.). Irregular Waves In most sea states, several waves of different period are present. For instance, at ocean beaches, there is usually a long-period large-scale wave called ocean swell along with various other shorter-wavelength waves mostly associated with boat wakes and local wind generated waves. Wave fields with multiple frequencies and directions are called irregular waves. For this section of the assignment, you will analyze data from a laboratory experiment to plot the wavelength of each wave in a period of record. 1. Download the data from the class website. The data file contains a single column of numbers, giving the wave elevation (height above still water) in cm recorded every 0.04 s. The water depth for this experiment was h = 0.34 m.. Write the remaining parts of the programming assignment in the m-file already started (LastName134.m); it should continue where the test given above leaves off. Load the data into Matlab and convert from cm to m. 3. Neglect the first 95 points. These data were collected as the wave tank filled with waves and do not represent the statistically stationary conditions. 4. Use the zero-upcrossing method to identify each wave in the remaining time series. This method assumes that the wave period is the time between moments when the water level goes from a negative to a positive value, thereby crossing zero on the way up. You should use a FOR loop to identify all of the upcrossings and identify the period for each wave. 5. Use the linear dispersion relation and your Newton-Raphson code to calculate the wave length for each wave in the period of record. 6. Use MATLAB function max and min to determine the crest and trough and calculate the wave height for each wave in the period of record. 7. Create a plot of wavelength versus the integer number of the wave in the data set (wave 1,, 3, 4, etc.). 8. Sort the wave heights you obtained in step 6 using MATLAB function sort. Create a plot of the wave height versus the integer number of the wave. Calculate the significant wave height (H 1/3 ), which is defined as the average height of the highest one-third of the waves. 4
3. Memorandum The memorandum should include a brief description of your program, followed by test data verifying that the solution to the linear dispersion relation is working correctly and the plots of wave length versus integer number of the wave and wave height versus integer number of the wave. Comment on the trends in the plots (e.g., how would you describe this wave field?). The complete program listing, with all user-defined functions, should be included in an Appendix. 5