Project

Simulation of Flow through a pipe in OpenFoam with Symmetry Boundary Condition

Analysis of simulations of flow through a pipe at different wedge Angles

Introduction

In this part of the project we shall imply symmerty Boundary Conditions at different wedge angle i.e 10, 25, 45 and compare the results. The solver used is icoFoam.

Geometry & Meshing

The Matlab code script remains same as that of previous part of the project except that the Boundary Conditions are symmetry instead of wedges for front and back . Now the Angles chosen are 10, 25 and 45

clear all
close all
clc

% inputs

theta = 10;  % angle of wedge
% theta = 25
% theta = 45
Re = 2100;
D=0.004;
L = 0.06*Re*D; % lenght of the pipe 
R = D/2;
mu = 0.89e-3; % viscosity of water at 25 deg C
rho = 997.0; % Density of water at 25 deg C
nu = mu/rho; % kinematic Viscosity of water at 25 deg C

% Calculatic of pressure and velocity :

v_avg = Re*mu/(D*rho); % Average Velocity 
V_max = 2*v_avg; % Max velocity
del_P = (32*mu*v_avg*L)/(D^2); % pressure Drop
kin_P = del_P/rho; % kinematic Presure Drop

n1 = 50 % Number of cells along the pipe 
n2 = 1 % Number of cells radially 
n3 = 300 % number of cells on the curve
gfactor = 0.2;

% vertices of the wedge 
v0 = [0 0 0 ];
v1 = [0 R*cosd(theta/2) -R*sind(theta/2)];
v2 = [0 R*cosd(theta/2) R*sind(theta/2)];

v3 = [L 0 0];
v4 = [L R*cosd(theta/2) -R*sind(theta/2)];
v5 = [L R*cosd(theta/2) R*sind(theta/2)];

% printing the file
text1 = \'/*-------------------------------*-C++ -*--------------------------------*\';
text2 = \' =========                                                                \';
text3 = \' \\      /  F ield          [ OpenFOAM: The open Source CFD Toolbox        \';
text4 = \'  \\    /   O perations     [ version : 4.1                                \';
text5 = \'   \\  /    A nd            [ Web :   www.openFOAM.org                     \';
text6 = \'    \\/     M anipulation                                                  \';
text7 = \'*-------------------------------------------------------------------------\';

text8 = \'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//\';

% creating file 
f1 = fopen(\'blockMeshDict.txt\',\'wt\');

fprintf(f1,\'%sn\',text1);
fprintf(f1,\'%sn\',text2);
fprintf(f1,\'%sn\',text3);
fprintf(f1,\'%sn\',text4);
fprintf(f1,\'%sn\',text5);
fprintf(f1,\'%sn\',text6);
fprintf(f1,\'%sn\',text7);


fprintf(f1,\'FoamFilen{n\');
fprintf(f1,\'%16s t 2.0;n\',\'versions\');
fprintf(f1,\'%16s t ascii;n\',\'format\');
fprintf(f1,\'%16s t dictionary;n\',\'class\');
fprintf(f1,\'%16s t blockMeshDict;n}n\',\'object\');
fprintf(f1,\'%snn\', text8);

fprintf(f1,\'convertToMeters 1;nn\');
fprintf(f1,\'verticesn(n\');
fprintf(f1,\'t(%d %d %d)n\',v0(1),v0(2),v0(3));
fprintf(f1,\'t(%d %d %d)n\',v1(1),v1(2),v1(3));
fprintf(f1,\'t(%d %d %d)n\',v2(1),v2(2),v2(3));
fprintf(f1,\'t(%d %d %d)n\',v3(1),v3(2),v3(3));
fprintf(f1,\'t(%d %d %d)n\',v4(1),v4(2),v4(3));
fprintf(f1,\'t(%d %d %d)n);nn\',v5(1),v5(2),v5(3));

fprintf(f1,\'blocksn(n\');
fprintf(f1,\'t hex (0 1 2 0 3 4 5 3)(%d %d %d)\',n1,n2,n3);
fprintf(f1,\' simpleGrading (%0.1f 1 1)n);nn\',gfactor); 

fprintf(f1,\'edgesn(ntarc %d %d (%d %0.2f %d)ntarc %d %d (%0.2f %0.2f %d)n);nn\', 1, 2, 0, R, 0, 4, 5, L, R, 0);

fprintf(f1,\'boundaryn(n\');
fprintf(f1,\'t%snt{ntt type %s,ntt Faces ntt (ntt (%d %d %d %d) ntt );nt}nn\',\'axis\',\'empty\',0,3,3,0);
fprintf(f1,\'t%snt{ntt type %s,ntt Faces ntt (ntt (%d %d %d %d) ntt );nt}nn\',\'inlet\',\'patch\',0,1,2,0);
fprintf(f1,\'t%snt{ntt type %s,ntt Faces ntt (ntt (%d %d %d %d) ntt );nt}nn\',\'pipe\',\'wall\',1,4,5,2);
fprintf(f1,\'t%snt{ntt type %s,ntt Faces ntt (ntt (%d %d %d %d) ntt );nt}nn\',\'outlet\',\'patch\',3,4,5,3);
fprintf(f1,\'t%snt{ntt type %s,ntt Faces ntt (ntt (%d %d %d %d) ntt );nt}nn\',\'front\',\'wedge\',0,3,5,2);
fprintf(f1,\'t%snt{ntt type %s,ntt Faces ntt (ntt (%d %d %d %d) ntt );nt}nn\',\'back\',\'wedge\',0,1,4,3);
fprintf(f1,\');nn\');

fprintf(f1,\'mergePatchPairsn(n);nn\');
fprintf(f1,\'%s\',text8);

fclose(f1);

Block-mesh dict at theta 10 Degree


/*--------------------------------*- 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;
    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
(
    axis
    {
        type empty;
        faces
        (
            (0 3 3 0)
        );
    }
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }
    top
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }
     outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }
     front
    {
        type symmetry;
        faces
        (
            (0 3 4 1)
        );
    }
     back
    {
        type symmetry;
        faces
        (
            (0 2 5 3)
        );
    }
    
);

mergePatchPairs
(
);

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



block-Mesh at theta 25 Degree


/*--------------------------------*- 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;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
    (0 0 0)
    (0 1.952592e-03 4.328792e-04)
    (0 1.952592e-03 -4.328792e-04)
    (1.204000e+00 0 0)
    (1.204000e+00  1.952592e-03 4.328792e-04)
    (1.204000e+00  1.952592e-03 -4.328792e-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
(
    axis
    {
        type empty;
        faces
        (
            (0 3 3 0)
        );
    }
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }
    top
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }
     outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }
     front
    {
        type symmetry;
        faces
        (
            (0 3 4 1)
        );
    }
     back
    {
        type symmetry;
        faces
        (
            (0 2 5 3)
        );
    }
    
);

mergePatchPairs
(
);

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



block-Mesh dict at theta 45 degrees   

/*--------------------------------*- 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;
    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
(
    axis
    {
        type empty;
        faces
        (
            (0 3 3 0)
        );
    }
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }
    top
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }
     outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }
     front
    {
        type symmetry;
        faces
        (
            (0 3 4 1)
        );
    }
     back
    {
        type symmetry;
        faces
        (
            (0 2 5 3)
        );
    }
    
);

mergePatchPairs
(
);

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








Boundary conditions

the boundary condition remains the same except that the wedge are now symmetry.
pressure and velocity for angle 10 is shown below, same is applicabe for other angle

blockmesh at 10 angle

blockMesh at 25 angle

blockMesh at 45 angle

comparison of velocity profile at outlet

Pressure counter

Pressure Drop


pressure is linear for most of the part but is slightly non linear at the beginning due to the Fact that flow in non developed.
The pressue drop increases as the angle increase.

Wall shear stress

it can be seen that the minimum and maximum value of courant number increases with increase in the angle

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.