Project

Symmetry vs Wedge Vs HP equation for flow through pipe (OPENFoam)

AIM:

Task is to make the simulation work with Symmetry Boundary Condition. Angles to test 10,25,45

OBJECTIVE:

    • obtaining the results from solving the Hagen Poisuelle's equation
    • obtaining results from simulating the pipe flow with the wedge BC
    • obtaining results for the pipe flow with symmetry B
    • Writing a Matlab program that takes an angle as input and generates a blockMesh file for the given angle.

Matlab code:

clear
close all
clc

Re = 2100;
D = 0.015;
L = 0.06*Re*D;

R = D/2;
mu = 0.890e-3;
rho = 997;

n1 = 1;
n2 = 50;
n3 = 200;
gfactor =0.2;

fprint('enter 10,25,45 for wedge Bc')
theta = input('enter the angle: ')%symmetry
v_avg = (Re*mu)/(rho*D);
v_max = 2*(v_avg);
del_p = (32*mu*L*v_avg)/(D^2);
kinematic = del_p/rho;
c0 = [0 0 0];
c1 = [0 R*cosd(theta/2) R*sind(theta/2)];
c2 = [0 R*cosd(theta/2) -R*sind(theta/2)];
c3 = [0 0 L];
c4 = [L R*cosd(theta/2) R*sind(theta/2)];
c5 = [L R*cosd(theta/2) -R*sind(theta/2)];



line1 = ('/*--------------------------------*- C++ -*----------------------------------*');
line2 = ('| =========                                                                   |');
line3 = ('| \      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |');
line4 = ('|  \    /   O peration     | Website:  https://openfoam.org                  |');
line5 = ('|   \  /    A nd           | Version:  7                                     |');                     
line6 = ('|    \/     M anipulation  |                                                 |');
line7 = ('*---------------------------------------------------------------------------*/');
line8 = ('// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //');

fileID = fopen('blockMeshDict.txt','wt');
fprintf(fileID,'%sn',line1);
fprintf(fileID,'%sn',line2);
fprintf(fileID,'%sn',line3);
fprintf(fileID,'%sn',line4);
fprintf(fileID,'%sn',line5);
fprintf(fileID,'%sn',line6);
fprintf(fileID,'%sn',line7);
fprintf(fileID,'FoamFilen{n');
fprintf(fileID,'%16s t 2.0;n','version');
fprintf(fileID,'%16s t ascii;n','format');
fprintf(fileID,'%16s t dictionary;n','class');
fprintf(fileID,'%16s t blockMeshDict;n}n','object');
fprintf(fileID,'%snn',line8);
%vertices
fprintf(fileID,'convertToMeters 1;nn');
fprintf(fileID,'verticesn(n');
fprintf(fileID,'t(%d %d %d)n',c0(1),c0(2),c0(3));
fprintf(fileID,'t(%d %d %d)n',c1(1),c1(2),c1(3));
fprintf(fileID,'t(%d %d %d)n',c2(1),c2(2),c2(3));
fprintf(fileID,'t(%d %d %d)n',c3(1),c3(2),c3(3));
fprintf(fileID,'t(%d %d %d)n',c4(1),c4(2),c4(3));
fprintf(fileID,'t(%d %d %d)n);nn',c5(1),c5(2),c5(3));
fprintf(fileID,'blocksn(n');
fprintf(fileID,'t hex (0 0 1 2 3 3 4 5) (1 50 200) simplegrading (1 0.5 1)n');
fprintf(fileID,');n');
fprintf(fileID,'t arc 1 2 (%d %d %d)n',0, R, 0);
fprintf(fileID,'t arc 4 5 (%d %d %d)n',L, R, 0);
fprintf(fileID,');n');
fprintf(fileID,'boundaryn(n');
fprintf(fileID,'t inflown');
fprintf(fileID,'t {n');
fprintf(fileID,'t  type patch;n');
fprintf(fileID,'t facesn');
fprintf(fileID,'t (n');
fprintf(fileID,'tt (0 0 2 1)n');
fprintf(fileID,'t );n');
fprintf(fileID,'t }nn');
fprintf(fileID,'t outflown');
fprintf(fileID,'t {n');
fprintf(fileID,'t type patch ;n');
fprintf(fileID,'t facesn');
fprintf(fileID,'t (n');
fprintf(fileID,'tt (3 4 5 3)n');
fprintf(fileID,'t );n');
fprintf(fileID,'t }n');
fprintf(fileID,'t pipen');
fprintf(fileID,'t {n');
fprintf(fileID,'t type wall;n');
fprintf(fileID,'t facesn');
fprintf(fileID,'t (n');
fprintf(fileID,'tt (4 1 2 5)n');
fprintf(fileID,'t );n');
fprintf(fileID,'t }n');
fprintf(fileID,'t wedgebackn');
fprintf(fileID,'t {n');
fprintf(fileID,'t type symmetry;n');
fprintf(fileID,'t facesn');
fprintf(fileID,'t (n');
fprintf(fileID,'tt (3 5 2 0)n');
fprintf(fileID,'t );n');
fprintf(fileID,'t }n');
fprintf(fileID,'t wedgefrontn');
fprintf(fileID,'t {n');
fprintf(fileID,'t type symmetry;n');
fprintf(fileID,'t facesn');
fprintf(fileID,'t (n');
fprintf(fileID,'tt (0 1 4 3)n');
fprintf(fileID,'t );n');
fprintf(fileID,'t }n');
fprintf(fileID,'t axisn');
fprintf(fileID,'t (n');
fprintf(fileID,'t type empty;n');
fprintf(fileID,'t facesn');
fprintf(fileID,'t (n');
fprintf(fileID,'tt (0 3 3 0)n');
fprintf(fileID,'t );n');
fprintf(fileID,'t }n');
fprintf(fileID,'t );n');
fprintf(fileID,'mergePatchPairsn');
fprintf(fileID,'(n');
fprintf(fileID,');n');

fprintf(fileID,'%s',line8);

fclose(fileID);

blockMeshdict 10d

/*--------------------------------*- 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.000000 0.000000 0.000000)
(0.000700 0.007480 0.000000)
(-0.000700 0.007480 0.000000)
(0.000000 0.000000 1.890000)
(0.000700 0.007480 1.890000)
(-0.000700 0.007480 1.890000)

);

blocks
(
hex (0 0 1 2 3 3 4 5) (1 50 200) simpleGrading (1 0.5 1)

);

edges
(
arc 1 2 (0.000000 0.007500 0.000000)
arc 4 5 (0.000000 0.007500 1.890000)
);

boundary
(
inflow
{
type patch;
faces
(
(0 0 1 2)
);
}
outflow
{
type patch;
faces
(
(3 4 5 3)
);
}
pipe
{
type wall;
faces
(
(4 1 2 5)

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


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


);
}
axis
{
type empty;
faces
(
(0 3 3 0)

);
}
);

mergePatchPairs
(
);

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

pressure

/*--------------------------------*- 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
{
inflow
{
type zeroGradient;
}
outflow
{
type fixedValue;
value uniform 0.029;
}
wedgefront
{
type symmetry;
}
wedgeback
{
type symmetry;
}
pipe
{
type zeroGradient;
}
axis
{
type empty;
}
}

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

velocity

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

boundaryField
{
inflow
{
type fixedValue;
value uniform (0 0 0.125);
}
outflow
{
type zeroGradient;
}
pipe
{
type noSlip;
}
wedgefront
{
type symmetry;
}
wedgeback
{
type symmetry;
}
axis
{
type empty;
}
}

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

MATLAB coding, BlockMeshDict, Pressure and Velocity is same for all symmetry conditions and changing only theta value.

theta 10

c0 =0 0 0

c1 =0 0.0074 0.0007

c2 =0 0.0074 -0.0007

c3 =0 0 1.8900

c4 = 1.8900 0.0074 0.0007

c5 = 1.8900 0.0074 -0.0007

theta 25

c0 =0 0 0

c1 = 0 0.0073 0.0016

c2 =0 0.0073 -0.0016

c3 =0 0 1.8900

c4 =1.8900 0.0073 0.0016

c5 =1.8900 0.0073 -0.0016

theta 45

c0 =0 0 0

c1 = 0 0.0069 0.0029

c2 =0 0.0069 -0.0029

c3 =0 0 1.8900

c4 =1.8900 0.0069 0.0029

c5 =1.8900 0.0069 -0.0029

plots for angle@10
0.05
0.945
1.89
plots for angle@25
0.05
0.945
1.89
plots for angle@45
0.05
0.945
1.89

Conclusion:

symmetry boundary condition is more accurate than wedge boundary condition.

But symmetry takes longer execution time than wedge.

U_magnitude

Symmetry@10

Symmetry@25

Symmetry@45

0.05

0.15276

0.156923

0.158609

0.945

0.236781

0.238084

0.240682

1.89

0.246043

0.2473

0.248285

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.