↑top

Tutorial : Measuring outlet flow rate in branch pipe

Updated: December 28, 2019

In this tutorial, we will create setting files to calculate flow in branch pipe and measure outlet flow rate of the flow.

Analysis summary

We will calculate steady state water flow in branched pipe with a total length of 200 mm. The inlet flow rate is 100 mm/s and we measure flow rate at the 2 outlet port.

ParaFoam velocity result
Analysis result

Creating an analysis configuration file

Creating a project

Open XSim. Type "BranchPipe" as Project Name and click Create button to create project.

A dialog for project creating
A dialog for project creating

Importing shapes

We will use a prepared shape file in this tutorial. Please download a zipped file from next link, "tutorial-BranchPipe.zip", and extract it.

Drag&Drop the extracted file "inlet.stl", "outlet1.stl", "outlet2.stl" and "wall.stl" at "Drop files" tab and load it. The loaded shape will be shown in 3D view.

Importing shapes from a file
Importing shapes from a file

Click Next button to go to Mesh page.

Mesh

  • Volume mesh settings

    Set 80000 as target number of base meshes. You can preview the base mesh by clicking preview button'preview' icon.

    Setting target number of base meshes
    Setting target number of base meshes
    Base mesh preview
    Base mesh preview

    And set (0.115, -0.024, 0) as computational domain to specify the spatial domain for calculation.

    Setting computational domain
    Setting computational domain

    In addition, we refine the mesh to improve the calculation accuracy of the flow at the branch. Select "Cuboid" as range type in "Refinement settings" and set (0.09, -0.06, -0.011) m to minimum coordinate, (0.14, 0.012, 0.011) m to Maximum coordinate. And set 2 to refinement level. Preview the range shape by clicking preview button'Preview' icon, then click Add.

    Refinement settings
    Refinement settings
    Refinement region preview
    Refinement region preview
  • Layer mesh settings

    Confirm that 0.3 is set to layer thickness ration and 3 is set to number of layers. Click "wall" in Navigation view at left side of the window to select, then click Set.

    Layer mesh settings
    Layer mesh settings

Click Next button to go to Basic Settings page.

Basic Settings

No configuration is required because we will use default parameters. Click Next button to go to Physical Property page.

Physical Property

No configuration is required because we will use default physical property. Confirm that "Water" is set as the physical property value. Then click Next button to go to Initial Condition page.

Initial Condition

No configuration is required because we will use default parameters. Click Next button to go to Flow Boundary Condition page.

Flow Boundary Condition

  • Inlet

    Select "Selected regions" as region and "Fixed flow velocity" as type. Then set (0.1, 0, 0) m/s as flow velocity and select "inlet" on Navigation view. After that, click Set.

    Fixed flow velocity (inlet)
    Fixed flow velocity (inlet)
  • Outlet

    In this calculation, the pressure at "outlet1" will be be used as reference point for pressure. Select "Selected regions" as region and "Fixed static pressure" as type. Then set 0 Pa as static pressure and select "outlet1" on Navigation view. After that, click Set.

    Next, we set condition for "outlet2" region. Select "Selected regions" as region and "Natural inflow/outflow" as type. Then select "outlet2" on Navigation view and click Set.

    Fixed static pressure (outlet1)
    Fixed static pressure (outlet1)
    Natural inflow/outflow (outlet2)
    Natural inflow/outflow (outlet2)
  • Wall

    Select "Selected regions" as region and "Stationary wall" as type. Then select "wall" and "ZMin" on Navigation view and click Set.

    Stationary wall (wall)
    Stationary wall (wall)

After setting the boundary conditions, the 3D view will be as follows (You can switch the 3D display to semitransparent by clicking a display-mode button'toggle display' iconunder 3D view).

3D view
3D view

Click Next button to go to Calculation Settings page.

Calculation Settings

In this section, we set parallel number of CPU core that we use in this calculation (for example, 4).

Calculation Settings
Calculation Settings

Click Next button to go to Output page.

Output

Because this analysis is a steady analysis, select "Each specified cycles" as type and set 50 cycles to interval.

Output settings
Output settings

In addition, we set to output the flow rate at inlet and outlet. At "Region" tab, select "Selected regions" as region and "Flow rate" as type. Then select "inlet", "outlet1" and "outlet2" on Navigation view and click Set.

Output setting of flow rate
Output setting of flow rate

Click Next button to go to Export page.

Export

Finally we finished all setings. Click Export button to export the analysis setting as zipped OpenFOAM case directory "BranchPipe.zip". The zip file download starts immediately.

Export
Export

Running a calculation

Extract downloaded file "BranchPipe.zip". There is a bash-script "Allrun " in the case directory. So run the script to make mesh and calculate the OpenFOAM solver by following command.

./Allrun

If the machine that calculation is running has desktop environment and gunuplot was installed, residual convergence chart will be displayed.

Chart for monitoring
Chart for monitoring

Confirming a calculation result

After the calculation, execute a following command to visualize the mesh and the calculation result.

paraFoam

The mesh become finer near the branch and 3 layer mesh is inserted on the wall as configured.

Whole meshes
Whole meshes
Meshes near the outlet
Meshes near the outlet
Cut meshes near the branch
Cut meshes near the branch

The flow velocity and pressure near the branch is as following.

Flow velocity
Flow velocity
Pressure
Pressure

The flow rates at inlet and outlets are saved in "postProcessing" folder. In the folder, the flow rate at each cycle is written in a file for each region. The each flow rate at last cycle is as following.

  • Flow rate at inlet: -3.117423e-05
  • Flow rate at outlet1: 2.458502e-05
  • Flow rate at outlet2: 6.589143e-06

Inflow direction is negative, outflow direction is positive and the flow rate unit is m3/s.

The sum of above values is -6.7e-11 and the error for inflow is about 2.15e-04%. So the flow rates are generally correct.

On the other hand, real inflow rate should be -3.141592e-05 m3 because inlet radius is 10 mm and flow veclocity at inlet is 0.1 m/s (inflow rate=π * radius2 * flow veclocity). So the error for inflow rate 0.76 %. Looking at the top of the inlet flow data file, there is a description of "# Area: 3.117423e-04". Therefore the area of inlet causes the error. If the polygon of the pipe shape become finer, the error will be lesser.