Calculating Volume of a Tank (Flow Out/In)

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 comentario

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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre General Applications en Centro de ayuda y File Exchange.

Productos

Versión

R2020b

Etiquetas

Preguntada:

el 9 de Oct. de 2020

Comentada:

el 9 de Oct. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by