[SOLVED] C algorithm math matlab statistic MAEV 511 Numerical Methods

$25

File Name: C_algorithm_math_matlab_statistic_MAEV_511_Numerical_Methods.zip
File Size: 565.2 KB

5/5 - (1 vote)

MAEV 511 Numerical Methods
Midterm Exam
Vorticity field, Newtons method, and zero-crossing techniques
Date distributed: May 1, 2019
Date due: June 1, 2018 at 5:00 p.m.
Compile your work as a single pdf file to the instructors email account. MATLAB codes as .m files also need to send to the instructor. Please submit the files before the due date shown above.
1. Bubble sort, insertion sort and MATLAB built-in function sort
Sort an array of 1000 numbers, ranging from 0.1 to 1000, generated by the MATLAB built-in function rand ((1000 0.1).*rand(1000,1) + 0.1), and sort them in the descending order by writing codes for the bubble and insertion sorting algorithms, and the MATLAB built-in function sort.
2. Wave train analysis
Visual observation of the sea surface and measurements indicate that the sea surface is composed of waves of varying heights and periods moving in different directions. It can be defined as a combination of many wave components. These individual components were generated by the wind in different regions of the ocean and have propagated to the point of observation. If a recorder were to measure waves at a fixed location on the ocean, a non-repeating wave profile would be seen and the wave surface record would be rather irregular and random. Different approaches and methods have been developed during the years for describing and analyzing natural sea states. Wave-by-wave (wave train) analysis is one of the two mostly used methods (the other one is the spectral method). In this method, undulations in the time-history of the surface at a point are identified as individual waves; the height and period of each wave will be measured. Once this is done, statistical characteristics of the record can be estimated, and the statistics of the record are compiled.
In the time-domain analysis of irregular or random seas, wave height and period, wavelength, wave crest, and trough have to be carefully defined for the analysis to be performed. The adopted engineering procedure is the zero-crossing technique, where a wave is defined when the surface elevation crosses the zero-line or the mean water level (MWL) upward (zero-upcrossing) or downward
1

(zero-downcrossing), and continues until the next crossing point. The entire wave record is then decomposed into numerous individual wave events, where each wave height and period are then noted for every zero-upcrossing or zero-downcrossing, depending on the method selected. It is customary to define wave height as the vertical distance between the highest and lowest points, while wave period is defined as the horizontal distance between two successive zero-crossing points. All local maxima and minima not crossing the zero-line have to be discarded. Using these definitions of wave parameters for an irregular sea state, it is seen that, unlike the regular (monochromatic) sinusoidal waves, the periods and heights of irregular waves are not constant with time, changing from wave to wave.
Wave statistics is to produce some statistical estimates from the analyzed time-series data to describe an irregular sea state in a simple parametric form. For parameterization, there are many parameters used to define statistics of irregular sea states. Two of the most important parameters necessary for adequately quantifying a given sea state are characteristic height H and characteristic period T. Characteristic wave height H for an irregular sea state may be defined in several ways. These include the mean height H which is the mean of all the measured wave heights in the entire record analyzed, the maximum wave height Hmax which is the largest wave height in the record, the root- mean-square height Hrms which is the root-mean-square of all the measured wave heights, and the mean height of the highest 1/n of all waves H1/n where n = 10, 11, 12, 13,, 99, 100 are common values. From one wave record measured at a point, wave heights are ordered from the largest to the smallest and each one is assigned a number from 1 to n. H1/10 is the mean height of the highest one-tenth waves, while the significant wave height H1/3 or Hs is the average of the first (highest) n/3 waves. The characteristic period T could be the mean zero-crossing period Tz obtained from the total length of wave record length Tr by
Tz = Tr/Nz (1)
where Nz is the number of zero-upcrossings (or zero-downcrossings) in the wave record.
The attached file (WaveData.dat) is the water elevation recordings at water depth h = 0.2 m. The data sampling rate is 4 Hz (which means the elevation was recording every 0.25 s). Please write a
MATLAB program to include the following steps for the irregular wave data.
1. Find the mean water level (MWL) as the average of the water elevation measurements.
2. Each elevation measurement needs to subtract the MWL value to have a zero average.
2

3. Write a MATLAB program with zero-downcrossing algorithm to find the zero-crossing points. The zero-crossing points need to linearly interpolate from the time stamps of the data. The time interval between two successive zero-crossing points denote the wave period Ti of each individual wave. The difference between the maximum and minimum water elevation within each individual wave denotes the wave height Hi.
4. Sort all the wave heights His from the largest to the smallest and each one is assigned a number from 1. Calculate all the characteristic wave heights, including H, Hmax, Hrms, H1/10 and H1/3 (Hs), and characteristic wave period Tz.
3. Solving dispersion relation (Newton-Raphson method)
The speed at which a wave form propagates is termed the phase velocity or wave celerity C. Since the distance traveled by a wave during one wave period T is equal to one wavelength L, the wave celerity C then can be related to the wave period and length by
C=L (2) T
An expression relating wave celerity C to wavelength L and water depth d is given by
C= gLtanh2d (3)
2 L
and termed the linear dispersion relation since it indicates that waves with different periods travel at different speeds; At same water depth, the longer period waves travel faster than those waves with shorter period. Eq. (3) can be rewritten as
C = gT tanh2d = g tanh(kd) (4) 2 L

where k = 2/L and = 2/T are the wave number and wave angular frequency, respectively. Eq. (4) can be further rewritten to obtain wavelength L under known water depth d and wave period T
L=gT2 tanh2d (5) 2 L
Solving Eq. (5) analytically involves some difficulty since the unknown L appears on both sides of the equation. Instead, Newton-Raphson method can be used to solve the equation numerically, with a good initial guess for the wavelength L by Eckart (1952)
3

L=gT2 tanh42 d (6) 2 T2g
A wave with a period T = 10 seconds is propagated shoreward over a uniformly sloping shelf from a depth d = 200 m to a depth d = 3 m. Write a MATLAB program to solve the linear dispersion equation, and calculate the wave lengths L and wave celerity C at these two depths. Plot the variation of L and C against d from 200 to 3 m.
4. Solving simultaneous equations by LU factorization and inverse matrix
Find the solution of the following linear system by computing the LU factorization, and compare the result with the solution obtained directly by using the MATLAB built-in function inv.
31 22 +43 +64 +55 =60
51 +32 43 +94 +x5 =40
41 82 +x3 +64 +25 =25 (7) 31 x2 +53 34 +45 =24
21 42 +53 +84 +x5 =46
5. Velocity and vorticity fields
Vorticity is a vector field that is twice the angular velocity of a fluid particle. A concentration of codirectional or nearly codirectional vorticity is called a vortex. Fluid motion leading to circular or nearly circular streamlines is called vortex motion. Mathematically, it is defined as the curl of the velocity field,
=V (8) and is hence a measure of local rotation of the fluid. This definition makes it a vector quantity. In two
dimensions (x, y), the only non-zero component of the vorticity
z = v/x u/y (9)
where u and v are the velocity components in the x and y directions, respectively. The vorticity can be directly obtained by numerical differentiation of the velocity field. To obtain a reliable estimate it is important that the velocity measurement data are accurate, do not contain spurious data, and that the spatial resolution is adequate to perform a differentiation of the data. For velocity data that are obtained at discrete locations the vorticity z can be estimated by means of the circulation, i.e.,
4

4xy
z =lim1V dl (10) A0 A C
where C is the contour that encloses an area A. The discrete representation of Eq. (9) is: z (i, j) 1 [
yv(i+1,j)+ 1y[v(i+1,j1)+v(i+1,j+1)] 21
x u(i, j + 1) 2 x[u(i 1, j + 1) + u(i + 1, j + 1)]
yv(i1,j) 1y[v(i1,j1)+v(i1,j+1)] 21
+xu(i,j1)+ 2x[u(i1,j1)+u(i+1,j1)] ]
(11)
The attached file (Velocity.dat) is a velocity field from PIV measurements. Please use MATLAB to plot the velocity field, and write a program to calculate and plot the vorticity field of the corresponding velocity field.
5

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] C algorithm math matlab statistic MAEV 511 Numerical Methods
$25