Question: 0 . 2 1 - D Shallow - Water Model Figure 1 : Configuration of the one - dimensional shallow - water model. Undisturbed water

0.21-D Shallow-Water Model
Figure 1: Configuration of the one-dimensional shallow-water model. Undisturbed water depth is
h0.
Governing equations for a 1-D shallow-water model (see Figure 1) can be written as:
u
t =g \eta
x (1)
\eta
t =(u h)
x (2)
where u is speed in the x-direction, t is time, g is acceleration due to gravity, \eta is sea-level elevation,
and h is the total water depth.
Analytical Solution
The water depth h can be approximated as constant for a flat seafloor together with wave amplitudes
small compared with total water depth. In this case, the wave solution of the above equation
is:
\eta (t, x)=\eta 0 sin(2\pi x/\lambda 2\pi t/T )(3)
u(t, x)= u0 sin(2\pi x/\lambda 2\pi t/T )(4)
Page 1 of 4
Final Take-Home Portion, Numerical Methods (CWR3561), Spring 2024
Instructor: Dr. C. i gdem Akan
Due: 1 May by 11:59 pm
where \eta 0 is wave amplitude, \lambda is wavelength, T is wave period, and the magnitude of u is given
by:
u0=\eta 0
pg/h (5)
Horizontal flow under a long surface wave is depth-independent and so are horizontal gradients of
u. The solution for vertical speed of a fluid parcel as a function of depth can be written as:
w(t, x, z)=2\pi u0 z/\lambda cos(2\pi x/\lambda 2\pi t/T )(6)
where z is (positive) distance from seafloor.
0.3 MATLAB Coding
You will create an animation of analytical wave solution using the input values below:
Wave amplitude (\eta 0)=1 m
Wavelength (\lambda )=500 m
Water depth (h)=20 m
Wave speed (c)=gh
Wave period (T )=\lambda /c
In order to generate the animation, you will need to track individual fluid parcels using the equations
below:
xpnew = xpold + dt \times u (7)
zpnew = zpold + dt \times w (8)
You will track the particles at zp =1.0 m, zp =6.0 m, zp =11.0 m and zp =16.0 m
Suggested Algorithm
Enter the input variables
Limits of x-axis: [0,2\lambda ]. Use 21 points.
Number of time steps =100. Total animation time =2\times T
Calculate dt
Initialize particle positions
You only need one loop: loop over number of time steps.
Calculate \eta
Calculate u
Calculate w
Calculate the new fluid parcel locations
Page 2 of 4
Final Take-Home Portion, Numerical Methods (CWR3561), Spring 2024
Instructor: Dr. C. i gdem Akan
Due: 1 May by 11:59 pm
Plot all the particles
* Show the water surface with a thick solid line
* Show rest of the particles with a circle
* Label the x- and y-axis properly
* Use sprintf command to show the time at each time step
Save the frame
Create the animated GIF
Animation with MATLAB
There are several ways to create animated gif files with MATLAB. For example, examine the code
provided in class. You can adapt it and use it for your code.
0.4 Hand Calculations
Calculate the following for x =50 m, z =16 m and x =300 m, z =6 m at t =10 s:
Wave speed (c)=gh
Wave period (T )=\lambda /c
\eta
u
w
Midterm Take Home Rubric
Title Page: This should consist of a blank page with your name, UNF ID, course title, home-
work assignment number and title. 5 pts
Summary/Observations: This should be a brief summary of the assignment. What did the
assignment ask for? What did you learn? Did you discover anything easy/difficult with the
assignment? It doesnt have to be long, just clear and concise. Do not write only one
sentence. 10 pts
MATLAB Code(s): Copy and paste your code(s) into the Word document. 40 pts
Output: Animation file in .gif format 20 pts
Hand Calculations: See the hand calculations section. 25 pts
Extra Credit
Recall the Ready, Aim, Fire GUI we used in class. Make improvements to the GUI interface and
the code by applying one of the options below:
Page 3 of 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!