subject

Goal: Making and using functions and input files; plot gridded variables; use embedded control structures.

Assignment: You will write an input file, two functions and a main program that interfaces with

each of these.

1) Create an input file with the following data (in meters)
Wave height = 3
Wavelength = 10
Water depth = [1 2 3 4]

2) In coastal engineering, the "wave number" is defined as k = 2p/Lwhere Lis the wave’s wavelength. There is a relationship between the wave number and the wave’s period, T, given by:

(2pi/T)^2 = gk tanh(kh) (1)
Where his the water depth. Create a function called ‘wave_period’ that will compute the wave number for each for each of the depths given in (1). This function should take wavelength, wave height, and water depth as input and give wave period as output.
3) The velocity components below a linear wave are given by the following equations:
u=(H/2)sigma[(cosh k(h+z)/sinh (kh) ] cos(kx-sigma. t) (2)
w=-(H/2)sigma[(sinh k(h+z)/sinh (kh) ] sinh(kx-sigma. t) (3)
where sigma= 2p/T, u is the x-velocity component, and w is the y-velocity component. These equations define velocity components as a function of time (t) and space (x). By holding one or the other constant, velocities can be computed.
Create a function to compute the x-velocity and y-velocity components below a wave as a function of xby holding t= 0 in the above equations. Allow the user to specify how many points they would like to use in both the x and z directions. Create a 2x2 subplot of the results using 20 points in the x-direction and 10 points in the z-direction. Please note that zin these equations starts at 0 and goes to –h.
Hint: you may want to use an embedded "for" loop (or several). Another hint: type "help quiver" to see what you should be going after.

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 18:00, adrianaglass12
Which virus-infecting components are email messages prone to carry? one of the problems associated with the use of email communication is that email messages are prone to carry virus-infecting .
Answers: 3
image
Computers and Technology, 22.06.2019 07:00, Jasten
For all machines-not just hammers- the user applies force force to the machine to the machine over a certain distance. a. input b. output c. duo d. none of the above
Answers: 1
image
Computers and Technology, 22.06.2019 16:10, Olaf2018
Drag each label to the correct location on the imagelist the do’s and don’ts of safeguarding your password. keep yourself loggedin when you leave your computer. don’t write your password down and leave it whereothers can find it. share your password with your friends. each time you visit a website, retain the cookies on your computer. use a long password with mixed characters.
Answers: 1
image
Computers and Technology, 22.06.2019 19:20, bob4059
1)consider the following code snippet: #ifndef book_h#define book_hconst double max_cost = 1000.0; class book{public: book(); book(double new_cost); void set_cost(double new_cost); double get_cost() const; private: double cost; }; double calculate_terms(book bk); #endifwhich of the following is correct? a)the header file is correct as given. b)the definition of max_cost should be removed since header files should not contain constants. c)the definition of book should be removed since header files should not contain class definitions. d)the body of the calculate_terms function should be added to the header file.
Answers: 1
You know the right answer?
Goal: Making and using functions and input files; plot gridded variables; use embedded control struc...

Questions in other subjects:

Konu
Mathematics, 07.12.2020 04:30