Challenge

Week 12 - Symmetry vs Wedge vs HP equation

Comparison between symmetric and wedge boundary conditions is done by taking

case I:

no. of cells in local X direction = 25

no. of cells in local Y direction = 1

no. of cells in local Z direction = 500

case II:

no. of cells in local X direction = 25

no. of cells in local Y direction = 2

no. of cells in local Z direction = 500

Hagen Poiseuelle's equation:

Pressure drop across a pipe, `dp_s = (8*mu*0.4*v_(avg))/R^2`--> (1)

Average velocity is obtained by `Re = (rho*v_(avg)*D)/mu`

and `v_(max) = 2*v_(avg)`

Variation of velocity in radial direction, `v = v_(max)*(1-r^2/R^2)`

kinematic pressure drop, `dp_k = (dp_s)/rho`

As in previous problem, water is taken as flow fluid and diameter of pipe is 0.02m.

A MATLAB code is written to calculate the above flow field variables.

% calculating velocity 

clear all
close all
clc

re = 2100;
rho = 1000;
d = 0.02;
r = d/2;
mu = 8.9e-4;
nu = mu/rho;
c = 0.5;
nx = 500;
ny = 25;

% hydrodynamic entrance length for laminar flow
l_e = 0.05*re*d;
l_t = l_e + 0.4;

dx = l_t/(nx-1);
dy = r/(ny-1);

% re = (rho*va*d)/mu

vavg = (re*mu)/(rho*d);

vmax = 2*vavg;

dp_s = (8*mu*0.4*vavg)/r^2;

dp_k = dp_s/rho;

dt = (c*dy)/vavg;

ry = zeros(1,50);

ry(1) = -0.01;

for i = 2:(2*ny)
    
    ry(i) = ry(i-1)+dy;
    
end

for j = 1:(2*ny)
    
    v(j) = vmax*(1-((ry(j))^2/r^2));
    
end

plot(ry,v);
grid on;
axis([-0.01 0.01 0 0.2]);
xlabel('radial distance');
ylabel('velocity');
title('Velocity distribution');

MATLAB codes to generate blockMeshDict files for symmetry and wedge boundary conditions:

Symmetry:

% file parsing
% creating blockmeshdict file of openfoam
% diamater in mm

function [f1] = blockMeshDict_sym(re,d,theta,nx,ny,nz,g1,g2,g3)

r = d/2;
l_e = 0.05*re*d;
l_t = l_e + 400;

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_t 0 0];
v4 = [l_t r*cosd(theta/2) -r*sind(theta/2)];
v5 = [l_t r*cosd(theta/2) r*sind(theta/2)];

f1 = fopen('blockMeshDict.txt','w');
fprintf(f1,'/*--------------------------------*- C++ -*-------------------------------------------*\n');
fprintf(f1,'  =========                |\n');
fprintf(f1,'  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox\n');
fprintf(f1,'   \\    /   O peration     | Website:  https://openfoam.org\n');
fprintf(f1,'    \\  /    A nd           | Version:  8\n');
fprintf(f1,'     \\/     M anipulation  |\n');
fprintf(f1,'*---------------------------------------------------------------------------*/\n');
fprintf(f1,'FoamFile\n');
fprintf(f1,'{\n');
fprintf(f1,'    version     2.0;\n');
fprintf(f1,'    format      ascii;\n');
fprintf(f1,'    class       dictionary;\n');
fprintf(f1,'    object      blockMeshDict;\n');
fprintf(f1,'}\n');
fprintf(f1,'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\n\n');
fprintf(f1,'convertToMeters 0.001;\n\n');
fprintf(f1,'vertices\n');
fprintf(f1,'(\n');
fprintf(f1,'    (');
fprintf(f1,'%d %d %d)\n',v0(1),v0(2),v0(3));
fprintf(f1,'    (');
fprintf(f1,'%1.3f %1.3f %1.3f)\n',v1(1),v1(2),v1(3));
fprintf(f1,'    (');
fprintf(f1,'%1.3f %1.3f %1.3f)\n',v2(1),v2(2),v2(3));
fprintf(f1,'    (');
fprintf(f1,'%1.3f %1.3f %1.3f)\n',v3(1),v3(2),v3(3));
fprintf(f1,'    (');
fprintf(f1,'%1.3f %1.3f %1.3f)\n',v4(1),v4(2),v4(3));
fprintf(f1,'    (');
fprintf(f1,'%1.3f %1.3f %1.3f)\n',v5(1),v5(2),v5(3));
fprintf(f1,');\n\n');
fprintf(f1,'blocks\n');
fprintf(f1,'(\n');
fprintf(f1,'    hex (0 1 2 0 3 4 5 3) (%d %d %d) simpleGrading (%1.2f %1.2f %1.2f)\n', nx,ny,nz,g1,g2,g3);
fprintf(f1,');\n\n');
fprintf(f1,'edges\n');
fprintf(f1,'(\n');
fprintf(f1,'    arc 1 2 (0 %1.2f 0)\n', r);
fprintf(f1,'    arc 4 5 (%1.2f %1.2f 0)\n', l_t,r);
fprintf(f1,');\n\n');
fprintf(f1,'boundary\n');
fprintf(f1,'(\n');
fprintf(f1,'    inlet\n');
fprintf(f1,'    {\n');
fprintf(f1,'        type patch;\n');
fprintf(f1,'        faces\n');
fprintf(f1,'        (\n');
fprintf(f1,'            (0 1 2 0)\n');
fprintf(f1,'        );\n');
fprintf(f1,'    }\n\n');
fprintf(f1,'    outlet\n');
fprintf(f1,'    {\n');
fprintf(f1,'        type patch;\n');
fprintf(f1,'        faces\n');
fprintf(f1,'        (\n');
fprintf(f1,'            (3 5 4 3)\n');
fprintf(f1,'        );\n');
fprintf(f1,'    }\n\n');
fprintf(f1,'    noSlipWall\n');
fprintf(f1,'    {\n');
fprintf(f1,'        type wall;\n');
fprintf(f1,'        faces\n');
fprintf(f1,'        (\n');
fprintf(f1,'            (1 4 5 2)\n');
fprintf(f1,'        );\n');
fprintf(f1,'    }\n\n');
fprintf(f1,'    front\n');
fprintf(f1,'    {\n');
fprintf(f1,'        type symmetry;\n');
fprintf(f1,'        faces\n');
fprintf(f1,'        (\n');
fprintf(f1,'            (0 3 4 1)\n');
fprintf(f1,'        );\n');
fprintf(f1,'    }\n\n');
fprintf(f1,'    back\n');
fprintf(f1,'    {\n');
fprintf(f1,'        type symmetry;\n');
fprintf(f1,'        faces\n');
fprintf(f1,'        (\n');
fprintf(f1,'            (0 2 5 3)\n');
fprintf(f1,'        );\n');
fprintf(f1,'    }\n');
fprintf(f1,');\n\n');
fprintf(f1,'mergePatchPairs\n');
fprintf(f1,'(\n');
fprintf(f1,');\n\n');
fprintf(f1,'// ************************************************************************* //');

Wedge:

% file parsing
% creating blockmeshdict file of openfoam
% diamater in mm

function [f1] = blockMeshDict_wedge(re,d,theta,nx,ny,nz,g1,g2,g3)

r = d/2;
l_e = 0.05*re*d;
l_t = l_e + 400;

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_t 0 0];
v4 = [l_t r*cosd(theta/2) -r*sind(theta/2)];
v5 = [l_t r*cosd(theta/2) r*sind(theta/2)];

f1 = fopen('blockMeshDict.txt','w');
fprintf(f1,'/*--------------------------------*- C++ -*-------------------------------------------*\n');
fprintf(f1,'  =========                |\n');
fprintf(f1,'  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox\n');
fprintf(f1,'   \\    /   O peration     | Website:  https://openfoam.org\n');
fprintf(f1,'    \\  /    A nd           | Version:  8\n');
fprintf(f1,'     \\/     M anipulation  |\n');
fprintf(f1,'*---------------------------------------------------------------------------*/\n');
fprintf(f1,'FoamFile\n');
fprintf(f1,'{\n');
fprintf(f1,'    version     2.0;\n');
fprintf(f1,'    format      ascii;\n');
fprintf(f1,'    class       dictionary;\n');
fprintf(f1,'    object      blockMeshDict;\n');
fprintf(f1,'}\n');
fprintf(f1,'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\n\n');
fprintf(f1,'convertToMeters 0.001;\n\n');
fprintf(f1,'vertices\n');
fprintf(f1,'(\n');
fprintf(f1,'    (');
fprintf(f1,'%d %d %d)\n',v0(1),v0(2),v0(3));
fprintf(f1,'    (');
fprintf(f1,'%1.3f %1.3f %1.3f)\n',v1(1),v1(2),v1(3));
fprintf(f1,'    (');
fprintf(f1,'%1.3f %1.3f %1.3f)\n',v2(1),v2(2),v2(3));
fprintf(f1,'    (');
fprintf(f1,'%1.3f %1.3f %1.3f)\n',v3(1),v3(2),v3(3));
fprintf(f1,'    (');
fprintf(f1,'%1.3f %1.3f %1.3f)\n',v4(1),v4(2),v4(3));
fprintf(f1,'    (');
fprintf(f1,'%1.3f %1.3f %1.3f)\n',v5(1),v5(2),v5(3));
fprintf(f1,');\n\n');
fprintf(f1,'blocks\n');
fprintf(f1,'(\n');
fprintf(f1,'    hex (0 1 2 0 3 4 5 3) (%d %d %d) simpleGrading (%1.2f %1.2f %1.2f)\n', nx,ny,nz,g1,g2,g3);
fprintf(f1,');\n\n');
fprintf(f1,'edges\n');
fprintf(f1,'(\n');
fprintf(f1,'    arc 1 2 (0 %1.2f 0)\n', r);
fprintf(f1,'    arc 4 5 (%1.2f %1.2f 0)\n', l_t,r);
fprintf(f1,');\n\n');
fprintf(f1,'boundary\n');
fprintf(f1,'(\n');
fprintf(f1,'    inlet\n');
fprintf(f1,'    {\n');
fprintf(f1,'        type patch;\n');
fprintf(f1,'        faces\n');
fprintf(f1,'        (\n');
fprintf(f1,'            (0 1 2 0)\n');
fprintf(f1,'        );\n');
fprintf(f1,'    }\n\n');
fprintf(f1,'    outlet\n');
fprintf(f1,'    {\n');
fprintf(f1,'        type patch;\n');
fprintf(f1,'        faces\n');
fprintf(f1,'        (\n');
fprintf(f1,'            (3 5 4 3)\n');
fprintf(f1,'        );\n');
fprintf(f1,'    }\n\n');
fprintf(f1,'    noSlipWall\n');
fprintf(f1,'    {\n');
fprintf(f1,'        type wall;\n');
fprintf(f1,'        faces\n');
fprintf(f1,'        (\n');
fprintf(f1,'            (1 4 5 2)\n');
fprintf(f1,'        );\n');
fprintf(f1,'    }\n\n');
fprintf(f1,'    front\n');
fprintf(f1,'    {\n');
fprintf(f1,'        type wedge;\n');
fprintf(f1,'        faces\n');
fprintf(f1,'        (\n');
fprintf(f1,'            (0 3 4 1)\n');
fprintf(f1,'        );\n');
fprintf(f1,'    }\n\n');
fprintf(f1,'    back\n');
fprintf(f1,'    {\n');
fprintf(f1,'        type wedge;\n');
fprintf(f1,'        faces\n');
fprintf(f1,'        (\n');
fprintf(f1,'            (0 2 5 3)\n');
fprintf(f1,'        );\n');
fprintf(f1,'    }\n');
fprintf(f1,');\n\n');
fprintf(f1,'mergePatchPairs\n');
fprintf(f1,'(\n');
fprintf(f1,');\n\n');
fprintf(f1,'// ************************************************************************* //');

Inputs for generating blockMeshDict files are

reynolds number = 2100

diameter = 20

theta = 10/25/45

nx = 25; ny=1; nz=500 for case I

nx = 25; ny=2; nz=500 for case II

Grading in all directions is considered equal (g1=g2=g3=1).

Initial and Boundary conditions:

The initial and boundary conditions are same as in the previous problem.

Velocity:

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

    outlet
    {
        type            zeroGradient;
    }

    noSlipWall
    {
        type            noSlip;
    }
    
    front
    {
        type            wedge;
    }
    
    back
    {
        type            wedge;
    }
}

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

Pressure:

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

    noSlipWall
    {
        type            zeroGradient;
    }

    front
    {
        type            wedge;
    }
    
    back
    {
        type            wedge;
    }
}

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

Control Dict:

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

deltaT          0.0268;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

Transport Properties:

/*--------------------------------*- 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] 8.9e-7;


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

Outputs:

1. Flow field variables form MATLAB code:

Average velocity is 0.0935 m/s.

Max. velocity is 0.1869 m/s.

Kinematic pressure drop is 0.0027

A graph is plotted to find the velocity variation with radial distance.

2. BlockMeshDict files:

Case I: (ny = 1)

(i) For Symmetry BC:

(a) Wedge angle = 10°:

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

vertices
(
    (0 0 0)
    (0.000 9.962 -0.872)
    (0.000 9.962 0.872)
    (2500.000 0.000 0.000)
    (2500.000 9.962 -0.872)
    (2500.000 9.962 0.872)
);

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

edges
(
    arc 1 2 (0 10.00 0)
    arc 4 5 (2500.00 10.00 0)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }

    noSlipWall
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }

    front
    {
        type symmetry;
        faces
        (
            (0 3 4 1)
        );
    }

    back
    {
        type symmetry;
        faces
        (
            (0 2 5 3)
        );
    }
);

mergePatchPairs
(
);

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

(b) Wedge angle = 25°:

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

vertices
(
    (0 0 0)
    (0.000 9.763 -2.164)
    (0.000 9.763 2.164)
    (2500.000 0.000 0.000)
    (2500.000 9.763 -2.164)
    (2500.000 9.763 2.164)
);

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

edges
(
    arc 1 2 (0 10.00 0)
    arc 4 5 (2500.00 10.00 0)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }

    noSlipWall
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }

    front
    {
        type symmetry;
        faces
        (
            (0 3 4 1)
        );
    }

    back
    {
        type symmetry;
        faces
        (
            (0 2 5 3)
        );
    }
);

mergePatchPairs
(
);

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

(c) Wedge angle = 45°:

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

vertices
(
    (0 0 0)
    (0.000 9.239 -3.827)
    (0.000 9.239 3.827)
    (2500.000 0.000 0.000)
    (2500.000 9.239 -3.827)
    (2500.000 9.239 3.827)
);

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

edges
(
    arc 1 2 (0 10.00 0)
    arc 4 5 (2500.00 10.00 0)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }

    noSlipWall
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }

    front
    {
        type symmetry;
        faces
        (
            (0 3 4 1)
        );
    }

    back
    {
        type symmetry;
        faces
        (
            (0 2 5 3)
        );
    }
);

mergePatchPairs
(
);

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

(ii) For Wedge BC:

(a) Wedge angle = 10°:

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

vertices
(
    (0 0 0)
    (0.000 9.962 -0.872)
    (0.000 9.962 0.872)
    (2500.000 0.000 0.000)
    (2500.000 9.962 -0.872)
    (2500.000 9.962 0.872)
);

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

edges
(
    arc 1 2 (0 10.00 0)
    arc 4 5 (2500.00 10.00 0)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }

    noSlipWall
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }

    front
    {
        type wedge;
        faces
        (
            (0 3 4 1)
        );
    }

    back
    {
        type wedge;
        faces
        (
            (0 2 5 3)
        );
    }
);

mergePatchPairs
(
);

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

(b) Wedge angle = 25°:

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

vertices
(
    (0 0 0)
    (0.000 9.763 -2.164)
    (0.000 9.763 2.164)
    (2500.000 0.000 0.000)
    (2500.000 9.763 -2.164)
    (2500.000 9.763 2.164)
);

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

edges
(
    arc 1 2 (0 10.00 0)
    arc 4 5 (2500.00 10.00 0)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }

    noSlipWall
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }

    front
    {
        type wedge;
        faces
        (
            (0 3 4 1)
        );
    }

    back
    {
        type wedge;
        faces
        (
            (0 2 5 3)
        );
    }
);

mergePatchPairs
(
);

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

(c) Wedge angle = 45°:

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

vertices
(
    (0 0 0)
    (0.000 9.239 -3.827)
    (0.000 9.239 3.827)
    (2500.000 0.000 0.000)
    (2500.000 9.239 -3.827)
    (2500.000 9.239 3.827)
);

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

edges
(
    arc 1 2 (0 10.00 0)
    arc 4 5 (2500.00 10.00 0)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }

    noSlipWall
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }

    front
    {
        type wedge;
        faces
        (
            (0 3 4 1)
        );
    }

    back
    {
        type wedge;
        faces
        (
            (0 2 5 3)
        );
    }
);

mergePatchPairs
(
);

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

Case II: (ny = 2)

(i) For Symmetry BC:

(a) Wedge angle = 10°:

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

vertices
(
    (0 0 0)
    (0.000 9.962 -0.872)
    (0.000 9.962 0.872)
    (2500.000 0.000 0.000)
    (2500.000 9.962 -0.872)
    (2500.000 9.962 0.872)
);

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

edges
(
    arc 1 2 (0 10.00 0)
    arc 4 5 (2500.00 10.00 0)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }

    noSlipWall
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }

    front
    {
        type symmetry;
        faces
        (
            (0 3 4 1)
        );
    }

    back
    {
        type symmetry;
        faces
        (
            (0 2 5 3)
        );
    }
);

mergePatchPairs
(
);

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

(b) Wedge angle = 25°:

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

vertices
(
    (0 0 0)
    (0.000 9.763 -2.164)
    (0.000 9.763 2.164)
    (2500.000 0.000 0.000)
    (2500.000 9.763 -2.164)
    (2500.000 9.763 2.164)
);

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

edges
(
    arc 1 2 (0 10.00 0)
    arc 4 5 (2500.00 10.00 0)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }

    noSlipWall
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }

    front
    {
        type symmetry;
        faces
        (
            (0 3 4 1)
        );
    }

    back
    {
        type symmetry;
        faces
        (
            (0 2 5 3)
        );
    }
);

mergePatchPairs
(
);

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

(c) Wedge angle = 45°:

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

vertices
(
    (0 0 0)
    (0.000 9.239 -3.827)
    (0.000 9.239 3.827)
    (2500.000 0.000 0.000)
    (2500.000 9.239 -3.827)
    (2500.000 9.239 3.827)
);

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

edges
(
    arc 1 2 (0 10.00 0)
    arc 4 5 (2500.00 10.00 0)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }

    noSlipWall
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }

    front
    {
        type symmetry;
        faces
        (
            (0 3 4 1)
        );
    }

    back
    {
        type symmetry;
        faces
        (
            (0 2 5 3)
        );
    }
);

mergePatchPairs
(
);

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

(ii) For Wedge BC:

(a) Wedge angle = 10°:

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

vertices
(
    (0 0 0)
    (0.000 9.962 -0.872)
    (0.000 9.962 0.872)
    (2500.000 0.000 0.000)
    (2500.000 9.962 -0.872)
    (2500.000 9.962 0.872)
);

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

edges
(
    arc 1 2 (0 10.00 0)
    arc 4 5 (2500.00 10.00 0)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }

    noSlipWall
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }

    front
    {
        type wedge;
        faces
        (
            (0 3 4 1)
        );
    }

    back
    {
        type wedge;
        faces
        (
            (0 2 5 3)
        );
    }
);

mergePatchPairs
(
);

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

(b) Wedge angle = 25°:

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

vertices
(
    (0 0 0)
    (0.000 9.763 -2.164)
    (0.000 9.763 2.164)
    (2500.000 0.000 0.000)
    (2500.000 9.763 -2.164)
    (2500.000 9.763 2.164)
);

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

edges
(
    arc 1 2 (0 10.00 0)
    arc 4 5 (2500.00 10.00 0)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }

    noSlipWall
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }

    front
    {
        type wedge;
        faces
        (
            (0 3 4 1)
        );
    }

    back
    {
        type wedge;
        faces
        (
            (0 2 5 3)
        );
    }
);

mergePatchPairs
(
);

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

(c) Wedge angle = 45°:

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

vertices
(
    (0 0 0)
    (0.000 9.239 -3.827)
    (0.000 9.239 3.827)
    (2500.000 0.000 0.000)
    (2500.000 9.239 -3.827)
    (2500.000 9.239 3.827)
);

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

edges
(
    arc 1 2 (0 10.00 0)
    arc 4 5 (2500.00 10.00 0)
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (3 5 4 3)
        );
    }

    noSlipWall
    {
        type wall;
        faces
        (
            (1 4 5 2)
        );
    }

    front
    {
        type wedge;
        faces
        (
            (0 3 4 1)
        );
    }

    back
    {
        type wedge;
        faces
        (
            (0 2 5 3)
        );
    }
);

mergePatchPairs
(
);

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

3. Comparison of results from wedge and symmetric BCs:

Case I:

(i) For symmetry BC:

Wedge angle Max. velocity by simulation (m/s) Max. velocity theoretical(m/s) Error percentage
10° 0.184739 0.1869 1.156
25°

0.185189

0.1869 0.915
45° 0.185698 0.1869 0.643

(ii) For Wedge BC:

Wedge angle Max. velocity by simulation (m/s) Max. velocity theoretical(m/s) Error percentage
10° 0.184958 0.1869 1.039
25°

0.185189

0.1869 0.915
45° 0.185698 0.1869 0.643

Case II:

(i) For symmetry BC:

Wedge angle Max. velocity by simulation (m/s) Max. velocity theoretical(m/s) Error percentage
10° 0.184987 0.1869 1.02
25°

0.185195

0.1869 0.912
45° 0.185806 0.1869

0.585

(ii) For Wedge BC:

Wedge angle Max. velocity by simulation (m/s) Max. velocity theoretical(m/s) Error percentage
10° solution blown up 0.1869 ---
25°

0.225569

0.1869 20.68
45° 0.225569 0.1869 20.68

Conclusions:

From the above data, it is observed that as the wedge angle is increased, accuracy of the solution has increased.

Also, comparing both cases for symmetry BC, accuracy of the solution is greater for case II than case I as there are more no. of elements in case II (ny = 2).

The symmetry and wedge BC has shown same results for 25 and 45° for case I. But for 10°, wedge BC has less error than symmetry.

Also, for case II wedge BC, the solution got blown up for 10° and for the other two angles, velocity over predicted by 20.68%. This shows us that the wedge BC can give accurate results when there is only single cell thickness across the curvarture.

It can be concluded that symmetry BC gives accurate results and the accuracy can be further improved by decreasing cell thickness across the curvature. But when single cell thickness is used, wedge BC is preferred.

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.