Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
AIM:
To simulate an axisymmetric flow by applying the wedge boundary condition.
OBJECTIVE OF THE PROJECT:
- Calculation of Flow Variables.
- Generation of blockMeshDict using the wedge boundary condition. Create the blockMeshDict file in MATLAB such that the mesh is automatically created for any wedge angle.
- Simulating the pipe flow in OpenFOAM using icoFoam solver.
THEORY:
Hydrodynamic entrance length:
The hydrodynamic entrance region refers to the area of a pipe where fluid entering a pipe develops a velocity profile due to viscous forces spreading from a pipe's interior wall. This region has a non-uniform flow. The fluid enters a pipe at a constant speed, so fluid particles in the layer in contact with the pipe's surface come to a complete stop because of the no-slip rule. The layer in contact with the pipe surface is resistant to the acceleration of neighboring layers due to viscous forces within the fluid and slowly slows down adjacent layers of fluid, creating a velocity profile. To keep the mass true, the speed of the fluid layers in the center of the pipe increases to compensate for the reduced speed of the fluid layers near the surface of the pipe. It creates a gradient of velocity across the pipe cross-section.
Entry length for Laminar flow is Lenght of the pipe = 0.06*Re*D.
Hagen poiseuille's Law:
In non-ideal fluid dynamics, the Hagen-poiseuille equation is a physical law that gives pressure drop in an incompressible and Newtonian fluid in a laminar flow through a long cylinder pipe of the constant cross-section.
Formulas:
Average Velocity `V_(avg)=(Re*mu)/(rho*D)`
Maximum Velocity `V_(max) = 2*V_(avg)`
Pressure Difference `DeltaP = (8*mu*L*V_(avg) )/(r^2)`
Kinematic Pressure Difference `DeltaP_k=(DeltaP)/rho`
Shear Stress `tau=(2*mu*V_(max)*R)/r^2`
MATLAB CODE:
Matlab code for auto-creating the blockMeshDict file:
close all
clear all
clc
theta =25 %input(' input the wedge angle = ')
theta = theta /2
L = 1.5
d = 0.01
r = d/2
height_wedge = r*cosd(theta)
width_wedge = r*sind(theta)
b1=('/*--------------------------------*- C++ -*----------------------------------*')
b2=(' ========= |')
b3=(' \ / F ield | OpenFOAM: The Open Source CFD Toolbox')
b4=(' \ / O peration | Website: https://openfoam.org')
b5=(' \ / A nd | Version: 8')
b6=(' \/ M anipulation |')
b7=('*---------------------------------------------------------------------------*/')
f1 = fopen('blockmesh.txt','w')
fprintf(f1,'%s n',b1)
fprintf(f1,'%s n',b2)
fprintf(f1,'%s n',b3)
fprintf(f1,'%s n',b4)
fprintf(f1,'%s n',b5)
fprintf(f1,'%s n',b6)
fprintf(f1,'%s n',b7)
fprintf(f1,'FoamFile n{ n version 2.0; n format ascii; n class dictionary; n object blockMeshDict; n}' )
b8 =('// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //')
fprintf(f1,'n%s n',b8)
fprintf(f1,'nconvertToMeters 1;')
fprintf(f1,'nnvertices n( nn')
%creating the vertices
fprintf(f1,' (0 0 0)')
fprintf(f1,'n (0 0 0)')
ver3 = zeros(1,3)
ver4 = zeros(1,3)
ver3(2) = height_wedge
ver3(3) = -width_wedge
ver4(2) =height_wedge
ver4(3) = width_wedge
fprintf(f1,'n (%f %f %f )',ver3)
fprintf(f1,'n (%f %f %f )nn',ver4)
fprintf(f1,' (1.5 0 0)')
fprintf(f1,'n (1.5 0 0)')
ver3 = zeros(1,3)
ver4 = zeros(1,3)
ver3(1) =L
ver3(2) = height_wedge
ver3(3) = -width_wedge
ver4(1) =L
ver4(2) =height_wedge
ver4(3) = width_wedge
fprintf(f1,'n (%d %f %f )',ver3)
fprintf(f1,'n (%d %f %f )n',ver4)
fprintf(f1,'n );nn')
fprintf(f1,'blocks n(n')
fprintf(f1,' hex (0 1 2 3 4 5 6 7) (1 20 100) simpleGrading (1 0.4 1) n); nedges n( n); n')
fprintf(f1,'boundary n( n top n { n type wall; n faces n ( n (2 3 7 6) n ); n }')
fprintf(f1,'n bottom n { n type empty; n faces n ( n (1 5 4 0) n ); n }')
fprintf(f1,'n frontwedge n { n type wedge; n faces n ( n (0 4 7 3) n ); n }')
fprintf(f1,'n backwedge n { n type wedge; n faces n ( n (1 2 6 5) n ); n }')
fprintf(f1,'n inlet n { n type patch; n faces n ( n (1 0 3 2) n ); n }')
fprintf(f1,'n outlet n { n type patch; n faces n ( n (5 6 7 4) n ); n }')
fprintf(f1,'n); nnmergePatchPairs n( n);')
b9 =('// ************************************************************************* //')
fprintf(f1,'nn%s',b9)
fclose(f1)
Blockmesh file for 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 1;
vertices
(
(0 0 0)
(0 0 0)
(0.000000 0.004981 -0.000436 )
(0.000000 0.004981 0.000436 )
(1.5 0 0)
(1.5 0 0)
(1.500000e+00 0.004981 -0.000436 )
(1.500000e+00 0.004981 0.000436 )
);
blocks
(
hex (0 1 2 3 4 5 6 7) (1 20 100) simpleGrading (1 0.4 1)
);
edges
(
);
boundary
(
top
{
type wall;
faces
(
(2 3 7 6)
);
}
bottom
{
type empty;
faces
(
(1 5 4 0)
);
}
frontwedge
{
type wedge;
faces
(
(0 4 7 3)
);
}
backwedge
{
type wedge;
faces
(
(1 2 6 5)
);
}
inlet
{
type patch;
faces
(
(1 0 3 2)
);
}
outlet
{
type patch;
faces
(
(5 6 7 4)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Like this for other wedge angles, block mesh files are created.
RESULTS:
Mesh generation for wedge angle 10:

Velocity contour on wedge angle 10:

Velocity curve for wedge angle 10:

Shear stress on wedge angle 10:

Mesh generation for wedge angle 25:

Velocity contour on wedge angle 25:

Velocity curve for wedge angle 25:

Shear stress on wedge angle 25:

Mesh generation on wedge angle 45:

Velocity contour for wedge angle 45:

Velocity curve on wedge angle 45:

Shear stress on wedge angle 45:
