Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve using MatLab Problem set up and equations Fluid Dynamics is an essential part of any engineers undergraduate coursework While some of the key equations

Solve using MatLab

image text in transcribed

image text in transcribed

image text in transcribed

Problem set up and equations Fluid Dynamics is an essential part of any engineers undergraduate coursework While some of the key equations can be solved analytically, ofen we need to use numerical methods and computers to produce a solution. One of the famous and most useful equations in fluid dynamics is Bemoulirs Equation, which relates propersies between two points on a streamine in a fowing fuid (subject to some key assumptions that are beyond the scope of this problem) Bernoul's equation can be written as Where: The subscripts 1 and 2 correspond to two dflerent locations in the flow on the same - P is pressure in IPa . p is the fluid density in [kgm3 . V is the fluid velocity in [m/s] . giste acceleration of gravity in[ms 2 h is the height in For this assignment, we will be modeling the draining of a cylindrical tank shown in the figure below P atm D d v P atm The height of the water in the tank is at any time is h), and the initial height is hO at time t-0. The diameter throughout the tank is D, and the diameter of the exit hole is d both in Im The pressure at the top surface of the water, and at the exit of the tank is atmospheric pressure, which you can take as 0 Pa The velocity of the water at the tank exit is V, and you can assume thatl the velocity at the top surface of the tank is 0 ms since D >> d Assume that at the tank exit, the elevation h is o m. Before coding, you need to start solving the equation (dont worry, I help you). First, use Bernoull's equation to solve for V using the assumptions given above. Vwill be a function of g and h and should have units of Im/s Note that V is not constant and depends onhe nstantaneous height of the water. In a comment near the top of your function (more below) write a few lines descibing how you solved for V and the final answer It turns out you need Giflerential equations to solve he rest of he problem, so The curent height of the water as a function of time is given by do for you Whene k is a constant given by Note that h is a function of time, and thus V is as well. The volume flow rate of the water leaving the tank is given by 0-A Where O is the flow rate in [m-3/s and A is the exit area of the botiom hole in |m 2). For this problem, assume the liquid is water with p 1000 jkg/m*3. Using these equations and a Matiab function and seript you will model the emptying of a cylindrical container as you track some of the characteristics such as fuid depth, velocity, and the sowrate This assg ment wd esaro both function a The function wil be named w4-func-younnnals.m. (egfor me it would be hw4 fune MAL m) with the following inputs and outputs Inputs (all scalars) e Initial height, h Outer diameter D . inner diameter, d * Tine step, dt (Optional bonus, see #5 below) Outputs (all vectors) Flow rate Q -Fluid height, h - Time, t Next you should 1. Define some constant parameters such as g. p, etc 2. Note that w do not know how long it takes to drain te tank for any set of nnal conditions, and thus we do not know the size of the output vectors ahead ofsime. But, you can specity a time step for the simulation of di 1 s. The time step is how often we will solve he equations and update the variables in the problem. So time will start at t-O and then we will solve the equations at to 1s2s, etc Using a while loop tr the hid height, fow rato and exit velooty as the cortaner empbies. At each tme step 3. a. Uniate the time vector to current time b. Use the cument time to caloulate the current height c Use the curment height to solve for the exit velocity d. Use the exit velocity to solve for the flow rate. e. Use the ow rate to calculate how much water drained from the tank in the cument time step, and then use the area of the tank (not the exit hole) to calculate how much the height of the water changed You can call this vector d While this is not an output of the function, we can use it as a sanity check for the calculations and code. Put a breakpoint at the end of the while loop and compare dh to the height vector Are they consistent Le. does the change in height between any two time steps comespond to the dh values? Use a comment and wrne a few sentences discussing the comparison. f. Hint-define a "counting variable" that is an integer that starts at 1 and increases by 1 each time through the loop G The while loop shouid run until the tank is empty. You should define a condition for the loop to reflect this. Note that at a certain critical time, the tank will be completely empty. You can solve for this time algebraically using the h) equation above. This is likely to occur between two time steps, not exactly at one time , calculations and code. Put a breakpoint at the end of the while loop and compare dh to the height vector. Are they consistent iLe. does the change in height between any two time steps corespond to the dh values? Use a comment and wrne a few sentences discussing the comparison. f. Hint-define a "counting variable" that is an integer that starts at 1 and increases by 1 each time through the loop G The while loop should run until the tank is empty You should define a condition for the loop to reflect this. Note that at a certain critical time, the tank will be completely empty. You can solve for this time algebraically using the h) equation above. This is lakely to ocour between two time steps, not exactly at one time step. Your condition should take this into account, which will actualy cause the oop to break with a little bit of water left (hs 0). For the time step after thisset the ow rate, height, and velocity to 0 Each one of your outputs should be a vector of equal size. . Bonus instead of speoifying dt as 1 seoond in the function, make it an input to your function. Your function should run regardless of the value of dt and not assume t is 1 second. Add a comment to thhe top of the function indicating that you have made dt an nput Your script 1. In your script, called hw4 yourinitials m you will call your function twice for dferent sets of inputs. The values are in the table below 2. After your script has run the functions for each scenario, plot the following on one figure using the subplot command (4x1) for each scenario: Height vesus time, Flow Rate versus timeVelocity versus Height, and Height versus Flow Rate. You should only have 2 total figures. Be sure to include proper axis labels and units 3 Once plots are completed, use a comment in the script to disouss the relationship between the different values tracked. Ane they linear? Proportional? Enc Bonus- run your function again for di values larger and smaller than 1s Replot the oputs ard use acomment todiscuss the differences in the outputsvector es, ists. ec. Do you think there is a minimum ot that is needed for accurate results? Scenario D in) d i Problem set up and equations Fluid Dynamics is an essential part of any engineers undergraduate coursework While some of the key equations can be solved analytically, ofen we need to use numerical methods and computers to produce a solution. One of the famous and most useful equations in fluid dynamics is Bemoulirs Equation, which relates propersies between two points on a streamine in a fowing fuid (subject to some key assumptions that are beyond the scope of this problem) Bernoul's equation can be written as Where: The subscripts 1 and 2 correspond to two dflerent locations in the flow on the same - P is pressure in IPa . p is the fluid density in [kgm3 . V is the fluid velocity in [m/s] . giste acceleration of gravity in[ms 2 h is the height in For this assignment, we will be modeling the draining of a cylindrical tank shown in the figure below P atm D d v P atm The height of the water in the tank is at any time is h), and the initial height is hO at time t-0. The diameter throughout the tank is D, and the diameter of the exit hole is d both in Im The pressure at the top surface of the water, and at the exit of the tank is atmospheric pressure, which you can take as 0 Pa The velocity of the water at the tank exit is V, and you can assume thatl the velocity at the top surface of the tank is 0 ms since D >> d Assume that at the tank exit, the elevation h is o m. Before coding, you need to start solving the equation (dont worry, I help you). First, use Bernoull's equation to solve for V using the assumptions given above. Vwill be a function of g and h and should have units of Im/s Note that V is not constant and depends onhe nstantaneous height of the water. In a comment near the top of your function (more below) write a few lines descibing how you solved for V and the final answer It turns out you need Giflerential equations to solve he rest of he problem, so The curent height of the water as a function of time is given by do for you Whene k is a constant given by Note that h is a function of time, and thus V is as well. The volume flow rate of the water leaving the tank is given by 0-A Where O is the flow rate in [m-3/s and A is the exit area of the botiom hole in |m 2). For this problem, assume the liquid is water with p 1000 jkg/m*3. Using these equations and a Matiab function and seript you will model the emptying of a cylindrical container as you track some of the characteristics such as fuid depth, velocity, and the sowrate This assg ment wd esaro both function a The function wil be named w4-func-younnnals.m. (egfor me it would be hw4 fune MAL m) with the following inputs and outputs Inputs (all scalars) e Initial height, h Outer diameter D . inner diameter, d * Tine step, dt (Optional bonus, see #5 below) Outputs (all vectors) Flow rate Q -Fluid height, h - Time, t Next you should 1. Define some constant parameters such as g. p, etc 2. Note that w do not know how long it takes to drain te tank for any set of nnal conditions, and thus we do not know the size of the output vectors ahead ofsime. But, you can specity a time step for the simulation of di 1 s. The time step is how often we will solve he equations and update the variables in the problem. So time will start at t-O and then we will solve the equations at to 1s2s, etc Using a while loop tr the hid height, fow rato and exit velooty as the cortaner empbies. At each tme step 3. a. Uniate the time vector to current time b. Use the cument time to caloulate the current height c Use the curment height to solve for the exit velocity d. Use the exit velocity to solve for the flow rate. e. Use the ow rate to calculate how much water drained from the tank in the cument time step, and then use the area of the tank (not the exit hole) to calculate how much the height of the water changed You can call this vector d While this is not an output of the function, we can use it as a sanity check for the calculations and code. Put a breakpoint at the end of the while loop and compare dh to the height vector Are they consistent Le. does the change in height between any two time steps comespond to the dh values? Use a comment and wrne a few sentences discussing the comparison. f. Hint-define a "counting variable" that is an integer that starts at 1 and increases by 1 each time through the loop G The while loop shouid run until the tank is empty. You should define a condition for the loop to reflect this. Note that at a certain critical time, the tank will be completely empty. You can solve for this time algebraically using the h) equation above. This is likely to occur between two time steps, not exactly at one time , calculations and code. Put a breakpoint at the end of the while loop and compare dh to the height vector. Are they consistent iLe. does the change in height between any two time steps corespond to the dh values? Use a comment and wrne a few sentences discussing the comparison. f. Hint-define a "counting variable" that is an integer that starts at 1 and increases by 1 each time through the loop G The while loop should run until the tank is empty You should define a condition for the loop to reflect this. Note that at a certain critical time, the tank will be completely empty. You can solve for this time algebraically using the h) equation above. This is lakely to ocour between two time steps, not exactly at one time step. Your condition should take this into account, which will actualy cause the oop to break with a little bit of water left (hs 0). For the time step after thisset the ow rate, height, and velocity to 0 Each one of your outputs should be a vector of equal size. . Bonus instead of speoifying dt as 1 seoond in the function, make it an input to your function. Your function should run regardless of the value of dt and not assume t is 1 second. Add a comment to thhe top of the function indicating that you have made dt an nput Your script 1. In your script, called hw4 yourinitials m you will call your function twice for dferent sets of inputs. The values are in the table below 2. After your script has run the functions for each scenario, plot the following on one figure using the subplot command (4x1) for each scenario: Height vesus time, Flow Rate versus timeVelocity versus Height, and Height versus Flow Rate. You should only have 2 total figures. Be sure to include proper axis labels and units 3 Once plots are completed, use a comment in the script to disouss the relationship between the different values tracked. Ane they linear? Proportional? Enc Bonus- run your function again for di values larger and smaller than 1s Replot the oputs ard use acomment todiscuss the differences in the outputsvector es, ists. ec. Do you think there is a minimum ot that is needed for accurate results? Scenario D in) d

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

What is permanent deferral?

Answered: 1 week ago