In this tutorial, we will create setting files to calculate flow in branch pipe and measure outlet flow rate of the flow.
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.
Open XSim. Type "BranchPipe" as Project Name and click button to create project.
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.
Click
button to go to Mesh page.Set 80000 as target number of base meshes. You can preview the base mesh by clicking preview button.
And set (0.115, -0.024, 0) as computational domain to specify the spatial domain for calculation.
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, then click
.Confirm that 0.3 is set to layer thickness ratio and 3 is set to number of layers. Click "wall" in Navigation view at left side of the window to select, then click
.Click
button to go to Basic Settings page.No configuration is required because we will use default parameters. Click
button to go to Physical Property page.No configuration is required because we will use default physical property. Confirm that "Water" is set as the physical property value. Then click
button to go to Initial Condition page.No configuration is required because we will use default parameters. Click
button to go to Flow Boundary Condition page.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
.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
.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
.Select "Selected regions" as region and "Stationary wall" as type. Then select "wall" and "ZMin" on Navigation view and click
.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 buttonunder 3D view).
Click
button to go to Calculation Settings page.In this section, we set parallel number of CPU core that we use in this calculation (for example, 4).
Click
button to go to Output page.Because this analysis is a steady analysis, select "Each specified cycles" as type and set 50 cycles to interval.
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
.Click
button to go to Export page.Finally we finished all settings. Click
button to export the analysis setting as zipped OpenFOAM case directory "BranchPipe.zip". The zip file download starts immediately.Extract downloaded file "BranchPipe.zip". There is a bash-script "Allrun " in the case directory. So run the script to make mesh and start the OpenFOAM solver by following command.
If the machine that calculation is running has desktop environment and gunuplot was installed, residual convergence chart will be displayed.
Running in 4 parallel (Inter(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.19GHz), it takes 45 seconds to create a mesh and about 8 minutes 30 seconds to analyze.
After the calculation, execute a following command to visualize the mesh and the calculation result.
The mesh become finer near the branch and 3 layer mesh is inserted on the wall as configured.
The flow velocity and pressure near the branch is as following.
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.
Inflow direction is negative, outflow direction is positive and the flow rate unit is m3/s.
The sum of above values is -2.0e-11 and the error for inflow is about 6.42e-05 %. 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.86 %. Looking at the top of the inlet flow data file, there is a description of "# Area: 3.118457e-04". Therefore the area of inlet causes the error. If the polygon of the pipe shape become finer, the error will be lesser.