Calculating Volume of a Tank (Flow Out/In)

6 views (last 30 days)
The question I'm attempting to answer is
"Consider a cylindrical water tank (D=7 m, H=10 m) with a constant inflow of 10 m3 per minute. At the same time (t), effluent is proportional to the water volume in the tank: Qout (m3/min) = V (m3) * C where C is an empirical coefficient of 0.1 1/min, and initial water volume in the tank is 200 m3.
Assume the water density is constant, find the relationship between the water height in the tank (h in meters) and time (t in min) and graphically express h as function of t, h(t) using both analytical and numerical methods. The Matlab program should give a warning signal when the water height drops to 3 m and the corresponding time point, such as “Warning—water level drops to 3 meters at xx.xx minutes”.
Plot h as function of t of both of your analytical solution and numerical solution in the same graph for comparison to see how your numerical solution agrees with the true analytical solution."
I have typed out all my parameters and formatting but I'm hopelessly lost on how to create the function/loop. Could I be guided in the right direction?
clear all
close all
% Question 1
% All parameter values
d = 7;
r = d / 2;
Initial_Height = 10;
h = 10;
c = .1;
A_tank= (2 * pi * r * Initial_Height) + (2 * pi * (r^2));
V = 200; %initial volume (m^3)
Qin = 10 * 1; %inflow (m^3/min)
Qout = V * c * 1; %outflow (m^3/min)
dt = 1; %time step
t = 0; %initial time
%Initialize Loop Variables
while h > 3
end
plot(t,V)
  1 Comment
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam on 9 Oct 2020
This is a differential equation:
A=2*pi*r;
dhdt = Qin/A-c*h;
Then you can solve it by some numerical methods to find h for each t

Sign in to comment.

Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!