Challenge

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

OBJECTIVE.

  • To simulate an axis-symmetric laminar flow through the constant cross-sectional of the pipe by applying the symmetry boundary condition.
  • To simulating for the mentioned angles i.e for 10, 25, 45 degrees using both symmetry and wedge boundary conditions and validate them with HP equations.

Hagen-Poiseuille's law:

In nonideal fluid dynamics, the Hagen–Poiseuille equation, also known as the Hagen–Poiseuille law, is a physical law that gives the pressure drop in an incompressible and Newtonian fluid in laminar flow flowing through a long cylindrical pipe of constant cross-section.

At the entrance, the flow is said to be in the hydrodynamic entrance region where the velocity profile gradually takes the shape of a parabola from a straight line. As soon as the parabolic velocity profile becomes steady the flow is said to be in its fully developed state. Normally Hagen Poiseuille's Equation is applicable for a fully developed flow which helps us to calculate the pressure loss.

Assumptions made:

Geometry: Axisymmetric.

Reynolds number: 2100.

Working fluid: Water.

Diameter of the pipe: 0.02 m.

Dynamic viscosity=0.89x10^-3 Pas

Kinematic viscosity=0.8927x10^-6 m^2/s

theta=10, 25, 45

PROCEDURE.

  • Will start with copying the cavity file from the tutorial to the FOAM_RUN folder.
  • In the run folder only we are going to simulate and whatever we want to do the changes in the blockMeshDict file and pressure and velocity files and controlDict files we will be doing here.
  • creating the block in the OpenFoam here we are creating the wedge after making the required changes in the blockMeshDict file to check the geometry run the blockMesh command.
  • After creating the wedge assign the boundary conditions, and also sitting the simulation end time and time-step in such a way that the courant number should be less than 0.5 and also in the transportProperties enter the kinematic viscosity.
  • Run the simulation using the icoFoam solver after calculating the time needed for the fluid to travel from inlet to outlet

  • After the simulation, use paraFoam to view the flow inside the wedge and use plot over line command to plot the velocity and shear stress changes at a point after the hydrodynamical entry region so that we analyse the fully developed region of the fluid.

  • Use Matlab to parse the blockMeshDict so that the same file can be used for any wedge values.

// WEDGE ANGLE 10

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

// blockMesh parameterization   

/* Geometrical Info */

D	0.004;                      // Diameter 
r #calc "0.5*$D";                   // Radius
angle	10;                         // Angle in degrees
theta   #calc "degToRad($angle)";   // Angle in radians
Re 2100;          		    // Reynolds Number
Le #calc "0.06*$Re*$D";             // Entrance Length
L  #calc "0.01 + $Le";		    // Total length of pipe


/* Vertices Info */

xmin	0;    
xmax	$L;   
ymax	#calc "$r*cos($theta)";
zmax	#calc "$r*sin($theta)";
zmin    #calc "-$r*sin($theta)"; 

curve   #calc "$r*cos($theta)+1e-4";

/* Mesh Info */

nx	40;	// Cells along local X  
ny	1;	// Cells along local Y  
nz	200;	// Cells along local Z  


gxB	0.2;	// SG along local X  
gxT	0.2;	// SG along local X 


gx
(
    (0.5 0.5 5)
    (0.5 0.5 0.2)
);


gy	1;	// SG along local Y
gz	1;	// SG along local Z 


convertToMeters 1;

vertices
(
    ($xmin 0 0)		 //0
    ($xmin $ymax $zmax)	 //1
    ($xmin $ymax $zmin)	 //2
    ($xmax 0 0)		 //3
    ($xmax $ymax $zmax)	 //4
    ($xmax $ymax $zmin)	 //5

);

blocks
(
    hex (0 2 1 0 3 5 4 3) ($nx $ny $nz) simpleGrading ($gx $gy $gz)
);

edges
(
   arc 1 2 ($xmin $curve 0)
   arc 4 5 ($xmax $curve 0)
);

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

mergePatchPairs
(
);

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



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

// blockMesh parameterization   

/* Geometrical Info */

D	0.004;                      // Diameter 
r #calc "0.5*$D";                   // Radius
angle	25;                         // Angle in degrees
theta   #calc "degToRad($angle)";   // Angle in radians
Re 2100;          		    // Reynolds Number
Le #calc "0.06*$Re*$D";             // Entrance Length
L  #calc "0.01 + $Le";		    // Total length of pipe


/* Vertices Info */

xmin	0;    
xmax	$L;   
ymax	#calc "$r*cos($theta)";
zmax	#calc "$r*sin($theta)";
zmin    #calc "-$r*sin($theta)"; 

curve   #calc "$r*cos($theta)+1e-4";

/* Mesh Info */

nx	40;	// Cells along local X  
ny	1;	// Cells along local Y  
nz	200;	// Cells along local Z  


gxB	0.2;	// SG along local X  
gxT	0.2;	// SG along local X 


gx
(
    (0.5 0.5 5)
    (0.5 0.5 0.2)
);


gy	1;	// SG along local Y
gz	1;	// SG along local Z 


convertToMeters 1;

vertices
(
    ($xmin 0 0)		 //0
    ($xmin $ymax $zmax)	 //1
    ($xmin $ymax $zmin)	 //2
    ($xmax 0 0)		 //3
    ($xmax $ymax $zmax)	 //4
    ($xmax $ymax $zmin)	 //5

);

blocks
(
    hex (0 2 1 0 3 5 4 3) ($nx $ny $nz) simpleGrading ($gx $gy $gz)
);

edges
(
   arc 1 2 ($xmin $curve 0)
   arc 4 5 ($xmax $curve 0)
);

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

mergePatchPairs
(
);

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


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

// blockMesh parameterization   

/* Geometrical Info */

D	0.004;                      // Diameter 
r #calc "0.5*$D";                   // Radius
angle	45;                         // Angle in degrees
theta   #calc "degToRad($angle)";   // Angle in radians
Re 2100;          		    // Reynolds Number
Le #calc "0.06*$Re*$D";             // Entrance Length
L  #calc "0.01 + $Le";		    // Total length of pipe


/* Vertices Info */

xmin	0;    
xmax	$L;   
ymax	#calc "$r*cos($theta)";
zmax	#calc "$r*sin($theta)";
zmin    #calc "-$r*sin($theta)"; 

curve   #calc "$r*cos($theta)+1e-4";

/* Mesh Info */

nx	40;	// Cells along local X  
ny	1;	// Cells along local Y  
nz	200;	// Cells along local Z  


gxB	0.2;	// SG along local X  
gxT	0.2;	// SG along local X 


gx
(
    (0.5 0.5 5)
    (0.5 0.5 0.2)
);


gy	1;	// SG along local Y
gz	1;	// SG along local Z 


convertToMeters 1;

vertices
(
    ($xmin 0 0)		 //0
    ($xmin $ymax $zmax)	 //1
    ($xmin $ymax $zmin)	 //2
    ($xmax 0 0)		 //3
    ($xmax $ymax $zmax)	 //4
    ($xmax $ymax $zmin)	 //5

);

blocks
(
    hex (0 2 1 0 3 5 4 3) ($nx $ny $nz) simpleGrading ($gx $gy $gz)
);

edges
(
   arc 1 2 ($xmin $curve 0)
   arc 4 5 ($xmax $curve 0)
);

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

mergePatchPairs
(
);

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

Wedge Angle 10 :

Wedge Angle 25 :

Wedge Angle 45 :

Validation of the Maximum Velocity


Now, if we wish to compare the Maximum velocity from the graph, we can see that the value is 0.42units.
According to the Analytical formula, we know that the maximum velocity must be: `2. Vavg [ 1 - r^2/R^2]`
And our Vavg is 0.21units; hence the analytical value will be 0.42units that matches the value that we get from the graph.


To validate the Hydrodynamic length with the Numerical Result.


So, In fluid dynamics, the entrance length is the distance a flow travels after entering a pipe before the flow becomes fully developed. Entrance length refers to the length of the entry region, the area following the pipe entrance where effects originating from the interior wall of the pipe propagate into the flow as an expanding boundary layer.

Here, numerically, we know that the velocity profile will be different before and after the Hydrodynamic entry length. After the Hydrodynamic entry length, the Velocity profile will be the final parabolic profile that it must have in a fully developed region.

Comparison between the two Boundary Conditions.

We have performed Simulation for two Boundary Conditions; those are Symmetry Boundary Condition and the Wedge Boundary Condition.
During the Wedge Boundary condition simulation, the simulation across the arc of the wedge is not done, but whereas in the case of Symmetry Boundary Condition, the calculation across the arc of the wedge is done; hence the simulation time is higher in that case. The Courant number is increasing slightly in the case of wedge Boundary Condition and hence the Symmetry Boundary Condition will be slightly more accurate. The Symmetry Boundary condition considers the Mesh as 3D and the calculation is done along all the three global axes.
We understand the results should not change due to the change in the Boundary conditions, and this is because the Physics of the problem does not change and remains the same.


Conclusion: In conclusion, I would like to state that this challenge helped me understand the difference between the two boundary conditions and how to simulate them as per the need of the problem that we will be simulating.

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.