Challenge

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

Expected Results :

Code in Matlab to automate the generation of blockMeshDict file.

  1. Validate Hydro-dynamic length with the numerical result .
  2. Validate the fully developed flow velocity profile with its analytical profile .
  3. Validate maximum velocity and pressured drop for fully developed flow .
  4. Post-process Shear stress and validate wall shear stress for fully developed flow .
  5. Highligh the differences in both boundary conditions in terms of their usage and aplication .

Angles to test :

`10^o`

`25^o`

`45^o`

Boundary conditions :

  1. wedge
  2. symmetry

Assumptions :
1 . Diameter of the pipe : 0.02m .
2 . Wedge angle : `theta`: 10,25,45 degrees .
3 . Working fluid medium : Water .
4 . Temprature of water : 20 degrees .
Density(at 20deg C) : `rho`=998.23 kg/m^3
Dynamic viscosity(at 20deg C) : `mu`=0.001002 kg/m.s
Kinematic viscosity(at 20deg C) : `nu`=0.000001002 m^2/s
5 . Axi-symmetric flow & laminar and flows through a constant cross-section pipe at an inlet Reynold's number of 2100 .

Formulas for simulating Hagen-Poiseuille flow in a pipe :

  1. Pressure change : `DeltaP=(32muoverlineu(L-L_e))/D^2`
  2. Entry length :`L_e=0.06*Re*D`
  3. Length of pipe :`L =0.5+L_e`
  4. Kinematic pressure : `(DeltaP)/rho_(at T^oC)`
  5. Average fluid velocity : `V_(avg)=overlineV=(Re*mu)/(rho*D)`
  6. Shear stress : `tau=-mu(du)/(dy)`

Pipe geometry :


Vertices :

Y distance :
Cosider angle `theta/2`
`cos(theta/2)=(1A)/R`
`R*cos(theta/2)=1A`= Vertical component
X distance :
Cosider angle `theta/2`
`sin(theta/2)=(0A)/R`
`R*sin(theta/2)=0A` = Horizontal component

Solver :


Code :
Change the boundary types to wedge and symmetry according to needs of simulation .

clear all 
close all
clc

Re=2100;
% Conidering standard room temprature of water as 20 degree celcius
rho=998.23;  %density(kg/m^3)at 20deg C
mu=0.001002;   %dynamic viscosity(kg/m.s)at 20deg C
v=0.000001002;  %kinematic viscosity(m^2/s)at 20deg C
prompt = 'Diameter of the pipe?';
D = input(prompt)
Le=0.06*Re*D
% total length of pipe 
L=0.5+Le;
% angle of wedge 
prompt = 'What is the angle? ';
theta = input(prompt)

a=(D/2)*sind(theta/2);
b=(D/2)*cosd(theta/2);

v0=[0,0,0];
v1=[0,-a,b];
v2=[0,a,b]; 
v3=[L,0,0];
v4=[L,-a,b];
v5=[L,a,b];

f1=fopen('blockMeshDict.txt','w')

fprintf(f1,'%s \n','/*--------------------------------*- C++ -*----------------------------------*\');
fprintf(f1,'%s \n','  =========                 |');
fprintf(f1,'%s \n','  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox');
fprintf(f1,'%s \n','   \\    /   O peration     | Website:  https://openfoam.org');
fprintf(f1,'%s \n','    \\  /    A nd           | Version:  8');
fprintf(f1,'%s \n','     \\/     M anipulation  |');
fprintf(f1,'%s \n','\*---------------------------------------------------------------------------*/');
fprintf(f1,'%s \n','FoamFile');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','    version     2.0;');
fprintf(f1,'%s \n','    format      ascii;');
fprintf(f1,'%s \n','    class       dictionary;');
fprintf(f1,'%s \n','    object      blockMeshDict;');
fprintf(f1,'%s \n','}');
fprintf(f1,'%s \n','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //');

% for one line space
fprintf(f1,'\n');
fprintf(f1,'%s \n','convertToMeters 1;');

fprintf(f1,'\n');
fprintf(f1,'%s \n','vertices');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%f %f %f)\n',v0(1),v0(2),v0(3));
fprintf(f1,'(%f %f %f)\n',v1(1),v1(2),v1(3));
fprintf(f1,'(%f %f %f)\n',v2(1),v2(2),v2(3));
fprintf(f1,'(%f %f %f)\n',v3(1),v3(2),v3(3));
fprintf(f1,'(%f %f %f)\n',v4(1),v4(2),v4(3));
fprintf(f1,'(%f %f %f)\n',v5(1),v5(2),v5(3));
fprintf(f1,');');
fprintf(f1,'\n');

fprintf(f1,'\nblocks \n');
fprintf(f1,'%s \n','(');
% fprintf(f1,'%s \n','hex(2 1 0 2 5 4 3 5) (1 20 20) simpleGrading (1 1 1)');
% fprintf(f1,'%s \n','hex (0 3 3 0 1 4 5 2) (400 1 20) simpleGrading (1 1 1)');
fprintf(f1,'%s \n','hex (0 3 3 0 1 4 5 2) (400 1 20) simpleGrading ');
fprintf(f1,'%s \n','('); 
fprintf(f1,'%s \n','('); 
fprintf(f1,'%s \n','(20 30 4)');   
fprintf(f1,'%s \n','(60 40 1)');    
fprintf(f1,'%s \n','(20 30 0.25)');
fprintf(f1,'%s \n',')');
fprintf(f1,'%s \n','1');
fprintf(f1,'%s \n','0.25');
fprintf(f1,'%s \n',')');
fprintf(f1,');');
fprintf(f1,'\n');

fprintf(f1,'\nedges \n');
fprintf(f1,'%s \n','(');
% '%d' is used to represent integers
fprintf(f1,'arc %d %d (%d %d %d)\n',1,2,v2(1),v2(2),v2(3));
fprintf(f1,'arc %d %d (%d %d %d)\n',4,5,v5(1),v5(2),v5(3));
fprintf(f1,');');
fprintf(f1,'\n');

fprintf(f1,'\nboundary \n');
fprintf(f1,'%s \n','(');
% inlet
fprintf(f1,'inlet');
fprintf(f1,'\n');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s','type patch;');
fprintf(f1,'\nfaces');
fprintf(f1,'\n');
fprintf(f1,'%s \n','(');
fprintf(f1,'(0 1 2 0)\n');
fprintf(f1,');');
fprintf(f1,'\n');
fprintf(f1,'}');
fprintf(f1,'\n');
% outlet
fprintf(f1,'outlet');
fprintf(f1,'\n');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s','type patch;');
fprintf(f1,'\nfaces');
fprintf(f1,'\n');
fprintf(f1,'%s \n','(');
fprintf(f1,'(3 5 4 3)\n');
fprintf(f1,');');
fprintf(f1,'\n');
fprintf(f1,'}');
fprintf(f1,'\n');
% front 
fprintf(f1,'front');
fprintf(f1,'\n');
fprintf(f1,'%s \n','{');
% fprintf(f1,'%s','type wedge;');
fprintf(f1,'%s','type symmetry;');
fprintf(f1,'\nfaces');
fprintf(f1,'\n');
fprintf(f1,'%s \n','(');
fprintf(f1,'(0 3 4 1)\n');
fprintf(f1,');');
fprintf(f1,'\n');
fprintf(f1,'}');
fprintf(f1,'\n');
% back
fprintf(f1,'back');
fprintf(f1,'\n');
fprintf(f1,'%s \n','{');
% fprintf(f1,'%s','type wedge;');
fprintf(f1,'%s','type symmetry;');
fprintf(f1,'\nfaces');
fprintf(f1,'\n');
fprintf(f1,'%s \n','(');
fprintf(f1,'(0 2 5 3)\n');
fprintf(f1,');');
fprintf(f1,'\n');
fprintf(f1,'}');
fprintf(f1,'\n');
% axis
fprintf(f1,'axis');
fprintf(f1,'\n');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s','type empty;');
fprintf(f1,'\nfaces');
fprintf(f1,'\n');
fprintf(f1,'%s \n','(');
fprintf(f1,'(0 3 3 0)\n');
fprintf(f1,');');
fprintf(f1,'\n');
fprintf(f1,'}');
fprintf(f1,'\n');
% top
fprintf(f1,'top');
fprintf(f1,'\n');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s','type wall;');
fprintf(f1,'\nfaces');
fprintf(f1,'\n');
fprintf(f1,'%s \n','(');
fprintf(f1,'(1 4 5 2)\n');
fprintf(f1,');');
fprintf(f1,'\n');
fprintf(f1,'}');
fprintf(f1,'\n');
fprintf(f1,'%s \n',');');

fprintf(f1,'\n');
fprintf(f1,'mergePatchPairs');
fprintf(f1,'\n(');
fprintf(f1,'\n);');
fprintf(f1,'\n// ************************************************************************* //');

Common files for wedge and symmetry simulations in openfoam :

controlDict file :

Calculation to determine endTime :

This is very important for endTime to be suffeciently large because it allows the fluid to pass through the entire section of the pipe

Velocity = Distance / Time
Time = Distance / Velocity
Distance from inlet to outlet of the pipe section : 3.02m
We know that velocity calculated is 0.1054 m/s from calculation
Time = 3.02/0.1054
= 28.64 s
So for the flow to completely pass through the pipe we need to give double or triple the amount of time given for the simulation to take place .
Hence 58s is used as endTime for the flow to take place from end to end length of the pipe .

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

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         58;

deltaT          0.01;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

transportProperties :

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

nu              [0 2 -1 0 0 0 0] 1.002E-06;


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

wedge files from openfoam :

pressure file :

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     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;      

    }

    front
    {
        type            wedge;
    }
    back
    {
        type            wedge;
    }
    axis
    {
        type            empty;
    }
    top
    {
        type            zeroGradient;
    }
}

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

velocity file :

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     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.1054 0 0);
    }

    outlet
    {
      	type 		 zeroGradient;
    }

    front
    {
        type            wedge;
    }
    back
    {
        type            wedge;
    }
    axis
    {
        type            empty;
    }
    top
    {
        type            noSlip;
    }
}

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

blockMeshDict file 10 degree wedge :

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

convertToMeters 1; 

vertices 
( 
(0.000000 0.000000 0.000000)
(0.000000 -0.000872 0.009962)
(0.000000 0.000872 0.009962)
(3.020000 0.000000 0.000000)
(3.020000 -0.000872 0.009962)
(3.020000 0.000872 0.009962)
);

blocks 
( 
hex (0 3 3 0 1 4 5 2) (400 1 20) simpleGrading  
( 
( 
(20 30 4) 
(60 40 1) 
(20 30 0.25) 
) 
1 
0.25 
) 
);

edges 
( 
arc 1 2 (0 8.715574e-04 9.961947e-03)
arc 4 5 (3.020000e+00 8.715574e-04 9.961947e-03)
);

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

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

blockMeshDict file 25 degree wedge :

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

convertToMeters 1; 

vertices 
( 
(0.000000 0.000000 0.000000)
(0.000000 -0.002164 0.009763)
(0.000000 0.002164 0.009763)
(3.020000 0.000000 0.000000)
(3.020000 -0.002164 0.009763)
(3.020000 0.002164 0.009763)
);

blocks 
( 
hex (0 3 3 0 1 4 5 2) (400 1 20) simpleGrading  
( 
( 
(20 30 4) 
(60 40 1) 
(20 30 0.25) 
) 
1 
0.25 
) 
);

edges 
( 
arc 1 2 (0 2.164396e-03 9.762960e-03)
arc 4 5 (3.020000e+00 2.164396e-03 9.762960e-03)
);

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

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

blockMeshDict file 45 degree wedge :

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

convertToMeters 1; 

vertices 
( 
(0.000000 0.000000 0.000000)
(0.000000 -0.003827 0.009239)
(0.000000 0.003827 0.009239)
(3.020000 0.000000 0.000000)
(3.020000 -0.003827 0.009239)
(3.020000 0.003827 0.009239)
);

blocks 
( 
hex (0 3 3 0 1 4 5 2) (400 1 20) simpleGrading  
( 
( 
(20 30 4) 
(60 40 1) 
(20 30 0.25) 
) 
1 
0.25 
) 
);

edges 
( 
arc 1 2 (0 3.826834e-03 9.238795e-03)
arc 4 5 (3.020000e+00 3.826834e-03 9.238795e-03)
);

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

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

symmetry files from openfoam :

pressure file :

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     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;      

    }

    front
    {
	type            symmetry;
    }
    back
    {
	type            symmetry;
    }
    axis
    {
        type            empty;
    }
    top
    {
        type            zeroGradient;
    }
}

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

velocity file :

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     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.1054 0 0);
    }

    outlet
    {
      	type 		 zeroGradient;
    }

    front
    {
        //type            wedge;
	type            symmetry;
    }
    back
    {
        //type            wedge;
	type            symmetry;
    }
    axis
    {
        type            empty;
    }
    top
    {
        type            noSlip;
    }
}

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

blockMeshDict file 10 degree symmetry :

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

convertToMeters 1; 

vertices 
( 
(0.000000 0.000000 0.000000)
(0.000000 -0.000872 0.009962)
(0.000000 0.000872 0.009962)
(3.020000 0.000000 0.000000)
(3.020000 -0.000872 0.009962)
(3.020000 0.000872 0.009962)
);

blocks 
( 
hex (0 3 3 0 1 4 5 2) (400 1 20) simpleGrading  
( 
( 
(20 30 4) 
(60 40 1) 
(20 30 0.25) 
) 
1 
0.25 
) 
);

edges 
( 
arc 1 2 (0 8.715574e-04 9.961947e-03)
arc 4 5 (3.020000e+00 8.715574e-04 9.961947e-03)
);

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

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

blockMeshDict file 25 degree symmetry :

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

convertToMeters 1; 

vertices 
( 
(0.000000 0.000000 0.000000)
(0.000000 -0.002164 0.009763)
(0.000000 0.002164 0.009763)
(3.020000 0.000000 0.000000)
(3.020000 -0.002164 0.009763)
(3.020000 0.002164 0.009763)
);

blocks 
( 
hex (0 3 3 0 1 4 5 2) (400 1 20) simpleGrading  
( 
( 
(20 30 4) 
(60 40 1) 
(20 30 0.25) 
) 
1 
0.25 
) 
);

edges 
( 
arc 1 2 (0 2.164396e-03 9.762960e-03)
arc 4 5 (3.020000e+00 2.164396e-03 9.762960e-03)
);

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

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

blockMeshDict file 45 degree symmetry :

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

convertToMeters 1; 

vertices 
( 
(0.000000 0.000000 0.000000)
(0.000000 -0.003827 0.009239)
(0.000000 0.003827 0.009239)
(3.020000 0.000000 0.000000)
(3.020000 -0.003827 0.009239)
(3.020000 0.003827 0.009239)
);

blocks 
( 
hex (0 3 3 0 1 4 5 2) (400 1 20) simpleGrading  
( 
( 
(20 30 4) 
(60 40 1) 
(20 30 0.25) 
) 
1 
0.25 
) 
);

edges 
( 
arc 1 2 (0 3.826834e-03 9.238795e-03)
arc 4 5 (3.020000e+00 3.826834e-03 9.238795e-03)
);

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

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

Geometry :

Mesh :

Middle section


Right section


Left section



10 degree :



25 degree :



45 degree :


Post processing help for plotting shear stress on openfoam
https://skill-lync.freshdesk.com/support/solutions/articles/43000570187-how-to-create-shear-stress-plot-inside-paraview-

Wedge boundary :

Velocity :



Velocity at fully developed length : 10 degrees wedge boundary

Velocity at fully developed length : 25 degrees wedge boundary

Velocity at fully developed length : 45 degrees wedge boundary

Kinematic pressure :


Kinematic pressure at fully developed length : 10 degrees wedge boundary


Kinematic pressure at fully developed length : 25 degrees wedge boundary

Kinematic pressure at fully developed length : 45 degrees wedge boundary

Shear stress :

Shear stress at fully developed length : 10 degrees wedge boundary

Shear stress at fully developed length : 25 degrees wedge boundary

Shear stress at fully developed length : 45 degrees wedge boundary

Symmetry boundary :

Velocity :

Velocity at fully developed length : 10 degrees symmetric boundary

Velocity at fully developed length : 25 degrees symmetric boundary

Velocity at fully developed length : 25 degrees symmetric boundary

Kinematic pressure :


Kinematic pressure at fully developed length : 10 degrees symmetric boundary


Kinematic pressure at fully developed length : 25 degrees symmetric boundary


Kinematic pressure at fully developed length : 45 degrees symmetric boundary

Shear stress :



Shear stress at fully developed length : 10 degrees symmetric boundary

Shear stress at fully developed length : 25 degrees symmetric boundary

Shear stress at fully developed length : 45 degrees symmetric boundary

Code to compare plots in a single graph :

clear all
close all
clc

% importing data generated from openfoam

% wedge

% pressure
p_10_w=importdata('p_wedge_10.txt');
p_10_w_x=p_10_w(:,1);
p_10_w_y=p_10_w(:,2);

p_25_w=importdata('p_wedge_25.txt');
p_25_w_x=p_25_w(:,1);
p_25_w_y=p_25_w(:,2);

p_45_w=importdata('p_wedge_45.txt');
p_45_w_x=p_45_w(:,1);
p_45_w_y=p_45_w(:,2);

% velocity
v_10_w=importdata('v_wedge_10.txt');
v_10_w_x=v_10_w(:,1);
v_10_w_y=v_10_w(:,2);

v_25_w=importdata('v_wedge_25_3m.txt');
v_25_w_x=v_25_w(:,1);
v_25_w_y=v_25_w(:,2);

v_45_w=importdata('v_wedge_45_3m.txt');
v_45_w_x=v_45_w(:,1);
v_45_w_y=v_45_w(:,2);

% shear stress
tau_10_w=importdata('tau_wedge_10.txt');
tau_10_w_x=tau_10_w(:,1);
tau_10_w_y=tau_10_w(:,2);

tau_25_w=importdata('tau_wedge_25_3m.txt');
tau_25_w_x=tau_25_w(:,1);
tau_25_w_y=tau_25_w(:,2);

tau_45_w=importdata('tau_wedge_45_3m.txt');
tau_45_w_x=tau_45_w(:,1);
tau_45_w_y=tau_45_w(:,2);

% symmetry

% pressure
p_10_s=importdata('p_10_sym_3m.txt');
p_10_s_x=p_10_s(:,1);
p_10_s_y=p_10_s(:,2);

p_25_s=importdata('p_25_sym_3m.txt');
p_25_s_x=p_25_s(:,1);
p_25_s_y=p_25_s(:,2);

p_45_s=importdata('p_sym_45_3m.txt');
p_45_s_x=p_45_s(:,1);
p_45_s_y=p_45_s(:,2);

% velocity
v_10_s=importdata('v_10_sym_3m.txt');
v_10_s_x=v_10_s(:,1);
v_10_s_y=v_10_s(:,2);

v_25_s=importdata('v_25_sym_3m.txt');
v_25_s_x=v_25_s(:,1);
v_25_s_y=v_25_s(:,2);

v_45_s=importdata('v_sym_45_3m.txt');
v_45_s_x=v_45_s(:,1);
v_45_s_y=v_45_s(:,2);

% shear stress
tau_10_s=importdata('tau_10_sym_3m.txt');
tau_10_s_x=tau_10_s(:,1);
tau_10_s_y=tau_10_s(:,2);

tau_25_s=importdata('tau_25_sym_3m.txt');
tau_25_s_x=tau_25_s(:,1);
tau_25_s_y=tau_25_s(:,2);

tau_45_s=importdata('tau_sym_45_3m.txt');
tau_45_s_x=tau_45_s(:,1);
tau_45_s_y=tau_45_s(:,2);

% Generating analytical data from formula 
% pressure
mu=1.002*10^(-3);
v_mean=0.1054;
Lt=3.02;
Le=2.52;
L=Lt-Le;
p_x=linspace(0,L,1001);
D=0.02;
rho=998.23;

for i=1:length(p_x)
p(i)=(32*mu*v_mean*p_x(i))/(0.02)^2;
p_kinematic(i)=p(i)/rho;
end
p_kinematic_y = fliplr(p_kinematic);

dr=linspace(0,0.01,1001);
R=D/2;
% velocity
vmax=0.2107;
u_mag=vmax*(1-(dr.^2./R^2));
% shear stress
for i=2:length(dr)
du(i)=u_mag(i-1)-u_mag(i);
ddr(i)=dr(i-1)-dr(i);
tau(i)=-0.001002*du(i-1)/ddr(i-1);
end


figure(1)
% symmetric shear stress
plot(dr,tau,'b','LineWidth',2)
hold on
plot(tau_10_s_x,tau_10_s_y,'r','LineWidth',2)
hold on
plot(tau_25_s_x,tau_25_s_y,'g','LineWidth',2)
hold on
plot(tau_45_s_x,tau_45_s_y,'k','LineWidth',2)
xlabel('Radial distance (m)')
ylabel('Shear stress magnitude (N/m^2)')
legend('Analytical shear stress','shear stress 10 degrees','shear stress 25 degrees','shear stress 45 degrees')
title('shear stress symmetric boundary')

figure(2)
% wedge shear stress
plot(dr,tau,'b','LineWidth',2)
hold on
plot(tau_10_w_x,tau_10_w_y,'r','LineWidth',2)
hold on
plot(tau_25_w_x,tau_25_w_y,'g','LineWidth',2)
hold on
plot(tau_45_w_x,tau_45_w_y,'k','LineWidth',2)
xlabel('Radial distance (m)')
ylabel('Shear stress magnitude (N/m^2)')
legend('Analytical shear stress','shear stress 10 degrees','shear stress 25 degrees','shear stress 45 degrees')
title('shear stress wedge boundary')

% pressure 
figure(3)
% symmetric kinematic pressure
plot(p_x,p_kinematic_y,'b','LineWidth',2)
hold on
plot(p_10_s_x,p_10_s_y,'r','LineWidth',2)
hold on
plot(p_25_s_x,p_25_s_y,'g','LineWidth',2)
hold on
plot(p_45_s_x,p_45_s_y,'k','LineWidth',2)
xlabel('length of developed flow (m)')
ylabel('Kinematic pressure (m^2/s^2)')
legend('Analytical kinematic pressure','kinematic pressure 10 degrees','kinematic pressure 25 degrees','kinematic pressure 45 degrees')
title('Kinematic pressure symmetric boundary')

figure(4)
% wedge kinematic pressure
plot(p_x,p_kinematic_y,'b','LineWidth',2)
hold on
plot(p_10_w_x,p_10_w_y,'r','LineWidth',2)
hold on
plot(p_25_w_x,p_25_w_y,'g','LineWidth',2)
hold on
plot(p_45_w_x,p_45_w_y,'k','LineWidth',2)
xlabel('length of developed flow (m)')
ylabel('Kinematic pressure (m^2/s^2)')
legend('Analytical kinematic pressure','kinematic pressure 10 degrees','kinematic pressure 25 degrees','kinematic pressure 45 degrees')
title('Kinematic pressure wedge boundary')

% velocity
figure(5)
% symmetric velocity
plot(dr,u_mag,'b','LineWidth',2)
hold on
plot(v_10_s_x,v_10_s_y,'r','LineWidth',2)
hold on
plot(v_25_s_x,v_25_s_y,'g','LineWidth',2)
hold on
plot(v_45_s_x,v_45_s_y,'k','LineWidth',2)
xlabel('radial distance (m)')
ylabel('velocity magnitude (m/s)')
legend('Analytical velocity','Velocity 10 degrees','Velocity 25 degrees','Velocity 45 degrees')
title('Velocity magnitude symmetry boundary')

figure(6)
% wedge velocity
plot(dr,u_mag,'b','LineWidth',2)
hold on
plot(v_10_w_x,v_10_w_y,'r','LineWidth',2)
hold on
plot(v_25_w_x,v_25_w_y,'g','LineWidth',2)
hold on
plot(v_45_w_x,v_45_w_y,'k','LineWidth',2)
xlabel('radial distance (m)')
ylabel('velocity magnitude (m/s)')
legend('Analytical velocity','Velocity 10 degrees','Velocity 25 degrees','Velocity 45 degrees')
title('Velocity magnitude wedge boundary')

Comparison of plots :

Velocity


From the above graph ,we see that the values deviate more with respect to the analytically obtained values with increase in angle .
the wedge of 45 degree angle is farthest away from the analytically obtained values thus proving that the wedge boundary condition only works best when the wedge angle is less than 5 degrees .


From the above graph ,we can see that the numerical values of wedge of 45 degree angle is closest to analytical velocity values initially but as we move away from the center of the pipe the velocity values of the wedge of 25 degree angle slightly overlaps with the analytically obtained values of velocity .

Kinematic pressure


From the above graph ,as the theta value decreases the kinematic pressures tends to overlap over one another conforming to the rule of keeping wedge angle value lesser than 5 degrees to obtain meaningful results .
Here we can also see that the kinematic pressure value of 45 degree wedge is farther away from the actual value .


From the above graph ,we observe that the values of kinematic pressure deviates away from the analytically obtained kinematic pressure with decrease in angle thetas value .
We can clearly see that the kinematic pressure values of 10 degree theta value is farthest away from the analytically obtained kinematic pressure .

Shear stress


In wedge boundary it is ideal to keep theta value lesser than 5 degrees for reasonable results ,this is clearly visible from the above graph
As the values of theta decreases the the numerical shear stress value gets closer to the analytical shear stress value .


Here ,as the angle theta increases the closer does the values of numerical shear stress gets to the analytical value .

Files :

symmetry

Kinematic pressure
https://drive.google.com/file/d/1tBp5Qq5bzW6IAc-dX_T8YIYRPqlTn-wW/view?usp=sharing
https://drive.google.com/file/d/1JpsckEV-IuPgdW-n5worY70F0eEiE6QX/view?usp=sharing
https://drive.google.com/file/d/1JpsckEV-IuPgdW-n5worY70F0eEiE6QX/view?usp=sharing
Velocity
https://drive.google.com/file/d/1v2e7kYoRz0-DIVs5woGK3PWWAo8RYYgq/view?usp=sharing
https://drive.google.com/file/d/1CN6EZrmOKDGjy2mXMAnq24AesCsJp37p/view?usp=sharing
https://drive.google.com/file/d/1CN6EZrmOKDGjy2mXMAnq24AesCsJp37p/view?usp=sharing
Shear stress
https://drive.google.com/file/d/1PwP5stQMZmagop_GCcHT4PdVZ6Hoh5tg/view?usp=sharing
https://drive.google.com/file/d/1fFbmBUCrGQB2SXH_oWG3YPKxp02FLe97/view?usp=sharing
https://drive.google.com/file/d/1o60RAG2EG1nhlv86mgNUrdH8nByXcbw8/view?usp=sharing

wedge

Kinematic pressure
https://drive.google.com/file/d/1Y8yc7zvxA8TWM8KWS8LgD9_cd8_-zQ_k/view?usp=sharing
https://drive.google.com/file/d/1dwg7GgFUFvYt7kVqbiodl8x6-JfZtQzT/view?usp=sharing
https://drive.google.com/file/d/1nNVO-mUXmkRdBtICRpwc5AaOL2GilCA2/view?usp=sharing
Velocity
https://drive.google.com/file/d/14kR3QoFEhEj-Rr84va85Wxh26wVpZxV1/view?usp=sharing
https://drive.google.com/file/d/1pAV06eUY26UJsOGKyqGLt_DmR2jLXtvs/view?usp=sharing
https://drive.google.com/file/d/1as5hl3MsI_3qlNLeEdH7iJCq9FrJg2Bb/view?usp=sharing
Shear stress
https://drive.google.com/file/d/17vfit4uJfkIBVtoNXP9GTlD0IsznDTgb/view?usp=sharing
https://drive.google.com/file/d/1s_c-vV2g-BsgmqQ3fxc64x2cncaRjf34/view?usp=sharing
https://drive.google.com/file/d/1aeZMDcHDhzoT5eAXCXmE82cOlqBoRqph/view?usp=sharing

Conclusion :

Care must be taken while specifying boundary condition on openfoam
Wedge boundary condition seems to be working fine with smaller angles of theta ,it is ideal to keep the theta's value below 5 degrees
The symmetry boundary condition produces better results when the angle theta increases .
It is safe to say that the wedge boundary and symmetry boundary's reguirments are opposite in nature ,the former requires lesser values of theta while the latter requires higher values of theta to produce meaningful results .

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.