Symmetry vs Wedge vs HP equation

Objectives:

  • To Write a Matlab program that can generate the computational blockMesh file  automatically for a wedge angle of 3 degrees and compare the results obtained for Symmetry BC and Wedge BC.
  • To Write a Matlab program that takes an angle as input and generates a blockMesh file for the given angle(i.e., 10, 25, 45) and compare the results obtained for these different wedge angles.

CASE A:  Compare the results for Symmetry BC and Wedge BC.

Wedge angle = 3

Boundary conditions for front and back faces are Symmetry.

MATLAB PROGRAM: To generate blockMeshDict file for 3 degrees using file parsing technique

clear all
close all
clc

%% Input data for analysis of flow

% Diameter of the pipe in m
D = 0.02;
% Radius of the pipe in m
R = D/2;
% Reynolds number
Re = 2100
% Entrance Length in m
L_e = 0.06*Re*D;
% Total length of the pipe in m
L = 0.3 + L_e
% wedge angle in degree
theta =  3;
% Dynamic viscosity of water at 25 deg. Cel. in Ns/m^2
mu = 8.9e-4; 
% Density of water at 25 deg. Cel. in kg/m^3
rho = 997.130
% kinematic viscosity of water at 25 deg. Cel. in m^2/s
nu = mu/rho

%% calculating the solution according to Hagen-Poiseuille's flow equation
% Average velocity
V = (Re*mu)/(rho*D)
% Maximum velocity 
u_max = 2*V
% pressure gradient
del_pdel_x = (8*mu*V)/(R^2)
% Pressure drop
delta_p = (8*mu*V*L)/(R^2)
% kinematic pressure 
kin_pressure = delta_p/rho

% vertices
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)];

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: 7                                     ');
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\n', '//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//');
fprintf(f1, '%s\n\n', 'convertToMeters 1;');

% Defining the vertices of the geometry
fprintf(f1, '%s\n','vertices');
fprintf(f1, '%s\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',v5(1),v5(2),v5(3));
fprintf(f1, '%s\n\n',');');

% Defining the blocks
fprintf(f1, '%s\n', 'blocks');
fprintf(f1, '%s\n','(');
fprintf(f1, '\thex (0 1 2 0 3 4 5 3) (%d %d %d) simpleGrading (1 1 1)\n',200,1,25);
fprintf(f1, '%s\n\n',');');

% Defining the edges
fprintf(f1, '%s\n', 'edges');
fprintf(f1, '%s\n','(');
fprintf(f1, '\tarc %d %d (%d %d %d)\n', 1,2,0,R,0);
fprintf(f1, '\tarc %d %d (%d %d %d)\n', 4,5,L,R,0);
fprintf(f1, '%s\n\n',');');

% Defining the boundaries
fprintf(f1, '%s\n', 'boundary');
fprintf(f1, '%s\n', '(');
fprintf(f1, '\tinlet\n\t{\n');
fprintf(f1, '\t\ttype patch;\n');
fprintf(f1, '\t\tfaces\n\t\t(\n');
fprintf(f1, '\t\t\t(0 2 1 0)\n');
fprintf(f1, '\t\t);\n\t}\n');
fprintf(f1, '\toutlet\n\t{\n');
fprintf(f1, '\t\ttype patch;\n');
fprintf(f1, '\t\tfaces\n\t\t(\n');
fprintf(f1, '\t\t\t(3 4 5 3)\n');
fprintf(f1, '\t\t);\n\t}\n');
fprintf(f1, '\twedge_front\n\t{\n');
fprintf(f1, '\t\ttype symmetry;\n');
fprintf(f1, '\t\tfaces\n\t\t(\n');
fprintf(f1, '\t\t\t(0 3 5 2)\n');
fprintf(f1, '\t\t);\n\t}\n');
fprintf(f1, '\twedge_back\n\t{\n');
fprintf(f1, '\t\ttype symmetry;\n');
fprintf(f1, '\t\tfaces\n\t\t(\n');
fprintf(f1, '\t\t\t(0 1 4 3)\n');
fprintf(f1, '\t\t);\n\t}\n');
fprintf(f1, '\ttop\n\t{\n');
fprintf(f1, '\t\ttype wall;\n');
fprintf(f1, '\t\tfaces\n\t\t(\n');
fprintf(f1, '\t\t\t(1 2 5 4)\n');
fprintf(f1, '\t\t);\n\t}\n');
fprintf(f1, '\taxis\n\t{\n');
fprintf(f1, '\t\ttype empty;\n');
fprintf(f1, '\t\tfaces\n\t\t(\n');
fprintf(f1, '\t\t\t(0 3 3 0)\n');
fprintf(f1, '\t\t);\n\t}\n');
fprintf(f1, ');\n\n');
fprintf(f1, 'mergePatchPairs\n(\n);\n\n');
fprintf(f1, '//**************************************************************************//');
fclose(f1)

PREPROCESSING:

  • First, input all the data in matlab by defining the Reynolds number, Diameter of pipe, wedge angle, dynamic viscosity and density.
  • Then Entry length, total length and Kinematic viscosity formulae are mentioned for a fluid flow.
  • Entry length is calculated for finding out the fully developed laminar fluid flow in the pipe.
  •  Average velocity, maximum velocity, pressure gradient, pressure drop and kinematic pressure formulae are also mentioned for the given fluid flow.
  • Rather than considering the whole cylinder, reduced cylinder of wedge shape geometry is made to reduce the computational time. but, it gives the results through which the entire cylinder perfomance can be predicted.
  • Now write a program to create blockMeshDict file for wedge angles 3 degrees using parsing technique.
  • Define Boundary as symmetry type for wedge front and wedge back. 
  • In openFoam, create a copy of cavity case from tutorials/incompressible/icoFoam/cavity to run directory as cavity_test.
  • The BlockMesh file which is generated in matlab is copied in the system folder of the case setup.
  • Edit the controlDict file, within the same system directory, by setting up the end time and time step, deltaT for simulation.
  • Now set the initial condition for pressure and velocity. For this go to ''0'' folder located in the cavity folder. In this folder there are two files one file is pressure file, 'p' and other file is velocity, 'U'.
  • Edit the pressure file, 'p' and set the pressure by the user defined value at outlet, and edit the wedge_front and wedge_back type as symmetry, top type as zeroGradient, axis type as empty. 
  • Now, edit the velocity file, 'U' and set the velocity at inlet, at internal fields and edit the wedge_front and wedge_back type as symmetry, top type as zeroGradient, axis type as empty. 
  • Edit the transportProperties from the constant folder, by mentioning it with a kinematic viscosity. 
  • Now the case is fully set up.
  • Now generate the mesh file. To do that type 'blockMesh' in the command terminal and execute it.
  • After mesh generation, do type 'checkMesh'  in the command terminal and execute it, to check mesh of geometry is free from errors.
  • After mesh check run the 'icoFoam' solver in the terminal.
  • After running the solver the data is to be post processed. For this the paraFoam command is used in the command terminal and execute it for postprocessing the results.

OpenFoam blockMeshDict file generated by the above matlab code

/*---------------------------------*- 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 9.996573e-03 -2.617695e-04)
	(0 9.996573e-03 2.617695e-04)
	(2.820000e+00 0 0)
	(2.820000e+00 9.996573e-03 -2.617695e-04)
	(2.820000e+00 9.996573e-03 2.617695e-04)
);

blocks
(
	hex (0 1 2 0 3 4 5 3) (200 1 25) simpleGrading (1 1 1)
);

edges
(
	arc 1 2 (0 1.000000e-02 0)
	arc 4 5 (2.820000e+00 1.000000e-02 0)
);

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

mergePatchPairs
(
);

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

OpenFoam pressure file:

/*--------------------------------*- 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.0188715;
    }

    wedge_front
    {
        type            symmetry;
    }

    wedge_back
    {
        type            symmetry;
    }

    top
    {
        type            zeroGradient;
    }

    axis
    {
        type            empty;
    }
}

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

OpenFoam velocity file:

/*--------------------------------*- 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.0937 0 0);

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform (0.0937 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }

    wedge_front
    {
        type            symmetry;
    }

    wedge_back
    {
        type            symmetry;
    }

    top
    {
        type            noSlip;
    }

    axis
    {
        type            empty;
    }
}


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

OpenFoam controlDict file:

/*--------------------------------*- 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         10;

deltaT          0.0001;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

OpenFoam transportProperties file:

/*--------------------------------*- 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.9256e-07;


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

Reduced Geometry of Pipe(i.e., symmetry):

YZ plane:

XY plane:

XZ plane:

POSTPROCESSING:

  • After opening the Paraview, click on Apply to generate the geometry model.
  • Then press play to postprocess the results for maximum time.   
  • After the model generation, just reflect the geometry about xz plane then, click on plot over line, enter the coordinates of the line, for plotting the properties(Velocity, pressure) with respect to length and radial distance.
  • Velocity profiles with respect to radial distances at different lengths from inlet are plotted.
  • pressure profiles with respect to length are plotted from fully developed laminar flow region to outlet.
  • For calculating shear stress export the velocity data into .cvs file.
  • Import the .cvs file into matlab using import option in matlab.
  • Only import the data of velocity in matrix type, by selecting suitable column 
  • Write a code to calculate shearstress and plot the result.
  • The shear stress is maximum at the walls, and minimum at the centre of the pipe. 

Velocity Profiles:

Pressure drop from inlet to outlet of pipe:

Pressure drop from x = 2.52 m to outlet of pipe:

Shear stress(Analytical method):

Shear stress(Computational/Numerical method):

For wedge angle 3 degrees 

Boundary conditions for front and back faces are wedge

The matlab code is same as previous case but Front and Back BC is to changed to wedge,

The velocity profiles, pressure drop and shear stress variations are not predominant.  

comparison of results obtained for Symmetry BC and Wedge BC:

Wedge Angle

(Degrees)

&

BC

Max. Velocity (m/s)

(Theoretical result)

Max. Velocity (m/s)

(Simulation result)

Execution time (S)

Clock (S)

 

Mean

courant number

Max

courant number

3(wedge)

0.1875

0.175879

3886.43

4428

0.000167639

0.00183638

3(symmetry)

0.1875

0.174788

5027.69

8138

0.000167586

0.00183688

The execution time for both cases is large, because of the minimum time step i.e., 0.0001. 

The execution time for wedge BC is less as compared with symmetry BC.

CASE B:  To Compare the results for different wedge angles

Reduced Geometry of Pipe(i.e., wedge):

MATLAB PROGRAM: To generate blockMeshDict file for different angles i.e., (10, 25, 45) using file parsing technique 

clear all
close all
clc

%% Input data for analysis of flow

% Diameter of the pipe in m
D = 0.02;
% Radius of the pipe in m
R = D/2;
% Reynolds number
Re = 2100
% Entrance Length in m
L_e = 0.06*Re*D;
% Total length of the pipe in m
L = 0.3 + L_e
% wedge angle in degree
theta =  input('Enter the angle =');
% Dynamic viscosity of water at 25 deg. Cel. in Ns/m^2
mu = 8.9e-4; 
% Density of water at 25 deg. Cel. in kg/m^3
rho = 997.130
% kinematic viscosity of water at 25 deg. Cel. in m^2/s
nu = mu/rho

%% calculating the solution according to Hagen-Poiseuille's flow equation
% Average velocity
V = (Re*mu)/(rho*D)
% Maximum velocity 
u_max = 2*V
% pressure gradient
del_pdel_x = (8*mu*V)/(R^2)
% Pressure drop
delta_p = (8*mu*V*L)/(R^2)
% kinematic pressure 
kin_pressure = delta_p/rho

% vertices
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)];

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: 7                                     ');
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\n', '//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//');
fprintf(f1, '%s\n\n', 'convertToMeters 1;');

% Defining the vertices of the geometry
fprintf(f1, '%s\n','vertices');
fprintf(f1, '%s\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',v5(1),v5(2),v5(3));
fprintf(f1, '%s\n\n',');');

% Defining the blocks
fprintf(f1, '%s\n', 'blocks');
fprintf(f1, '%s\n','(');
fprintf(f1, '\thex (0 1 2 0 3 4 5 3) (%d %d %d) simpleGrading (1 1 1)\n',200,1,25);
fprintf(f1, '%s\n\n',');');

% Defining the edges
fprintf(f1, '%s\n', 'edges');
fprintf(f1, '%s\n','(');
fprintf(f1, '\tarc %d %d (%d %d %d)\n', 1,2,0,R,0);
fprintf(f1, '\tarc %d %d (%d %d %d)\n', 4,5,L,R,0);
fprintf(f1, '%s\n\n',');');

% Defining the boundaries
fprintf(f1, '%s\n', 'boundary');
fprintf(f1, '%s\n', '(');
fprintf(f1, '\tinlet\n\t{\n');
fprintf(f1, '\t\ttype patch;\n');
fprintf(f1, '\t\tfaces\n\t\t(\n');
fprintf(f1, '\t\t\t(0 2 1 0)\n');
fprintf(f1, '\t\t);\n\t}\n');
fprintf(f1, '\toutlet\n\t{\n');
fprintf(f1, '\t\ttype patch;\n');
fprintf(f1, '\t\tfaces\n\t\t(\n');
fprintf(f1, '\t\t\t(3 4 5 3)\n');
fprintf(f1, '\t\t);\n\t}\n');
fprintf(f1, '\twedge_front\n\t{\n');
fprintf(f1, '\t\ttype symmetry;\n');
fprintf(f1, '\t\tfaces\n\t\t(\n');
fprintf(f1, '\t\t\t(0 3 5 2)\n');
fprintf(f1, '\t\t);\n\t}\n');
fprintf(f1, '\twedge_back\n\t{\n');
fprintf(f1, '\t\ttype symmetry;\n');
fprintf(f1, '\t\tfaces\n\t\t(\n');
fprintf(f1, '\t\t\t(0 1 4 3)\n');
fprintf(f1, '\t\t);\n\t}\n');
fprintf(f1, '\ttop\n\t{\n');
fprintf(f1, '\t\ttype wall;\n');
fprintf(f1, '\t\tfaces\n\t\t(\n');
fprintf(f1, '\t\t\t(1 2 5 4)\n');
fprintf(f1, '\t\t);\n\t}\n');
fprintf(f1, '\taxis\n\t{\n');
fprintf(f1, '\t\ttype empty;\n');
fprintf(f1, '\t\tfaces\n\t\t(\n');
fprintf(f1, '\t\t\t(0 3 3 0)\n');
fprintf(f1, '\t\t);\n\t}\n');
fprintf(f1, ');\n\n');
fprintf(f1, 'mergePatchPairs\n(\n);\n\n');
fprintf(f1, '//**************************************************************************//');
fclose(f1)

PREPROCESSING:

  • First, input all the data in matlab by defining the Reynolds number, Diameter of pipe, wedge angle, dynamic viscosity and density.
  • Then Entry length, total length and Kinematic viscosity formulae are mentioned for a fluid flow.
  • Entry length is calculated for finding out the fully developed laminar fluid flow in the pipe.
  •  Average velocity, maximum velocity, pressure gradient, pressure drop and kinematic pressure formulae are also mentioned for the given fluid flow.
  • Rather than considering the whole cylinder, reduced cylinder of wedge shape geometry is made to reduce the computational time. but, it gives the results through which the entire cylinder perfomance can be predicted.
  • Now write a program to create blockMeshDict file for different wedge angles (i.e., 10,25,45 degrees using parsing technique.
  • Define Boundary as symmetry type for wedge front and wedge back. 
  • In openFoam, create a copy of cavity case from tutorials/incompressible/icoFoam/cavity to run directory as cavity_test.
  • The BlockMesh file which is generated in matlab is copied in the system folder of the case setup.
  • Edit the controlDict file, within the same system directory, by setting up the end time and time step, deltaT for simulation.
  • Now set the initial condition for pressure and velocity. For this go to ''0'' folder located in the cavity folder. In this folder there are two files one file is pressure file, 'p' and other file is velocity, 'U'.
  • Edit the pressure file, 'p' and set the pressure by the user defined value at outlet, and edit the wedge_front and wedge_back type as symmetry, top type as zeroGradient, axis type as empty. 
  • Now, edit the velocity file, 'U' and set the velocity at inlet, at internal fields and edit the wedge_front and wedge_back type as symmetry, top type as zeroGradient, axis type as empty. 
  • Edit the transportProperties from the constant folder, by mentioning it with a kinematic viscosity. 
  • Now the case is fully set up.
  • Now generate the mesh file. To do that type 'blockMesh' in the command terminal and execute it.
  • After mesh generation, do type 'checkMesh'  in the command terminal and execute it, to check mesh of geometry is free from errors.
  • After mesh check run the 'icoFoam' solver in the terminal.
  • After running the solver the data is to be post processed. For this the paraFoam command is used in the command terminal and execute it for postprocessing the results.

OpenFoam blockMeshDict file generated by the above matlab code

/*---------------------------------*- 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 9.961947e-03 -8.715574e-04)
	(0 9.961947e-03 8.715574e-04)
	(2.820000e+00 0 0)
	(2.820000e+00 9.961947e-03 -8.715574e-04)
	(2.820000e+00 9.961947e-03 8.715574e-04)
);

blocks
(
	hex (0 1 2 0 3 4 5 3) (200 1 25) simpleGrading (1 1 1)
);

edges
(
	arc 1 2 (0 1.000000e-02 0)
	arc 4 5 (2.820000e+00 1.000000e-02 0)
);

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

mergePatchPairs
(
);

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

OpenFoam pressure file:

/*--------------------------------*- 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.0188715;
    }

    wedge_front
    {
        type            symmetry;
    }

    wedge_back
    {
        type            symmetry;
    }

    top
    {
        type            zeroGradient;
    }

    axis
    {
        type            empty;
    }
}

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

OpenFoam velocity file:

/*--------------------------------*- 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.0937 0 0);

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform (0.0937 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }

    wedge_front
    {
        type            symmetry;
    }

    wedge_back
    {
        type            symmetry;
    }

    top
    {
        type            noSlip;
    }

    axis
    {
        type            empty;
    }
}


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

OpenFoam controlDict file:

/*--------------------------------*- 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         10;

deltaT          0.001;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

OpenFoam transportProperties file:

/*--------------------------------*- 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.9256e-07;


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

Reduced Geometry of Pipe(i.e.,wedge angle is 10 degrees):

YZ plane:

XY plane:

XZ plane:

POSTPROCESSING:

  • After opening the Paraview, click on Apply to generate the geometry model.
  • Then press play to postprocess the results for maximum time.   
  • After the model generation, just reflect the geometry about xz plane then, click on plot over line, enter the coordinates of the line, for plotting the properties(Velocity, pressure) with respect to length and radial distance.
  • Velocity profiles with respect to radial distances at different lengths from inlet are plotted.
  • pressure profiles with respect to length are plotted from fully developed laminar flow region to outlet.
  • For calculating shear stress export the velocity data into .cvs file.
  • Import the .cvs file into matlab using import option in matlab.
  • Only import the data of velocity in matrix type, by selecting suitable column 
  • Write a code to calculate shearstress and plot the result.
  • The shear stress is maximum at the walls, and minimum at the centre of the pipe. 

Velocity Profiles:

Pressure drop from inlet to outlet of pipe:

Pressure drop between x = 2.52 m and 2.82m

Shear stress(Analytical method):

Shear stress(Computational/Numerical method):

To generate blockMeshDict file using file parsing technique for 25 and 45 degrees wedge angle, enter the input angle as 25 and 45, and remaining data is same. 

Reduced Geometry of Pipe(i.e.,wedge angle is 25 degrees):

YZ plane:

XY plane:

XZ plane:

Velocity Profiles:

Pressure drop from inlet to outlet of pipe:

 

Pressure drop between x = 2.52 m and 2.82m

Shear stress(Analytical method):

Shear stress(Computational/Numerical method):

Reduced Geometry of Pipe(i.e.,wedge angle is 45 degrees):

YZ plane:

XY plane:

XZ plane:

Velocity Profiles:

Pressure drop from inlet to outlet of pipe:

Pressure drop between x = 2.52 m and 2.82 m

Shear stress(Analytical method):

Shear stress(Computational/Numerical method):

Comparison of results obtained for different wedge angles:

Wedge Angle

(Degrees)

Max. Velocity (m/s)

(Theoretical result)

Max. Velocity (m/s)

(Simulation result)

Execution time (S)

Clock (S)

 

Mean

courant number

Max

courant number

10

0.1875

0.174

458.64

675

0.00167192

0.0183983

25

0.1875

0.176

473.43

907

0.00167612

0.0186145

45

0.1875

0.178

437.82

955

0.0016859

0.0192121

The simulation maximum velocity is becoming closer to theoretical maximum velocity.


Projects by Shravankumar Nagapuri

 

Objectives:

  • To import a 3D Geometry of elbow into CONVERGE studio.
  • To add boundaries and setup the case in CONVERGE and run the elbow flow simulation using Cygwin.
  • To post Process the results usi Read more

Objectives: To import a 3D Geometry of elbow into CONVERGE studio. To add boundaries and setup the case in CONVERGE and run the elbow flow simulation using Cygwin. To post Process the results using Paraview Importing the Geometry: Open the CONVERGE studi Read more

 Objectives: To create a 3D Geometry of Backward facing step using CONVERGE studio. To setup the case in CONVERGE and run the Backward facing step flow simulation for three different mesh sizes using Cygwin. To post Process the results using Paraview To compa Read more

Objectives: To setup the case in CONVERGE and run the channel flow simulation for three different mesh sizes using Cygwin. To post Process the results using Paraview To compare the results of three simulation Description:   The fluid which flows throu Read more

OBJECTIVE: To Mesh the Cylinder model using ANSA PROCEDURE: Import the stp model file into ANSA Graphical USer Interface. By Default the model is in wire frame model, for proper 3D visualization enable shadow mode. By Default the model is in entity mode, change it Read more

Objectives: To perform a parametric study on the gate valve simulation. To obtain the mass flow rates at the outlet for 5 design points. To show the cut section view for different design points, and also to show the gate disc lift and fluid volume extraction. To s Read more

1Q. Briefly explain about the possible types of combustion simulations in FLUENT. A:  Combustion or burning is a high temperature exothermic chemical reaction between a fuel and an oxidant accompanied by the production of heat, light and unburnt gases in the fo Read more

Cyclone Separator: Principle and Working: A high speed rotating (air)flow is established within a cylindrical or conical container called a cyclone. Air flows in a spiral pattern, beginning at the top (wide end) of the cyclone and ending at the bottom (narrow) end bef Read more

Objective: To analyse the flow pattern of the fluid inside the gearbox, for two different clearances of the same geometry and each geometry flow is analyzed by two different fluids (Water and Oil) as lubricants. Gearbox sloshing effect:  Slosh refers Read more


Loading...

The End