Challenge

Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation

OBJECTIVE :

  • Simulation of laminar flow through pipe in openfoam
  • Simulate for the angles 10,25,45 degrees with both wedge and symmetry boundary condition.

INTRODUCTION :

Pipe flow regime laminar and turbulent is determined by Reynolds Number

`R_e=(ρvD)/μ`

for flow through pipe

Re < 2300 laminar flow

2300< Re < 4000 Transitional flow

Re > 4000 turbulent flow

HYDRODYNAMIC ENTRANCE LENGTH :

The flow has uniform velocity at the pipe entrance as shown in below fig. Because of the no-slip condition at the wall, we know that the velocity at the wall must be zero along the entire length of
the pipe. A boundary layer develops along the walls of the channel. The solid surface exerts a retarding shear force on the flow; thus the speed of the fluid in the neighborhood of the surface is reduced.

Sufficiently far from the pipe entrance, the boundary layer developing on the pipe wall reaches the pipe centerline and the flow becomes entirely viscous. The velocity profile shape then changes slightly after the inviscid core disappears. When the profile shape no longer changes with increasing distance x, the flow is called fully developed.

The distance downstream from the entrance to the location at which fully developed flow begins is called the entrance length.(Le)

For laminar flow `L_e=0.06 Re⁡D`

For turbulent flow `L_e=4.4 (Re)^(1/6)⁡D`

Hagen- Poiseuille's Equations :

In nonideal fluid dynamics, the Hagen–Poiseuille equation also known as the Hagen–Poiseuille law is a physical law that gives the pressure drop in an incompressible and Newtonian fluid in laminar flow flowing through a long cylindrical pipe of constant cross section.

Velocity Profile

`u(r)=-1/(4µ) (dP)/(dx) (R^2-r^2 )`

Average Velocity

`v_(aνg)=-R^2/8 (dP)/(dx)`

Maximum Veleocity

`v_(max)=2*v_(aνg)`

Flow Rate

`Q=-(ᴨR^4)/(8µ) (dP)/dx`

Pressure Drop

`(dP)/(dx)=(P_1-P_2)/L`

`P_1-P_2=(8*µ*L*v_(aνg))/R^4`

Head Loss

`H_(loss)=(P_1-P_2)/(ρg)`

Program for BlockMesh In Matlab :

clear all
close all
clc
% Reynolds number for laminar flow 
Re=2100;
% Piope Diameter
D=0.004;
%Pipe Radius
r=D/2;
% Hydrodynamic entry length of pipe
L_h=0.06*Re*D;
% Total Length of pipe
L=L_h+0.7;
% wedge angle
theta=45;
% Dynamic Viscosity
mu=0.89e-3;
% Density
rho=997;

%Equations for Hagen-Poiseuille Flow
v_avg=(Re*mu)/(rho*D);
v_max=2*v_avg;
del_p=(8*mu*L*v_avg)/(r^2);
kinematic_p=del_p/rho;
R=linspace(0,r,1000);
% shear stess
for i=1:length(R)
    tau(i)=2*mu*v_max*(R(i)/r^2 );
end

plot(R,tau);
xlabel('Radius');
ylabel('Shear Stress');
legend ('Shear Stress Variation');

% Creating blockMeshDict file
header1='/*--------------------------------*- C++ -*----------------------------------*\'
header2='  =========                 |'
header3='  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox'
header4='   \\    /   O peration     | Website:  https://openfoam.org'
header5='    \\  /    A nd           | Version:  9'
header6='     \\/     M anipulation  |'
header7='\*---------------------------------------------------------------------------*/'
header8='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //'
f1=fopen('blockMeshDict','w')
fprintf(f1,'%s\n',header1)
fprintf(f1,'%s\n',header2)
fprintf(f1,'%s\n',header3)
fprintf(f1,'%s\n',header4)
fprintf(f1,'%s\n',header5)
fprintf(f1,'%s\n',header6)
fprintf(f1,'%s\n',header7)
fprintf(f1,'FoamFile\n{\n')
fprintf(f1,'%12s \t ascii;\n','format')
fprintf(f1,'%12s \t dictionary;\n','class')
fprintf(f1,'%12s \t  blockMeshDict;\n','object')
fprintf(f1,'}\n') 
fprintf(f1,'%s\n\n',header8)
fprintf(f1,'convertToMeters 1;\n\n')
fprintf(f1,'vertices\n')
fprintf(f1,'(\n')
fprintf(f1,'\t (%d %d %d)\n',0,0,0)
fprintf(f1,'\t (%d %d %d)\n',0,r*cosd(theta/2),r*sind(theta/2))
fprintf(f1,'\t (%d %d %d)\n',0,r*cosd(theta/2),-r*sind(theta/2))
fprintf(f1,'\t (%d %d %d)\n',L,0,0)
fprintf(f1,'\t (%d %d %d)\n',L,r*cosd(theta/2),r*sind(theta/2))
fprintf(f1,'\t (%d %d %d)\n',L,r*cosd(theta/2),-r*sind(theta/2))
fprintf(f1,');\n\n')
fprintf(f1,'blocks\n')
fprintf(f1,'(\n')
fprintf(f1,'\t hex (0 3 5 2 0 3 4 1) (%d %d %d) simpleGrading (1 0.1 1)\n',300,30,1)
fprintf(f1,');\n\n')
fprintf(f1,'edges\n')
fprintf(f1,'(\n')
fprintf(f1,'\t arc %d %d (%d %d %d)\n',1,2,0,r,0)
fprintf(f1,'\t arc %d %d (%d %d %d)\n',4,5,L,r,0)
fprintf(f1,');\n\n')
fprintf(f1,'boundary\n')
fprintf(f1,'(\n')
fprintf(f1,'\t inlet \n')
fprintf(f1,'\t {\n')
fprintf(f1,'\t\t type patch;\n')
fprintf(f1,'\t\t faces\n')
fprintf(f1,'\t\t (\n')
fprintf(f1,'\t\t\t (0 1 2 0)\n')
fprintf(f1,'\t\t );\n')
fprintf(f1,'\t }\n')
fprintf(f1,'\t outlet \n')
fprintf(f1,'\t {\n')
fprintf(f1,'\t\t type patch;\n')
fprintf(f1,'\t\t faces\n')
fprintf(f1,'\t\t (\n')
fprintf(f1,'\t\t\t (3 5 4 3)\n')
fprintf(f1,'\t\t );\n')
fprintf(f1,'\t }\n')
fprintf(f1,'\t top \n')
fprintf(f1,'\t {\n')
fprintf(f1,'\t\t type wall;\n')
fprintf(f1,'\t\t faces\n')
fprintf(f1,'\t\t (\n')
fprintf(f1,'\t\t\t (1 4 5 2)\n')
fprintf(f1,'\t\t );\n')
fprintf(f1,'\t }\n')
fprintf(f1,'\t front \n')
fprintf(f1,'\t {\n')
fprintf(f1,'\t\t type wedge;\n')
fprintf(f1,'\t\t faces\n')
fprintf(f1,'\t\t (\n')
fprintf(f1,'\t\t\t (0 3 4 1)\n')
fprintf(f1,'\t\t );\n')
fprintf(f1,'\t }\n')
fprintf(f1,'\t back \n')
fprintf(f1,'\t {\n')
fprintf(f1,'\t\t type wedge;\n')
fprintf(f1,'\t\t faces\n')
fprintf(f1,'\t\t (\n')
fprintf(f1,'\t\t\t (0 2 5 3)\n')
fprintf(f1,'\t\t );\n')
fprintf(f1,'\t }\n')
fprintf(f1,'\t axis \n')
fprintf(f1,'\t {\n')
fprintf(f1,'\t\t type empty;\n')
fprintf(f1,'\t\t faces\n')
fprintf(f1,'\t\t (\n')
fprintf(f1,'\t\t\t (0 3 3 0)\n')
fprintf(f1,'\t\t );\n')
fprintf(f1,'\t }\n')
fprintf(f1,');\n\n')
fprintf(f1,'mergePatchPairs\n')
fprintf(f1,'(\n')
fprintf(f1,');\n')
header9='// ************************************************************************* //'
fprintf(f1,'%s\n',header9)
fclose(f1)

BlockMeshg File Created for Symmetry Boundary Condition :

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
	 (0 0 0)
	 (0 1.992389e-03 1.743115e-04)
	 (0 1.992389e-03 -1.743115e-04)
	 (1.204000e+00 0 0)
	 (1.204000e+00 1.992389e-03 1.743115e-04)
	 (1.204000e+00 1.992389e-03 -1.743115e-04)
);

blocks
(
	 hex (0 3 5 2 0 3 4 1) (300 30 1) simpleGrading (1 0.1 1)
);

edges
(
	 arc 1 2 (0 2.000000e-03 0)
	 arc 4 5 (1.204000e+00 2.000000e-03 0)
);

boundary
(
	 inlet 
	 {
		 type patch;
		 faces
		 (
			 (0 1 2 0)
		 );
	 }
	 outlet 
	 {
		 type patch;
		 faces
		 (
			 (3 5 4 3)
		 );
	 }
	 top 
	 {
		 type wall;
		 faces
		 (
			 (1 4 5 2)
		 );
	 }
	 front 
	 {
		 type symmetry;
		 faces
		 (
			 (0 3 4 1)
		 );
	 }
	 back 
	 {
		 type symmetry;
		 faces
		 (
			 (0 2 5 3)
		 );
	 }
	 axis 
	 {
		 type empty;
		 faces
		 (
			 (0 3 3 0)
		 );
	 }
);

mergePatchPairs
(
);

// ************************************************************************* //

BlockMesh Created for Wedge B.C.

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
      format 	 ascii;
       class 	 dictionary;
      object 	  blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
	 (0 0 0)
	 (0 1.847759e-03 7.653669e-04)
	 (0 1.847759e-03 -7.653669e-04)
	 (1.204000e+00 0 0)
	 (1.204000e+00 1.847759e-03 7.653669e-04)
	 (1.204000e+00 1.847759e-03 -7.653669e-04)
);

blocks
(
	 hex (0 3 5 2 0 3 4 1) (300 30 1) simpleGrading (1 0.1 1)
);

edges
(
	 arc 1 2 (0 2.000000e-03 0)
	 arc 4 5 (1.204000e+00 2.000000e-03 0)
);

boundary
(
	 inlet 
	 {
		 type patch;
		 faces
		 (
			 (0 1 2 0)
		 );
	 }
	 outlet 
	 {
		 type patch;
		 faces
		 (
			 (3 5 4 3)
		 );
	 }
	 top 
	 {
		 type wall;
		 faces
		 (
			 (1 4 5 2)
		 );
	 }
	 front 
	 {
		 type wedge;
		 faces
		 (
			 (0 3 4 1)
		 );
	 }
	 back 
	 {
		 type wedge;
		 faces
		 (
			 (0 2 5 3)
		 );
	 }
	 axis 
	 {
		 type empty;
		 faces
		 (
			 (0 3 3 0)
		 );
	 }
);

mergePatchPairs
(
);
// ************************************************************************* //

Mesh Created :

Mesh for wedge angle 10 degree :

Mesh for wedge angle 25 degree :

Mesh Created for wedge angle of 45 degree :

Velocity Profile ;

Shear Stress :

Pressure :

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.