Challenge

Week 12 - Symmetry vs Wedge vs HP equation

Symmetry vs Wedge vs HP equation:

Problem: To simulate the flow in pipe using Symmetry Boundary Conditions

Theory: Symmetry Boundary Constraint

This boundary condition enforces a symmetry constraint.

Usage

Example of the boundary condition specification:

patch name

{

type symmetry;


}

The symmetry condition should only be used if the physical object or geometry and the expected flow field pattern of the developed solution is mirrored along that surface. Unlike symmetryPlane, which is only used for planar patch, it is used for for any patch with symmetry Plane condition.

Matlab Program:

close all
clear all
clc

l1= '/*--------------------------------*- C++ -*----------------------------------*\';
l2= ' ========= |';
l3= ' \\ / F ield | OpenFOAM: The Open Source CFD Toolbox';
l4= ' \\ / O peration | Website: https://openfoam.org';
l5= ' \\ / A nd | Version: 7';
l6= ' \\/ M anipulation |';
l7= '\*---------------------------------------------------------------------------*/';
l8= 'FoamFile';
l9= '{ version 2.0;';
l10= ' format ascii;';
l11= ' class dictionary;';
l12= ' object blockMeshDict;}';

l13= '// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
l14= 'convertToMeters 0.001;';

l15= 'vertices';
blockmesh= fopen('blockMeshDict.txt','w')
fprintf(blockmesh, '%s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n',l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15);

r= 5;
th = input('Enter the wedge angle 10,25,45 =');

fprintf(blockmesh, '(\n (%f %f %f)\n',2000,0,0);
fprintf(blockmesh, ' (%f %f %f)\n',2000,r*cosd(th/2),r*sind(th/2));
fprintf(blockmesh, ' (%f %f %f)\n',2000,r*cosd(th/2),-r*sind(th/2));
fprintf(blockmesh, ' (%f %f %f)\n',0,0,0);
fprintf(blockmesh, ' (%f %f %f)\n',0,r*cosd(th/2),r*sind(th/2));
fprintf(blockmesh, ' (%f %f %f)\n );',0,r*cosd(th/2),-r*sind(th/2));

fprintf(blockmesh, '\n blocks \n(\n hex (%d %d %d %d %d %d %d %d) (1 50 150) simpleGrading (1 0.1 1)\n);',0,0,1,2,3,3,4,5);

fprintf(blockmesh, '\n edges\n(\n arc %d %d(%d %d %d)\n',1,2,2000,r,0);
fprintf(blockmesh, '\n arc %d %d(%d %d %d)\n);',4,5,0,r,0);

fprintf(blockmesh, '\nboundary\n(\n');
fprintf(blockmesh, '\tInlet\n\t{\n');
fprintf(blockmesh, '\t type patch;\n');
fprintf(blockmesh, '\t faces\n\t (\n');
fprintf(blockmesh, '\t\t(3 5 4 3)\n\t );\n\t}\n\n');

fprintf(blockmesh, '\tOutlet\n\t{\n');
fprintf(blockmesh, '\t type patch;\n');
fprintf(blockmesh, '\t faces\n\t (\n');
fprintf(blockmesh, '\t\t(0 1 2 0)\n\t );\n\t}\n\n');

fprintf(blockmesh, '\tUpper\n\t{\n');
fprintf(blockmesh, '\t type wall;\n');
fprintf(blockmesh, '\t faces\n\t (\n');
fprintf(blockmesh, '\t\t(4 5 2 1)\n\t );\n\t}\n\n');

fprintf(blockmesh, '\tfront\n\t{\n');
fprintf(blockmesh, '\t type symmetry;\n');
fprintf(blockmesh, '\t faces\n\t (\n');
fprintf(blockmesh, '\t\t(0 3 4 1)\n\t );\n\t}\n\n');

fprintf(blockmesh, '\tback\n\t{\n');
fprintf(blockmesh, '\t type symmetry;\n');
fprintf(blockmesh, '\t faces\n\t (\n');
fprintf(blockmesh, '\t\t(0 2 5 3)\n\t );\n\t}\n\n');

fprintf(blockmesh, '\taxis\n\t{\n');
fprintf(blockmesh, '\t type empty;\n');
fprintf(blockmesh, '\t faces\n\t (\n');
fprintf(blockmesh, '\t\t(0 3 3 0)\n\t );\n\t}\n);\n');

fprintf(blockmesh, '\n mergePatchPairs\n(\n );');

fprintf(blockmesh, '\n// ************************************************************************* //');

This program gives us a blockMeshDict.txt file when the required wedge angle is entered. Let's assume the wedge angle as 10 deg. The blockMeshDict will be :

blockMeshDict:

/*--------------------------------*- 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 0.001;
vertices
(
(2000.000000 0.000000 0.000000)
(2000.000000 4.980973 0.435779)
(2000.000000 4.980973 -0.435779)
(0.000000 0.000000 0.000000)
(0.000000 4.980973 0.435779)
(0.000000 4.980973 -0.435779)
);
blocks
(
hex (0 0 1 2 3 3 4 5) (1 50 150) simpleGrading (1 0.1 1)
);
edges
(
arc 1 2(2000 5 0)

arc 4 5(0 5 0)
);
boundary
(
Inlet
{
type patch;
faces
(
(3 5 4 3)
);
}

Outlet
{
type patch;
faces
(
(0 1 2 0)
);
}

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

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

back
{
type symmetry;
faces
(
(0 2 5 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
{
Inlet
{
type zeroGradient;
}

Outlet
{
type fixedValue;
value uniform 0.106;
}
Upper
{
type zeroGradient;
}
front
{
type symmetry;
}
back
{
type symmetry;
}

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.1869 0 0);
boundaryField
{
Inlet
{
type fixedValue;
value uniform (0.1869 0 0);
}
Outlet
{
type zeroGradient;
}
Upper
{
type noSlip;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
axis
{
type empty;
}
}
// ************************************************************************* //
controlDict:
/*--------------------------------*- 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;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 5;
deltaT 0.005;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;

// ************************************************************************* //
transportProperties:
/*--------------------------------*- 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;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 8.9e-7;

// ************************************************************************* //
1) For wedge = 10 degree
Image 1
Image 2
Graph at x= 0.05m
Graph at x= 1.3m
2) For wedge = 25 deg
Image- 1
Image- 2
Image- 3
At x= 0.05
At x= 1.3
3) For wedge= 45 degree
Image- 1
Image- 2
Image- 3
For x= 0.05m
For x= 1.3 m
Now, Analysing the results:
1) For wedge= 10 degree
Max. Velocity= 0.369885 m/s
Mean Courant number= 0.0734259
Max. Courant number= 0.454421
2) For wedge= 25 degree
Max. Velocity= 0.370756 m/s
Mean Courant number= 0.0734289
Max. Courant number= 0.457355
3) For Wedge= 45 degree
Max. Velocity= 0.371668 m/s
Mean Courant number= 0.0734338
Max. Courant number= 0.466393
4) Analytical result
Velocity= 0.3738 m/s
Therefore, it can be see that as the wedge angle is increasing the solution is becoming more closer to Analytical results. But as the wedge angle is increasing the simulation is taking more time.
 
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.