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:
========= |
\\ / 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
{
Inlet
{
type zeroGradient;
}
Outlet
{
type fixedValue;
value uniform 0.106;
}
type zeroGradient;
}
{
type symmetry;
}
{
type symmetry;
}
axis
{
type empty;
}
Velocity:
========= |
\\ / 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
{
Inlet
{
type fixedValue;
value uniform (0.1869 0 0);
}
{
type zeroGradient;
}
{
type noSlip;
}
{
type symmetry;
}
{
type symmetry;
}
{
type empty;
}
}
========= |
\\ / 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //
========= |
\\ / 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //