Week 10 - Simulation of Flow through a pipe in OpenFoam
To tackle this challenge, we will simulate an axi-symmetric flow through a pipe using a wedge boundary condition, perform numerical analysis of the flow, and validate the results with Hagen-Poiseuille's equations for fully developed laminar flow. I'll walk you through the steps and provide MATLAB code to automate the creation of the OpenFOAM blockMeshDict file for the simulation.
Step-by-Step Plan:
Understanding the Problem:
- Laminar flow through a constant cross-section pipe at an inlet Reynolds number of 2100.
- Fully developed flow is expected after a certain hydrodynamic entrance length.
- Validation using Hagen-Poiseuille law, which gives an analytical solution for velocity and pressure drop in fully developed laminar pipe flow.
Wedge Geometry Setup:
- The wedge geometry is created by collapsing one face of a hexahedral block.
- The wedge angle should be less than 5 degrees to approximate axi-symmetry.
Mathematical Equations:
- Hagen-Poiseuille Law for fully developed laminar flow:
- Velocity profile:
- Pressure drop per unit length:
- Velocity profile:
- Where:
- is the pipe radius,
- is the dynamic viscosity,
- is the maximum velocity at the centerline,
- is the volumetric flow rate.
- Hagen-Poiseuille Law for fully developed laminar flow:
Key Outputs:
- Hydrodynamic entrance length: LH=0.05×Re×D
- Fully developed velocity profile validation.
- Maximum velocity and pressure drop validation.
- Wall shear stress validation:
MATLAB Code for
blockMeshDictGeneration: The following MATLAB script will automate the creation of theblockMeshDictfile, taking inputs like pipe length, diameter, wedge angle, etc.
How to Use the Code:
- Save the code in a file called
generateBlockMeshDict.m. - In MATLAB, call the function with the desired pipe dimensions and mesh properties
- This will generate a
blockMeshDictfile for a pipe of length 5 m, diameter 0.1 m, and a wedge angle of 3°, with 100 cells in the radial direction, 20 angular cells, and 50 cells along the length.
Validation:
- Hydrodynamic Length: Compare the entrance length computed from the simulation with the theoretical prediction .
- Fully Developed Flow Profile: Plot the numerical velocity profile at fully developed sections and compare with the analytical profile
- Pressure Drop: Measure pressure drop across the pipe from the simulation and compare with the analytical expression.
- Wall Shear Stress: Calculate wall shear stress from both the simulation and the analytical model.
This setup should allow you to simulate the flow and validate it against analytical solutions efficiently. Let me know if you need further modifications!