Project

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

Aim : To validate the studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation.

Introduction : In this project we will compare the axi-symmetric flow in symmetric boundary conditions and we will check the data with 3 different angles of wedge.

Procedure : the code for the wedge angle = 10 degrees is given as follows :

clc
close all
clear all

R_e = 2100;  % renold's no.
rho = 1000;  % (in kg/m^3)
d = 0.001;
R = d/2   % in meters
theta = 10;
b1 = R*cosd(theta/2);
b2 = R*sind(theta/2);
L = 0.05*R_e*d + 0.095;
L_e = 0.05*R_e*d;
%L = 2.4
mu =  0.000890    %8.90*10^-4 Pa-S dynamic viscocity of water
nu = mu/rho    % kinematic viscocity of water
V_avg = (R_e*mu)/(rho*d);
V_max = 2*V_avg;

delta_pressure = (8*mu*0.095*V_avg)/R^2;   % L is after fully developed
delta_p = (delta_pressure)/rho  % for openfoam

% shear stress at the hydrodynamic length
% tau = -((delta_p)/(L))*(0.02/2);

r = linspace(0,R,100);
for i = 1:100
tau(i) = 2*mu*V_max*(abs(r(i)/(R^2)));
u(i) = 2*V_avg*(1-r(i)^2/R^2);
end



figure(1);
plot(r,tau);
xlabel('R');
ylabel('tau');

% file parsing for blockMeshdict

a1 ='  /*--------------------------------*- C++ -*----------------------------------*';
a2 ='  =========                 |';
a3 ='        /  F ield         | OpenFOAM: The Open Source CFD Toolbox';
a4 ='       /   O peration     | Website:  https://openfoam.org';
a5 ='      /    A nd           | Version:  9';
a6 ='     /     M anipulation  |';
a7 ='  *---------------------------------------------------------------------------*/';

% vertices 
v0 = [0 0 0];
v1 = [0 b1 b2];
v2 = [0 b1 -b2];
v3 = [L 0 0];
v4 = [L b1 b2];
v5 = [L b1 -b2];


f1 = fopen('blockMeshDict.txt','w')
fprintf(f1, '%s n',a1);
fprintf(f1,'%s n',a2);
fprintf(f1,'%s n',a3);
fprintf(f1,'%s n',a4);
fprintf(f1,'%s n',a5);
fprintf(f1,'%s n',a6);
fprintf(f1,'%s n',a7);

fprintf(f1,'FoamFilen{n');
fprintf(f1,'%10s %10sn','format','ascii;');
fprintf(f1,'%9s  %15sn','class','dictionary;');
fprintf(f1,'%10s %18sn','object','blockMeshDict;');
fprintf(f1,'%sn','}');
fprintf(f1,'%sn n',  '// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //')
fprintf(f1,'%snn','convertToMeters 1;');

fprintf(f1,'%sn','vertices');
fprintf(f1,'%sn','(');
fprintf(f1, 't(%d %d %d)n',v0);
fprintf(f1, 't(%d %d %d)n',v1);
fprintf(f1, 't(%d %d %d)n',v2);
fprintf(f1, 't(%d %d %d)n',v3);
fprintf(f1, 't(%d %d %d)n',v4);
fprintf(f1, 't(%d %d %d)n',v5);
fprintf(f1,'%snn',');');

fprintf(f1,'%sn','blocks');
fprintf(f1,'%sn','(');
fprintf(f1,'%20s %s %sn','hex (0 3 5 2 0 3 4 1)','(100 10 1)','simpleGrading (0.75 0.25 1)');
fprintf(f1,'%snn',');');

fprintf(f1,'%sn','edges');
fprintf(f1,'%sn','(');
fprintf(f1,'%10s (0 %d 0) n','arc 1 2',R);
fprintf(f1,'%10s (%d %d 0) n','arc 4 5',L,R);

fprintf(f1,'%snn',');');

fprintf(f1,'%sn','boundary');
fprintf(f1,'%sn','(');
fprintf(f1,'%7sn','axis');
fprintf(f1,'%7sn','{');
fprintf(f1,'%17sn','type empty;');
fprintf(f1,'%15sn','faces');
fprintf(f1,'%10sn','(')
fprintf(f1,'%20sn','(0 3 3 0)');
fprintf(f1,'%10sn',');')
fprintf(f1,'%7sn','}')

fprintf(f1,'%7sn','wall');
fprintf(f1,'%7sn','{');
fprintf(f1,'%17sn','type wall;');
fprintf(f1,'%15sn','faces');
fprintf(f1,'%10sn','(');
fprintf(f1,'%20sn','(4 5 2 1)');
fprintf(f1,'%11sn',');');
fprintf(f1,'%7sn','}');

fprintf(f1,'%7sn','inlet');
fprintf(f1,'%7sn','{');
fprintf(f1,'%17sn','type patch;');
fprintf(f1,'%15sn','faces');
fprintf(f1,'%10sn','(');
fprintf(f1,'%20sn','(0 1 2 0)');
fprintf(f1,'%11sn',');');
fprintf(f1,'%7sn','}');

fprintf(f1,'%7sn','outlet');
fprintf(f1,'%7sn','{');
fprintf(f1,'%17sn','type patch;');
fprintf(f1,'%15sn','faces');
fprintf(f1,'%10sn','(');
fprintf(f1,'%20sn','(3 5 4 3)');
fprintf(f1,'%11sn',');');
fprintf(f1,'%7sn','}');

fprintf(f1,'%7sn','wedgeFront');
fprintf(f1,'%7sn','{');
fprintf(f1,'%17sn','type symmetry;');
fprintf(f1,'%15sn','faces');
fprintf(f1,'%10sn','(');
fprintf(f1,'%20sn','(3 4 1 0)');
fprintf(f1,'%11sn',');');
fprintf(f1,'%7sn','}');

fprintf(f1,'%7sn','wedgeBack');
fprintf(f1,'%7sn','{');
fprintf(f1,'%17sn','type symmetry;');
fprintf(f1,'%15sn','faces');
fprintf(f1,'%10sn','(');
fprintf(f1,'%20sn','(0 2 5 3)');
fprintf(f1,'%11sn',');');
fprintf(f1,'%7sn','}');

fprintf(f1,'%snn',');');

fprintf(f1,'%sn','mergePatchPairs');
fprintf(f1,'%sn','(');
fprintf(f1,'%snn',');');
fprintf(f1,'%sn','// ************************************************************************* //');

the initial condition for pressure is given as :

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

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    axis
    {
        type            empty;
    }
   
   
    wall
    {
        type            zeroGradient;
       
    }
   

    inlet
    {
        type            zeroGradient;
    }

    outlet
    {
        type            fixedValue;
        value           uniform 5.0568;
    }
   
    wedgeFront
    {
         type           symmetry;
    }
   
   
    wedgeBack
    {
         type           symmetry;
         
    }    
}


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

for velocity :

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

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (1.8690 0 0);

boundaryField
{
    axis
    {
        type            empty;
    }
   
    wall
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }
       
       

    inlet
    {
        type            fixedValue;
        value           uniform (1.8690 0 0);
       
    }

    outlet
    {
        type            zeroGradient;
    }
   
    wedgeFront
    {
        type            symmetry;
    }
   
    wedgeBack
    {
        type            symmetry;
    }
   
}

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

the workspace for the code :

the geometry is given as follows while simulation :

velocity :

pressure :

Hydrodynamic length : It is the length after which the velocity profile of the flow doesnt change in laminar flow cases.

the velocity profile after the hydrodynamic length is given as follows :

the sudden drop in the velocity is because it has reached the end of the pipe.

the pressure profile is given as follows :

the stress profile :

the maximum analytical stress value is given as : 13.3072800000000 `N/m^2` and according to the graph it is given as 11.94 `N/m^2`

for wedge angle 25 degrees the data is as follows :

for wedge angle 45 degrees the data is as follows :

the physical properties computed in Matlab is given as follows in graphical format for validation :

Hence we can observe that the physical properties profile are matching with the OpenFoam data.

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.