Bathtub Dynamics Simulation

This simulation has three models. Model1 shows constant inflow and outflow into a bathtub. Model 2 shows constant inflow and nonlinear outflow based on the quantity of water in the bathtub. Model 3 shows constant inflow and nonlinear outflow based on the quantity of water in the bathtub. However, Model 3 uses Torricelli's law to calculate the flow rate based on physical principles. It's an important principle in fluid dynamics and is closely related to Bernoulli's principle. 

Torricelli's law states that the speed (velocity) of efflux of a fluid through a hole under the force of gravity is proportional to the square root of the vertical distance (height) between the fluid surface and the center of the hole. 

The formula is given by efflux velocity = 2*g*ℎ​, 

g is the acceleration due to gravity (approximately 9.81 m/s² on Earth). 

ℎ is the height of the fluid column above the hole. 


The idea is that the fluid's potential energy due to its height is converted into kinetic energy as it falls. The higher the fluid, the greater its potential energy and thus the greater the speed at which it exits the hole. This principle is used in various applications, such as determining the flow rate of liquids from tanks, in hydrodynamics studies, and even in everyday situations like draining a bathtub. The law assumes an ideal fluid (incompressible and non-viscous) and neglects factors like air resistance and the viscosity of the fluid. It also assumes that the size of the hole is small compared to the depth of the fluid. 

The flow rate (the volume of fluid flowing per unit time) can be calculated by multiplying the cross-sectional area of the hole (A) by the velocity of the fluid (v), leading to the formula Q=A*v, where Q is the flow rate.