CFD analysis of a pipe flow
This tutorial shows how to run a CFD analysis of the flow inside a pipe with multiple inlets using our free CFD software SimWorks. The tutorial will guide you in the setup of the simulation of a pipe with different inlets. The results will show the local pressure distribution inside the pipe and the source of pressure losses.

A simple approach to calculate the pressure and velocity distribution in a pipe would be to assume a quasi 1D flow and use the Bernoulli equation (1), which is valid for incompressible inviscid fluids, in conjunction with the conservation of mass (2):
Where A is the sectional area of the pipe. Using these two equations, it is possible to calculate the pressure from the velocity and vice-versa. However, we are assuming that the flow is uniform in each section and we are not taking into account the flow viscosity and the subsequent losses that progressively reduce the flow energy. These assumptions can lead to significant errors in the calculations. This is particularly evident around bends or geometrical discontinuities, where significant pressure losses can be experienced.
Carrying out a CFD analysis of pipe flow can provide a reliable results taking into account those pressure losses as well and get the actual velocity distribution at any section of the pipe.
Setting up the CFD analysis of pipe flow
In the following tutorial we will simulate the flow inside a complex pipe in a CFD simulation using out free CFD software Simworks. The overall lenght of the pipe is 3.5m

The first step is to download SimWorks from the link below, which is completely free and unrestricted. You can follow the installation procedure described in our installation guide and you can also download the geometry file for this tutorial here.
Create a new simulation
The first step after opening SimWorks is to create a new project, a new geometry and a new simulation if you have not already done any of those steps:
- Click on Create new project
- Click on Create new geometry
- Click on Create new simulation

Load the geometry
To load the geometry in SimWorks complete the following steps:
- Browse geometry icon → select the pipe.igs file
- Select m as the Geometry units
- Load the geometry → select the pipe.igs file
- Rename the simulation to Pipe in the popup that will appear

Check the geometry
Once the geometry is imported, SimWorks will automatically create an outer domain (OD) around it (1), however since this is an internal flow simulation we want to deactivate it by pressing on the Toggle outer domain button (2), not to be confused with the Show / Hide outer domain button in the Geometry Viewer window, which would only hide it.

Once the Outer Domain is deactivated, we can click in the Geometry viewer window on the layering button (1) we can select the Surface normals layering (2) to check the local normals on the different geometrical elements of the geometry. This shows the positive direction of the surface in yellow, so on the yellow patches when we define a positive flow velocity the flow will be entering in the geometry, on the black patches it will be exiting it.
For instance in the pipe inlet (3) in the image below the positive direction is entering in the pipe, in the case of the inlet (4) the positive direction will be exiting it. Obviously the user can flip those directions in the original CAD and re-export the geometry or alternatively the user can take into account those normals once the boundary conditions are defined, and this is the approach we are going to use.

From the same layering menu it is possible to select the Part names layering to see which patches SimWorks recognised and their names. With this layering active when the user clicks on a part the part name will be displayed:

Define the boundary conditions
Selecting the Boundary condition types layering (1) it appears that the whole pipe is set to be a fixed wall, this is the default boundary condition. To be able to set a specific boundary condition on the Inlet we need to select it, make sure that the Main_Inlet patch is selected in the Parts menu (3) and finally click on the Create new Part Group button to be able to create an independent part group where we can apply a specific boundary condition. It is also possible to change the name of the Part group to one relevant for the user.
We can repeat the exercise with the remaining patches to obtain 5 part groups in total: Main_Inlet, Main_Exit, Second_Inlet, Third_Inlet and the last one containing the body of the pipe, which can remain a fixed wall and rename them to remember which part group corresponds to which surface.

We can now reactivate the Boundary condition types layering and select the Main_Inlet part group. The normal of this face is positive so we can set a positive velocity of 5 m/s:

We can also set / modify those boundary conditions directly in the Simulation editor menu.
Please find below the boundary conditions used in this case:
- Main Inlet: + 5 m/s
- Second Inlet: – 10 m/s (remember that the surface normal in this case is negative and plotted in black in the Surface normals layering!)
- Third Inlet: + 10 m/s (the normal is positive in this case)
- Main Exit: Pressure outlet of 0 Pa (remember that a CFD simulation with all the boundary conditions defined as velocity will be unstable, so in this case we have set the main exit as a constant pressure boundary)
Mesh parameters
In the Mesh tab in the Simulation editor window we can now define all the mesh parameters for the simulation. The point in mesh defines which portion of space has to be meshed, so in our case the point has to be inside the pipe and its size is purely defined for visual purposes.
- Define the Base size of the mesh of 0.025 m
- The point in mesh defines which portion of the space is to be meshed, so define the Point in mesh (position) as 0 -0.3 0 and its Radius as 0.05 m
- To check that the Point in mesh is inside the geometry just press on the Toggle transparency button in the Geometry viewer, this will make the whole geometry transparent and show that the Point in mesh is in effect inside the pipe

Select the Mesh tab in the Simulation editor window, we have a single Surface mesh group containing all the geometrical patches. It is possible at this stage to create different Surface mesh groups as done in the Part group case. This can be done both in the Geometry viewer window with the relevant Mesh groups layering active as seen above with the Part groups or directly in the Simulation editor window
- Select the Mesh tab
- Select the Main_Body patch from the Parts dropdown menu
- Click on the Create Part Group button

4. Rename the Surface mesh group as main_body_surface
Output parameters
In the Output tab in the Simulation editor window it is possible to specify what we want to output for the pipe simulation. We will need more planes in the X direction to assess the development of the flow inside the pipe
- Select the Output tab in the Simulation editor window
- Define 20 planes in X from X -2 m to X 2 m
- Define for both Y and Z 10 planes from -1 m to 1 m

Setup and Mesh phases
We will complete the Setup phase to write all the simulation parameters and run the Mesh phase to visualise the results of the mesh parameters defined in the previous point paragraph.
- Run the Setup phase
- Run the Mesh phase
- The Live Data window will automatically appear showing the live feed from of the mesher
- Finally the mesh progress bar will be 100% complete. To visualise the mesh, right click on it → select Fields → Load

Mesh quality assessment
From the Fields window it is possible to scroll through the planes in any direction and assess the mesh quality and dimensions. You can visualise the external mesh by making sure that the Show parts checkbox is thicked, or you can unthick it and select one of the sections in the Show sections dropdown menu. It is then possible to scroll along the direction set in the Direction dropdown menu by pressing the arrows next to it or the up and down arrows on the keyboard.


From the plane view it is possible to see that the near wall mesh has 3 layers as requested.
Please bear in mind that the cells are triangulated for visualisation purposes but in reality the cells are prisms/hexahedrals.
Run the simulation
Now it is time to run the simulation and analyse the results. We have set the simulation to run for 500 iterations on 4 processes (both parameters available in the Setup tab in the Simulation editor window)
- Click on the Run simulation icon in the Simulation manager window
- The Live data window will be populated with the solver feedback and the simulation residuals and forces. The progress bar will be updated with the simulation progress, when it reaches 100% the simulation is complete
- Once completed as already done to check the mesh right click on the progress bar and select Fields → Load, this way the mesh visualisation will be overwritten with the actual CFD simulation results

Analyse the results of the CFD analysis of a pipe flow
From the Field viewer window it is possible to analyse flow inside the pipe
- Trigger the Show/Hide edges to hide all the cell edges and have a smooth view. It is important to note that the planes in this case are fully triangulated to improve the results calculation, so comparing this with the mesh visualisation the edges represent the actual cell size but with additional splitting
- Uncheck the Show parts checkbox
- Select the Show sections and turn on the normals to all the directions x, y and z
- Select the x, y and z directions and slide the planes using the keyboard arrows

5. Select p in the Variable tab and define the range from -100 Pa to 100 Pa
6. Click on update legend button to visualise the new field

7. Select the Point probing button
8. Click on one point of the planes to get the local vale of pressure, which in the case below is -19.2 Pa

Conclusions
You can see from the pressure plot above how the static pressure changes within the pipe. The velocity field shows how the flow progressively accelerates as additional flow is injected by the secondary inlets. Also in the velocity plot, it is possible to check the actual velocity distribution in the exit face of the pipe that shows a much higher velocity on the far side with respect to the last inlet.

This velocity distribution as well as the actual pressure loss in the system would not be captured correctly by simply using the Bernoulli equation. You can now change any parameter of the simulation and rerun it to see how the results change, in particular you can change the velocity in the inlet close to the main exit to see how this affects the actual velocity distribution at the exit of the pipe.
This tutorial has shown how to carry out a CFD analysis of a pipe flow using the free CFD software SimWorks, see also the following fluid flow notes for reference.