Fluid Modelling
Pipeline Engineer’s Fluid Modelling capabilities heavily leverage the Pandapipes Python library. The following sections detail how to use Pipeline Engineer for modelling networks.
1 Component Creation
Layers are either created or abstracted from the ‘Create Network Component’ Dialog that can be accessed either from the QGIS toolbar or plugin menu:-

Networks can be created from scratch of abstracted directly from existing GIS layers (it helps if the layers being extracted from are topologically consistent, however, users can modify the network after the fact if needed).

2 Fluid Creation
The ‘Fluids’ Dialog is also available from either the toolbar or the Plugin menu:-

Fluids properties can be viewed on the ‘Browser’ tab in the ‘Fluids’ Dialog:-

Users can create Fluids on the ‘Create Fluid’ tab of the ‘Fluids’ Dialog:-

3 Fluid Modelling Algorithms
All of Pipeline Engineer’s fluid modelling algorithms are available can be used directly from the QGIS Processing Toolbox.
This has the added benefit of allowing users to automate repetitive workflows, meaning users can automate the simulation of various scenarios.
The following sections detail the algorithms currently available and how they can be utilised in Python Scripts.
3.1 Add Parameter to Fluid Layer
Adds a fluid parameter at a specified pressure and temperature to a selected layer’s attribute table.
3.1.1 Parameters
| Label | Name | Type | Description |
|---|---|---|---|
| Input layer | INPUT |
[vector: any] | Layer user wishes to add fluid parameter to |
| Select Fluid | FLUID |
[enumeration] Default: 0 | Fluid from which properties will be selected:- 0 - hgas 1 - lgas 2 - hydrogen 3 - methane 4 - water 5 - biomethane_pure 6 - biomethane_treated 7 - air |
| Disjoint Check Selected Feature? | PARAMETER |
[enumeration] Default: 1 | Fluid parameter that that will be added to attribute table:- 0 - compressibility 1 - density 2 - heat capacity 3 - molar mass 4 - viscosity |
| Disjoint Check Selected Feature? | TEMP |
[numeric: double] Default: 293.15 | Temperature of fluid |
| Disjoint Check Selected Feature? | PRES |
[numeric: double] Default: 1.00 | Pressure of fluid |
| Disjoint Check Selected Feature? | ADD_FLUID |
[boolean] Default: True | Adds chosen fluid to attribute table when checked |
3.1.2 Outputs
| Label | Name | Type | Description |
|---|---|---|---|
| Parameter added | OUTPUT |
[vector: any] | Returns with fluid parameter added |
3.1.3 Python Code
import processing
processing.run("algorithm_id", {parameters_dictionary})
3.2 Run Pipeflow
The core pipeflow functionality relies leverages the fluid modelling tools from the pandapipes Python Library.
3.2.1 Parameters
| Label | Name | Type | Description |
|---|---|---|---|
| Select Network Layers | LAYERS |
[vector: any] [list] | Layers within the pipe network being analysed. See Network Component Creator for more details |
| Select Fluid | FLUID |
[enumeration] Default: 0 | Fluid Pipeflow will be carried out using:- 0 - hgas 1 - lgas 2 - hydrogen 3 - methane 4 - water 5 - biomethane_pure 6 - biomethane_treated 7 - air |
| Calculation Mode | CALC_MODE |
[enumeration] Default: 0 | Calculation Mode of pipeflow:- 0 - hydraulics 1 - bidirectional 2 - sequential |
| Maximum Iterations (Hydraulic) | MAX_ITER_HYD |
[numeric: double] Default: 10000 | Refer to Pipeflow Options |
| Maximum Iterations (Thermal) | MAX_ITER_THERM |
[numeric: double] Default: 10000 | Refer to Pipeflow Options |
| Pressure Error Tolerance | PRES_TOL |
[numeric: double] Default: 0.0001 | Refer to Pipeflow Options |
| Velocity Error Tolerance | VEL_TOL |
[numeric: double] Default: 0.0001 | Refer to Pipeflow Options |
| Temperature Error Tolerance | TEMP_TOL |
[numeric: double] Default: 0.0001 | Refer to Pipeflow Options |
| Residual Tolerance | RES_TOL |
[numeric: double] Default: 0.001 | Refer to Pipeflow Options |
| Ambient Temperature | AMBIENT_TEMP |
[numeric: double] Default: 293.15 | Refer to Pipeflow Options |
| Friction Model | FRIC_MODEL |
[enumeration] Default: 1 | Refer to Pipeflow Options |
| Alpha | ALPHA |
[numeric: double] Default: 1 | Refer to Pipeflow Options |
| Nonlinear Method | NONLINEAR_METHOD |
[enumeration] Default: 0 | Refer to Pipeflow Options |
| Update Hydraulic Matrix Only? | UPDATE_HYD_ONLY |
[boolean] Default: False | Refer to Pipeflow Options |
| Check Connectivity? | CHECK_CONNECTIVITY |
[boolean] Default: True | Refer to Pipeflow Options |
| Quit on Inconsistency? | QUIT_ON_INCONSISTENCY |
[boolean] Default: False | Refer to Pipeflow Options |
| Use Numba? | USE_NUMBA |
[boolean] Default: True | Refer to Pipeflow Options |
3.2.2 Outputs
| Label | Name | Type | Description |
|---|---|---|---|
| Load Layers? | LOAD_LAYERS |
[boolean] Default: True | When checked, will load result files to a temporary layer |
| Output Geopackage | OUTPUT |
[file] Default: [Save to temporary file] | Will save result layers to specified output (will save to temporary file by default) |
3.2.3 Python Code
import processing
processing.run("algorithm_id", {parameters_dictionary})
3.3 Incompressible Flow
Runs a pandapipes pipeflow of a specified fluid to obtain flow distribution throughout network. Will then reverse all lines that are flowing in the opposite direction of the line geometry. A pressure-drop correlation is used to back-calculate the pressure from the grids outwards.
3.3.1 Parameters
| Label | Name | Type | Description |
|---|---|---|---|
| Select Network Layers | LAYERS |
[vector: any] [list] | Layers within the pipe network being analysed. See ‘1 Component Creation’ for more details |
| Select Liquid Phase | LIQUID |
[enumeration] Default: 0 | Will include water by default. Users can add fluids with custom properties in the fluids browser (2 - Fluid Creation) |
| Liquid Vapour Pressure | VAPOUR_PRES |
[numeric: double] Default: 0.0563 | Vapour Pressure of Liquid in bar (Pressure will not fall below this number) |
| Pressure Multiplier (Multiplies Calculated Pressure Loss by a Factor) | PRES_MULTIPLIER |
[numeric: double] Default: 1 | Multiplies Pressure Losses by this number |
| Average Mixture Pressure (Used for Calculating Phase Properties) | FLUID_PRES |
[numeric: double] Default: 1 | Pressure used to retrieve fluid properities |
| Return Network Skeleton? | RETURN_NETWORK |
[boolean] Default: True | Returns the flow distribution layer with lines facing flow directions as well as the sampled xyz layer |
| Chainage | CHAINAGE |
[numeric: double] Default: 20 | The intervals between each point in the XYZ layer |
| Select DEM Layer | DEM |
[raster] | The Digital Elevation Model (DEM) Layer where heights will be sampled from |
| Maximum Iterations (Hydraulic) | MAX_ITER_HYD |
[numeric: double] Default: 10000 | Refer to Pipeflow Options |
| Maximum Iterations (Thermal) | MAX_ITER_THERM |
[numeric: double] Default: 10000 | Refer to Pipeflow Options |
| Pressure Error Tolerance | PRES_TOL |
[numeric: double] Default: 0.0001 | Refer to Pipeflow Options |
| Velocity Error Tolerance | VEL_TOL |
[numeric: double] Default: 0.0001 | Refer to Pipeflow Options |
| Temperature Error Tolerance | TEMP_TOL |
[numeric: double] Default: 0.0001 | Refer to Pipeflow Options |
| Residual Tolerance | RES_TOL |
[numeric: double] Default: 0.001 | Refer to Pipeflow Options |
| Ambient Temperature | AMBIENT_TEMP |
[numeric: double] Default: 293.15 | Refer to Pipeflow Options |
| Friction Model | FRIC_MODEL |
[enumeration] Default: 1 | Refer to Pipeflow Options |
| Alpha | ALPHA |
[numeric: double] Default: 1 | Refer to Pipeflow Options |
| Nonlinear Method | NONLINEAR_METHOD |
[enumeration] Default: 0 | Refer to Pipeflow Options |
| Update Hydraulic Matrix Only? | UPDATE_HYD_ONLY |
[boolean] Default: False | Refer to Pipeflow Options |
| Check Connectivity? | CHECK_CONNECTIVITY |
[boolean] Default: True | Refer to Pipeflow Options |
| Quit on Inconsistency? | QUIT_ON_INCONSISTENCY |
[boolean] Default: False | Refer to Pipeflow Options |
| Use Numba? | USE_NUMBA |
[boolean] Default: True | Refer to Pipeflow Options |
3.3.2 Outputs
| Label | Name | Type | Description |
|---|---|---|---|
| Load Layers? | LOAD_LAYERS |
[boolean] Default: True | When checked, will load result files to a temporary layer |
| Output Geopackage | OUTPUT |
[file] Default: [Save to temporary file] | Will save result layers to specified output (will save to temporary file by default) |
3.3.3 Python Code
import processing
processing.run("algorithm_id", {parameters_dictionary})