Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Guidelines: Solve this question in Python. You will have access to much test data however your solution will be tested against additional trials. Your code

Guidelines:

Solve this question in Python. You will have access to much test data however your solution will be tested against additional trials. Your code will need to pass all tests to achieve full marks.

Problem description:

Water towers are among the simplest yet ingenious methods to distribute water having been in use in some form since ancient times. More than simply calculating capacity or flow rate however, we can model how a tank can be filled and emptied. We will model a scaled down version of this problem. In our model, our water tank will have a single water flow inward, and a single flow outward and be perfectly cylindrical.

image text in transcribed

where:

fin the flow-rate in (liters per second)

fout the flow rate out ( liters per second )

r the radius of the tower (meters)

H The height of the tower (meters)

h The height of the current water-level (meters)

You are tasked to write a function called trackFlow which when given some initial conditions iteratively simulates the contents of the tower. By iteratively we mean you will update the volume of water in the tank repeatedly over numerous time-intervals. More specifically, the tank will be filled up until some time (topen) at which point the outward flow is activated (instantly). Your function will accept the following arguments (in the following order):

fin The flow-rate in ( liters per second )

fout The flow rate out ( liters per second )

r The radius of the tower (meters)

H The height of the tower (meters)

h The height of the initial water-level (meters)

tmax The maximum time allowed to simulate the system(seconds)

topen The time when the outwards flow opens (seconds)

Your calculations should continue until either t = tmax, h > H or h

The time-step = 0.1 sec

The density of water = 1000 L/m3

The inward flow is open at t = 0.0 sec

Your function should return the following

A list of volume values (in liters)

A list of water-height values (in meters)

A list of time-stamps at which the values were calculated (in seconds)

Note: Do not print the lists in a formatted manner, simply return them at the end of calculations All values are to be rounded to 2 decimal places when they are appended to the result-arrays. See theround() function for more information. Your submission will be tested against a sample solution with numerous test-cases in addition to those presented below. Sample testing data: testFlow(1, 1, 1, 10, 0, 3, 1) #Steady-state after 1s Volumes = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] Heights = [0, 0.03, 0.06, 0.1, 0.13, 0.16, 0.19, 0.22, 0.25, 0.29, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32] Times = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0] testFlow(1, 5, 1, 10, 0, 5, 2) #Decreases until tank is empty Volumes = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.5, 1.1, 0.7, 0.3] Heights = [0, 0.03, 0.06, 0.1, 0.13, 0.16, 0.19, 0.22, 0.25, 0.29, 0.32, 0.35, 0.38, 0.41, 0.45, 0.48, 0.51, 0.54, 0.57, 0.6, 0.48, 0.35, 0.22, 0.1] Times = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3] testFlow(1, 0.5, 1, 10, 0, 3, 1) #Increases after out-flow is open to maximum time Volumes = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, 1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2.0] Heights = [0, 0.03, 0.06, 0.1, 0.13, 0.16, 0.19, 0.22, 0.25, 0.29, 0.32, 0.33, 0.35, 0.37, 0.38, 0.4, 0.41, 0.43, 0.45, 0.46, 0.48, 0.49, 0.51, 0.53, 0.54, 0.56, 0.57, 0.59, 0.6, 0.62, 0.64] Times = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0]

new Vold

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

Step: 3

blur-text-image

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

Database Systems For Advanced Applications 27th International Conference Dasfaa 2022 Virtual Event April 11 14 2022 Proceedings Part 2 Lncs 13246

Authors: Arnab Bhattacharya ,Janice Lee Mong Li ,Divyakant Agrawal ,P. Krishna Reddy ,Mukesh Mohania ,Anirban Mondal ,Vikram Goyal ,Rage Uday Kiran

1st Edition

ISBN: 3031001257, 978-3031001253

More Books

Students also viewed these Databases questions

Question

Calculate the mass of a proton (1.67 10-27 kg) in MeV/c2.

Answered: 1 week ago

Question

8. Do the organizations fringe benefits reflect diversity?

Answered: 1 week ago

Question

7. Do the organizations social activities reflect diversity?

Answered: 1 week ago