MATHEMATICA FEATURED EXAMPLE

Hydraulic Systems

Model the change in height of the water in three tanks, with the third tank leaking.

    
Click for copyable input
The pressures at the bottoms of the tanks 1, 2, and 3 are represented as , , and , respectively. The pipe from tank 1 branches off to tanks 2 and 3. The pressure at the pipe branch is given as . Flow rates depend on pressure differences and geometry:
In[9]:=
Click for copyable input
All the fluid leaving tank 1 should enter tank 2 and tank 3. This is represented as a constraint. Also, the height of the fluid in the tank is related to the pressure in the tank by Toricelli's law:
In[12]:=
Click for copyable input
The rate at which the fluid leaves or enters the tank (i.e. flow rate) is directly proportional to the rate of change of the height of the fluid in the tank. This relation comes through mass conservation of incompressible fluids:
In[14]:=
Click for copyable input
Specify the dimensions and parameters associated with the system. The cross sectional areas of tanks 1, 2, and 3 are specified by , , and , respectively. The density and viscosity of the fluid are specified as and , respectively:
In[15]:=
Click for copyable input
Specify the initial heights of the fluid in each tank:
In[16]:=
Click for copyable input
Solve and visualize the result:
In[17]:=
Click for copyable input
In[18]:=
Click for copyable input
Out[18]=
New to Mathematica? Find your learning path »
Have a question? Ask support »