Challenge

Week 11 - Simulation of Flow through a pipe in OpenFoam

Aim: To simulate an axis-symmetric flow by applying the wedge boundary condition. The flow is laminar and flows through a constant cross-section pipe at an inlet Reynold's number of 2100 in OpenFOAM.

Objective:

You can do a transient or steady-state simulation and you will validate your results with the Hagen- Poiseuille's equations for the fully developed flow.

Write code in Matlab to automate the generation of the blockMeshDict files. The code should take inputs like pipe length, diameter, wedge angle, etc, and output a fully functional blockMeshDict file.

Theory:

Poiseuille's Equation describes the pressure drop due to the viscosity of the fluid.

It explains the changes in the velocity profile from the inviscid profile at pipe entrance to uniform gradient along with the radial distance.

It involves boundary layer development due to the no-slip condition at the walls of the pipe.

Fully developed flow: Fully developed flow implies that the velocity profile does not change in the fluid flow direction.

Assumptions:

The assumptions of the equation are that the fluid is incompressible and Newtonian; the flow is laminar through a pipe of
constant circular cross-section that is substantially longer than its diameter; and there is no acceleration of fluid in the pipe.

Reynolds number, Re = 2100
Working fluid - water
Density of water, ρ = 997 kg/m3
The diameter of the pipe = 0.015 m
Dynamic viscosity at 25 deg. C, μ = 0.00089 Pa-s
Length of the pipe, L= 1.5*Le, where Le= Entrance length
To ensure efficient simulation, the system is divided into segments and we will solve the equations for a particular wedge angle.
In case, we will consider wedge angle, theta = 5 deg

Equations:

Entrance length, Le= 0.06*Re*D

Average velocity, v_avg = Re*mu/(ρ*D)

v_max = 2*v_avg

Pressure difference, P1- P2 = 32*μ*v_avg*L/D^2

Geometry:

Control dictionary for simulation:

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 5;
deltaT 0.01;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //

Initial conditions
Pressure
Inlet = zerogradient
Outlet = Kinematic Pressure gradient (P1- P2)

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0.0479;
}
Front
{
type wedge;
}
Back
{
type wedge;
}
pipewall
{
type zeroGradient;
}
axis
{
type empty;
}
}
// ************************************************************************* //

Velocity:
Inlet - v_avg
Outlet - zerogradient

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (0.125 0 0);
}
outlet
{
type zeroGradient;
}
pipewall
{
type noSlip;
}

Front
{
type wedge;
}
Back
{
type wedge;
}
axis
{
type empty;
}
}
// ************************************************************************* //

Constant properties
Define the kinematic viscosity of water for the system

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 8.926e-07;
// ************************************************************************* //

Output after simulation using icoFoam solver

Velocity magnitude

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.