Question: 2. In your script file, use the function that you defined in problem 1 to determine the Reynolds number and flow type for the following



2. In your script file, use the function that you defined in problem 1 to determine the Reynolds number and flow type for the following sets of parameters: Test Case Density, Length, L Velocity, V Viscosity, u Application 5: Branching and Looping ENGR 1221 Designed to test skills: conditional statements, if statements, and switch statements, for loops For this assignment, submit ALL of the following: function files, script file, command window output, graphic files (.jpg, png, .pdf, etc., NOT.fig) for the 3 figure windows in their final state. 1.2 0.05 3.5x10 0.01 100 1.7x10-5 1.29 0.01 - 2 3x10-5 For each test case, print a message to the command window in the format: For test case n, the Reynolds number is x, and the flow type is z. where X is the calculated value, and Z is "laminar", "turbulent", or "transition". For full credit, you must use a loop to iterate over the rows of the matrix, and store the results in a numerical array, Re, and a string array, flow_type. Note: If you wrote the function as specified, with scalar inputs & outputs, you will need a loop in your main script to call the function on each test case. If you used the alternative approach of designing the function with array inputs & outputs, you will only have to call the function once. 1. Write a function to calculate the Reynolds number in fluid flow and determine whether the flow is laminar, turbulent, or in the transition between the two. The Reynolds number is defined as: Res PVL where p = density of the fluid; V = velocity; L = length scale of the problem (e.g. diameter of a pipe or chord width of an airfoil); u = dynamic viscosity For purposes of this problem, the Reynolds number is used to classify flow (roughly) as follows: Reynolds Number Type of Flow Re 10,000 Otherwise Transition The function specification is as follows: Input arguments (all SCALARS) Output arguments density, p (kg/m) Reynolds number, Re (dimensionless) - SCALAR velocity, V(m/s) Flow type, a string ("Laminar", "Turbulent", or length, L (m) "Transition") viscosity, u (kg/m-5) NOTE: the flow type should be a string ("Laminar") not a char array ('Laminar') 24 - Re = []; flow_type =string([]); for i=1:length (flowData (:,1)) Re (i)=Reynolds Number (flowData (i,1),flowData (i,2),flowData (i,3), flowData (i,4)); if (Re (i) 10000) flow type (i)="Turbulent"; %Flow is Turbulent for Re greater than 10,000 else flow type (i)="Transition"; Flow is Transition for 1,000
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
