EasyFOAMtutorials

Tutorial 3 of 19

Laminar flow in a pipe

Flow inside a shape: a straight pipe whose result you can check by hand.

about 20 minBeginnerInternal flowChecked against theory

Slow flow through a straight pipe has an exact solution, known since the 1840s: far enough from the entrance, the speed across the pipe is a parabola whose peak is twice the average speed. That makes it a good second case: you learn how to simulate the flow inside a shape, and you can tell whether the answer is right.

The pipe is 0.2 m in diameter and 2 m long. The fluid enters at 1 m/s and has a viscosity of 0.004 m²/s, so the Reynolds number is 1 × 0.2 / 0.004 = 50.

What you will learn

  • let the base mesh cut a shape open to make an inlet and an outlet
  • tell EasyFOAM that the fluid is inside the shape
  • set an inlet velocity and an outlet pressure
  • stop a steady run automatically when it has converged, and compare with theory

Computer time: about half a minute for the mesh and a minute for the run, on four cores.

1Open the example

Start EasyFOAM. This case is one of the examples on the start page: it comes with every setting filled in, and this tutorial walks through each of them so that you understand the case and could build it yourself.

  1. Click Laminar flow in a pipe.
Laminar flow in a pipe, step 1: Open the example

2Name the project

The project is an ordinary folder that EasyFOAM creates for you.

  1. Type a name, for example pipe.
  2. Click Create project.
Laminar flow in a pipe, step 2: Name the project

3The pipe is a cylinder

The only shape is a cylinder called tube. Notice that it is longer than it needs to be: it runs from x = −0.5 m to x = 2.5 m, but the mesh will only cover 0 to 2 m. The two ends of the mesh cut the cylinder open, and those cuts become the inlet and the outlet.

  1. The shape tube is selected and shown in the 3D view.
  2. Axis start and Axis end: the two ends of the cylinder's centre line.
  3. Radius: 0.1 m.
  4. Surface refinement 1: cells at the pipe wall are half the size of the base cells.
Laminar flow in a pipe, step 3: The pipe is a cylinder

4The base mesh and where the fluid is

The base mesh is a box of cubes a little wider than the pipe and exactly as long as the part we want to simulate. One setting matters most here: by default EasyFOAM keeps the mesh around the shapes. For a pipe we want the opposite.

  1. The box runs from x = 0 to 2 and is 0.25 m wide and high.
  2. Cells: 80, 10, 10, which makes cubes of 25 mm.
  3. The fluid is: inside tube.
  4. Click Mesh in the toolbar (or press F5).
Laminar flow in a pipe, step 4: The base mesh and where the fluid is

5The mesh of the inside

After about half a minute the mesh appears: only the inside of the pipe is left, with finer cells along the wall. The boundaries are named after where they came from: inlet and outlet are the two end faces of the base mesh, tube is the pipe wall.

  1. The Mesh step shows the number of cells, about 24,000.
  2. The boundaries are listed with their colours in the corner of the view.
Laminar flow in a pipe, step 5: The mesh of the inside

6A thick fluid, flowing slowly

The flow is steady and laminar. The fluid is an invented one, thick enough to keep the Reynolds number at 50.

  1. Turbulence: Laminar.
  2. Fluid: Custom.
  3. Kinematic viscosity: 0.004.
  4. Initial velocity: 1, 0, 0. Starting close to the answer saves iterations.
Laminar flow in a pipe, step 6: A thick fluid, flowing slowly

7The inlet

At the inlet the fluid enters with the same speed everywhere across the pipe.

  1. Select inlet.
  2. Condition: Velocity inlet.
  3. Velocity: 1, 0, 0.
Laminar flow in a pipe, step 7: The inlet

8The outlet and the wall

At the outlet the pressure is fixed and the fluid leaves as it likes. Pressures in EasyFOAM are relative, so zero is the natural choice. The pipe wall tube is an ordinary wall: the fluid sticks to it.

  1. Select outlet.
  2. Condition: Pressure outlet.
  3. Pressure: 0.
Laminar flow in a pipe, step 8: The outlet and the wall

9Run until it has converged

Instead of guessing how many iterations are needed, give a generous limit and a target: the run stops by itself once every residual is below it.

  1. Iterations: 500, an upper limit.
  2. Processor cores: 4. Use fewer if your computer has fewer.
  3. Stop below residual: 1e-5.
  4. Click Run in the toolbar (or press F6).
Laminar flow in a pipe, step 9: Run until it has converged

10Converged

The residuals fall steadily and the run ends well before the limit, as soon as the last of them passes the target.

  1. All four lines fall below 0.00001.
  2. The step shows at which iteration the run finished.
Laminar flow in a pipe, step 10: Converged

11The speed along the pipe

On a slice along the pipe you can watch the profile develop: flat at the inlet, then the fluid near the wall slows down and the middle speeds up, until the profile no longer changes.

Now the check. Theory says the middle ends up at twice the average speed, 2.0 m/s. The top of the colour scale reads about 1.93 m/s: within 4 % on this coarse mesh.

  1. Quantity: U.
  2. Slice plane: Normal to y.
  3. Click +Y to look at the slice from the side.
Laminar flow in a pipe, step 11: The speed along the pipe

12The pressure drop

Switch the quantity to the pressure. It falls evenly along the developed part of the pipe. Theory gives 32 × viscosity × speed / diameter² = 32 × 0.004 × 1 / 0.04 = 3.2 per metre; the simulation gives about 3.15.

EasyFOAM shows the pressure divided by the density (in m²/s²). Multiply by the density, here 1000 kg/m³, to get pascals: 3200 Pa per metre.

  1. Quantity: p.
Laminar flow in a pipe, step 12: The pressure drop

13Try it yourself

  • Raise Surface refinement of the tube to 2 and mesh again: the peak speed moves closer to 2.0.
  • Double the inlet speed. The pressure drop doubles too, as it must in laminar flow.
  • Set the viscosity to 1e-6 (water) and choose a turbulence model: the flat profile of turbulent pipe flow appears instead of the parabola.