Engee documentation
Notebook

Calculation of mass flow rate when fluid flows through pipes of different cross-sectional shapes

This example demonstrates the application of the Laminar Leakage block of the Isothermal Fluid library.

This block simulates laminar flow through sections of different geometries in an isothermal fluid network.

The cross sections considered in the example are: circle, rectangle, ellipse and equilateral triangle.

The cross-sectional areas of the pipes are equal to each other.

Schematic diagram of the model:

laminar_leakages_2_1727689911109.png

Define the function to load and run the model:

In [ ]:
function start_model_engee()
    try
        engee.close("npn_transistor", force=true) # закрытие модели 
        catch err # в случае, если нет модели, которую нужно закрыть и engee.close() не выполняется, то будет выполнена её загрузка после catch
            m = engee.load("$(@__DIR__)/laminar_leakages.engee") # загрузка модели
        end;

    try
        engee.run(m, verbose=true) # запуск модели
        catch err # в случае, если модель не загружена и engee.run() не выполняется, то будут выполнены две нижние строки после catch
            m = engee.load("$(@__DIR__)/laminar_leakages.engee") # загрузка модели
            engee.run(m, verbose=true) # запуск модели
        end
end
Out[0]:
start_model_engee (generic function with 1 method)

Loading, running the model and recording the results

Running the simulation

In [ ]:
try
    start_model_engee() # запуск симуляции с помощью специальной функции, реализованной выше
    catch err
    end;
Building...
Progress 0%
Progress 33%
Progress 66%
Progress 100%
Progress 100%

Allocating mass flow data from the simout variable:

In [ ]:
sleep(5)
result = simout;
res = collect(result)
Out[0]:
4-element Vector{WorkspaceArray}:
 WorkspaceArray("laminar_leakages/Треугольное сечение")
 WorkspaceArray("laminar_leakages/Прямоугольное сечение")
 WorkspaceArray("laminar_leakages/Круглое сечение")
 WorkspaceArray("laminar_leakages/Эллиптическое сечение")

Recording the results of the model into separate variables:

In [ ]:
circular_flowrate = collect(res[3])
rectangular_flowrate = collect(res[2])
elliptical_flowrate = collect(res[4])
triangular_flowrate = collect(res[1]);

Visualising model results

In [ ]:
using Plots
plot(circular_flowrate[:,1], circular_flowrate[:,2], label="Круглое сечение", lw = 3, title="Массовый расход через сечения", xlabel="Время, с", ylabel="Массовый расход, кг/с", legend=:bottomright)
plot!(rectangular_flowrate[:,1], rectangular_flowrate[:,2], label="Прямоугольное сечение", lw = 3)
plot!(elliptical_flowrate[:,1], elliptical_flowrate[:,2], label="Эллиптическое сечение", lw = 3)
plot!(triangular_flowrate[:,1], triangular_flowrate[:,2], label="Треугольное сечение", lw = 3)
Out[0]:

Conclusion:

This example demonstrates the modelling of a hydraulic network with Laminar Leakage units, each of which is a pipe with defined geometrical cross-sectional parameters. By analysing the simulation results it is possible to see the difference in mass flow rates of these pipes depending on the cross-sectional shape of the same area.