Reference no: EM132830464
Question 1. Short answers (you should submit your answers in a text file in the same folder as your python files.)
a. Concerning numpy:
i. How can I create a numpyarray that is a 6×6 identity matrix?
ii. What does numpy.linspace(10, 20, 30) do?
iii. Write a single line of code to fill a 10×10 numpy array with normally distributed random numbers from N(0,1)
b. Concerning fsolve:
i. Write the line of Python code to import fsolve.
ii. In the Python code def Find_FlowRates(Q, *args): what does *argsmean?
iii. Write a line of Python code to use fsolvewith the callback function defined in ii. and the arguments density, roughness, viscosity, roughness, seg_names, seg_lengths, seg_diamspassed as arguments.
iv. What should be returned from the function in ii.?
v. What should be the result of fsolve from iii.?
c. Concerning odeint:Given the python code x=odeint(ode_system, ic, t, myargs)
i. What arguments shouldode_systemhave?
ii. What is returned from the function ode_system?
Question 2. You have analyzed a pipe network with sprinklers in your homework 6 -part1a. Modify your program,appropriately, to analyze the pipe network below and output a nicely formatted report for the: i) flow rate and direction in each pipe, ii) the head loss in each pipe (in in of water), and iii) the pressure at each node in psi with the knowledge that the node h pressure is 80 psi.
Notes: The 12" and 16" pipes are cast iron (roughness = 0.00085 ft) while the 18" and 24" pipes are concrete (roughness = 0.003 ft). Flow is fully developed and turbulent and minor losses may be ignored. cfs stands for cubic feet per second. Room temperature water is the fluid (μ=20.50 lb⋅s/ft2, γ=62.3 lb/ft3). Name your file EX2_2.py.
Question 3. Usepyplot to graph your Rankine cycle from homework 6 part 2 on a T-S diagram. The graphs should look like the following graphs (including title, axes labels, and summary notation):
Notes: i) You should modify your rankine class to include a value for isentropic turbine efficiency (ηturbine¬) and include ηturbine in your calculation for cycle efficiency. ii) You should include the plotting function as a method of the rankine class. And, iii) You should modify your test_rankine.pyand call it EX2_3.pywith the following main function:
def main():
'''
A test program for rankine power cycles.
R1 is a rankine cycle object that is instantiated for turbine inlet of saturated vapor.
R2 is a rankine cycle object that is instantiated for turbine inlet of superheated vapor.
:return: none
'''
R1=rankine(p_high=8000, p_low=8, name='Rankine Cycle - Saturated at Turbine Inlet')
R1.calc_efficiency()
R1.plot_cycle_TS()
R2=rankine(p_high=8000, p_low=8, t_high=500, name='Rankine Cycle - Superheated at Turbine Inlet')
R2.calc_efficiency()
R2.plot_cycle_TS()
Question 4. Imagine you are trying to fill a leaky bucket with water.
i) If the inlet flowrate is 20 gpm, will the bucket runneth over or come to some steady level? Prove your answer by plotting the water level as a function of time.
ii) At what inlet flow rate would we just start to overflow the bucket?
Important factors:
a. Water flows out of the hole driven by pressure head according to:
b. The hole diameter is 0.25"
c. The bucket is 1.3 ft in diameter and 2.3 ft tall.
d. Water density is 1000kg/m3