Engee documentation
Notebook

Determining the liquid pressure at different tank heights

In this example, we will demonstrate one property of a thermally conductive fluid that can cause the temperature to vary slightly at different heights when it is in the tank.

Model description

Create a system consisting of a tank, a pump that pumps liquid into it from a reservoir and several sensors.

image.png

In a real fluid described by the equation of state, the temperature at different heights will be slightly different due to changes in pressure in the fluid column (hydrostatic effect) and thermodynamic properties of the medium. Let us consider this question strictly.

For a fluid obeying the equation of state, the temperature and pressure distribution is determined by the hydrostatic law $\frac{dP}{dh} = \rho(h) \cdot g$, the equations of state $\rho = \rho(P,T)$ and $u = u(P,T)$ and several additional effects (thermal equilibrium, compression/expansion). Here $P$ is pressure, $T$ is temperature, $h$ is height, $\rho$ is density, $g$ is free fall acceleration, $u$ is specific internal energy.

The lower layers of liquid are under slightly higher pressure, so the liquid at the bottom of the tank will be slightly warmer than at the surface.

In reality, a host of other thermal effects are unlikely to allow the experiment to be observed in the setup presented here. Stirring, the heat effect of the pump, and heat transfer through the tank walls can all have an effect on the temperature of the liquid.

Running the model and analysing the results

In our model the tank has a diameter of 1 $м^2$, it is filled with liquid injected by a pump at a rate of 1 kg/s, the calculation is carried out from 0 to 1000 seconds. The liquid temperature sensors are located at 1, 2 and 3 m height.

In [ ]:
model_name = "tank_temperature_at_different_heights";
model_name in [m.name for m in engee.get_all_models()] ? engee.open(model_name) : engee.load( "$(@__DIR__)/$(model_name).engee");
res = engee.run( model_name );

During the observation period, the liquid level in the tank has risen by 1m. Let's see how the temperature readings changed at different heights.

In [ ]:
gr()
using Plots.PlotMeasures

plot(
    plot( res["Уровень воды"].time, res["Уровень воды"].value, label=false, title="Уровень воды, м",
      xlabel="Время, с", ylabel="Высота, м" ),
    plot( res["Сенсор 2м.1"].time,
      [res["Сенсор 1м.1"].value res["Сенсор 2м.1"].value res["Сенсор 3м.1"].value],
      label=["1м" "2м" "3м"], title="Датчики температуры", xlabel="Время, с", ylabel="Температура, К"),
    size=(1000,400), titlefont=font(11), guidefont=font(10), left_margin = [10mm 0mm], bottom_margin = 30px
)
Out[0]:

Between the marks 1m and 2m the sensors show different temperature values, but the scale of the difference can hardly be changed in reality - for 1m the temperature drops by 1.41e-4 К (ten thousandths of a degree). But we can see that the temperature at the bottom of the tank is slightly higher than at the surface.

In [ ]:
res["Сенсор 2м.1"].value[1] - res["Сенсор 1м.1"].value[1]
Out[0]:
-0.0001416177920532391

If we take one of the graphs from the temperature sensor and subtract the linear trend, we can even see a very small non-linearity:

In [ ]:
t = res["Сенсор 1м.1"].time
v = res["Сенсор 1м.1"].value
a = [t.^0 t.^1] \ v

разница = v .- (a[1] .+ a[2].*t)

plot( t, разница, label=false )
plot!( [t[1],t[end]], [разница[1],разница[end]], ls=:dash, c=:red, label=false )
plot!(title = "Нелинейный компонент измерения Т", xlabel="Время, с", ylabel="Температура, К\n(нелинейное слагаемое)",
    titlefont=font(11), guidefont=font(10), left_margin = [10mm 0mm], bottom_margin = 30px)
Out[0]:

Conclusion

We have shown by a simple example how a virtual experiment formulated using blocks from the heat-conducting fluid library allows us to demonstrate some theoretical effects that are quite difficult to observe empirically in a teaching laboratory setting. But they will manifest themselves in more complex cases, and these are effects that can be dangerously neglected.