Project

Symmetry vs Wedge vs HP equation

All the inputs have been discussed in the exercise of the week - 11.

For 10 degree angle in symmetry boundary condition, all the samples have been given here. For the rest, these will be almost same.

MATLAB Programme to generate block mesh file for 10 degree:

clear all
close all
clc

%% Inputs
L = 1.5;
theta = 10;
r = 0.005;
a = 1;
b = 0.2;
c = 1;
nx = 200;
ny = 20;
nz =1;

%% 
line1=\'/*--------------------------------*- C++ -*----------------------------------*\\\';
line2=\' =========               |                                                     \';
line3=\' \\\\      / F ield        | OpenFOAM: The Open Source CFD Toolbox               \';
line4=\'  \\\\    /  O peration    | Version: 4.1                                        \';
line5=\'   \\\\  /   A nd          | Web: www.OpenFOAM.org                               \';
line6=\'    \\\\/    M anipulation |                                                     \';
line7=\'\\*---------------------------------------------------------------------------*/\';
line8=\'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//\';
line9=\'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//\';

bmd = fopen(\'blockMeshDict\',\'wt\')

fprintf(bmd,\'%s\\n\',line1);
fprintf(bmd,\'%s\\n\',line2);
fprintf(bmd,\'%s\\n\',line3);
fprintf(bmd,\'%s\\n\',line4);
fprintf(bmd,\'%s\\n\',line5);
fprintf(bmd,\'%s\\n\',line6);
fprintf(bmd,\'%s\\n\',line7);


fprintf(bmd,\'FoamFile\\n{\\n\');
fprintf(bmd,\'%18s \\t 2.0;\\n\',\'version\');
fprintf(bmd,\'%18s \\t ascii;\\n\',\'format\');
fprintf(bmd,\'%18s \\t dictionary;\\n\',\'class\');
fprintf(bmd,\'%18s \\t blockMeshDict;\\n\',\'object\');
fprintf(bmd,\'}\\n\');

fprintf(bmd, \'%s\\n\\n\',line8);

%% Vertices and blocks
fprintf(bmd, \'convertToMeters 1; \\n\\n\');
fprintf(bmd, \'vertices\\n(\\n\');
fprintf(bmd, \'\\t (%d %d %d)\\n\', 0,0,0);
fprintf(bmd, \'\\t (%d %d %d)\\n\', L,0,0);
fprintf(bmd, \'\\t (%d %d %d)\\n\', L, r*cosd(theta/2), r*sind(theta/2));
fprintf(bmd, \'\\t (%d %d %d)\\n\', 0, r*cosd(theta/2), r*sind(theta/2));
fprintf(bmd, \'\\t (%d %d %d)\\n\', 0, r*cosd(theta/2), -r*sind(theta/2));
fprintf(bmd, \'\\t (%d %d %d)\\n\', L, r*cosd(theta/2), -r*sind(theta/2));
fprintf(bmd, \');\\n\\n\');

fprintf(bmd, \'blocks\\n(\\n\');
fprintf(bmd,\'\\t hex (0 1 5 4 0 1 2 3)(%d %d %d)\', nx,ny,nz);
fprintf(bmd, \'simplegrading (%d %d %d)\\n\',a,b,c);
fprintf(bmd, \');\\n\\n\');
fprintf(bmd, \'edges\\n(\\n\\t arc %d %d (%d %d %d)\\n\',4,3,0,r,0);
fprintf(bmd, \'\\t arc %d %d (%d %d %d)\\n\',5,2,L,r,0);
fprintf(bmd, \');\\n\\n\');

fprintf(bmd, \'boundary\\n(\\n\');
%% Inlet patch
fprintf(bmd, \'\\t inlet\\n\');
fprintf(bmd, \'\\t{\\n\');
fprintf(bmd, \'\\t\\t type patch;\\n\');
fprintf(bmd, \'\\t\\t faces\\n\');
fprintf(bmd, \'\\t\\t ( \\n\');
fprintf(bmd, \'\\t\\t\\t (%d %d %d %d)\\n\', 0,0,3,4);
fprintf(bmd, \'\\t\\t ); \\n\');
fprintf(bmd, \'\\t } \\n\');

%% Outlet : patch
fprintf(bmd, \'\\t outlet\\n\');
fprintf(bmd, \'\\t{\\n\');
fprintf(bmd, \'\\t\\t type patch;\\n\');
fprintf(bmd, \'\\t\\t faces\\n\');
fprintf(bmd, \'\\t\\t ( \\n\');
fprintf(bmd, \'\\t\\t\\t (%d %d %d %d)\\n\', 1,5,2,1);
fprintf(bmd, \'\\t\\t ); \\n\');
fprintf(bmd, \'\\t } \\n\');

%% Front surface: symmetry 1
fprintf(bmd, \'\\t front\\n\');
fprintf(bmd, \'\\t{\\n\');
fprintf(bmd, \'\\t\\t type symmetry;\\n\');
fprintf(bmd, \'\\t\\t faces\\n\');
fprintf(bmd, \'\\t\\t ( \\n\');
fprintf(bmd, \'\\t\\t\\t (%d %d %d %d)\\n\', 0,1,2,3);
fprintf(bmd, \'\\t\\t ); \\n\');
fprintf(bmd, \'\\t } \\n\');

%% Back Surface : symmetry 2
fprintf(bmd, \'\\t back\\n\');
fprintf(bmd, \'\\t{\\n\');
fprintf(bmd, \'\\t\\t type symmetry;\\n\');
fprintf(bmd, \'\\t\\t faces\\n\');
fprintf(bmd, \'\\t\\t ( \\n\');
fprintf(bmd, \'\\t\\t\\t (%d %d %d %d)\\n\', 0,4,5,1);
fprintf(bmd, \'\\t\\t ); \\n\');
fprintf(bmd, \'\\t } \\n\');

%% Axis : empty
fprintf(bmd, \'\\t axis\\n\');
fprintf(bmd, \'\\t{\\n\');
fprintf(bmd, \'\\t\\t type empty;\\n\');
fprintf(bmd, \'\\t\\t faces\\n\');
fprintf(bmd, \'\\t\\t ( \\n\');
fprintf(bmd, \'\\t\\t\\t (%d %d %d %d)\\n\', 0,1,1,0);
fprintf(bmd, \'\\t\\t ); \\n\');
fprintf(bmd, \'\\t } \\n\');

%% Pipe Wall : wall 
fprintf(bmd, \'\\t pipewall\\n\');
fprintf(bmd, \'\\t{\\n\');
fprintf(bmd, \'\\t\\t type wall;\\n\');
fprintf(bmd, \'\\t\\t faces\\n\');
fprintf(bmd, \'\\t\\t ( \\n\');
fprintf(bmd, \'\\t\\t\\t (%d %d %d %d)\\n\', 3,2,5,4);
fprintf(bmd, \'\\t\\t ); \\n\');
fprintf(bmd, \'\\t } \\n\');
fprintf(bmd, \');\\n\');

%%
fprintf(bmd, \'mergePatchPairs\\n(\\n\');
fprintf(bmd, \');\\n\');
fprintf(bmd, \'%s \\n\', line9);

fclose (bmd)

Generated BlockmeshDict file for 10 degree symmetry angle:

/*--------------------------------*- C++ -*----------------------------------*\\
 =========               |                                                     
 \\\\      / F ield        | OpenFOAM: The Open Source CFD Toolbox               
  \\\\    /  O peration    | Version: 4.1                                        
   \\\\  /   A nd          | Web: www.OpenFOAM.org                               
    \\\\/    M anipulation |                                                     
\\*---------------------------------------------------------------------------*/
FoamFile
{
           version 	 2.0;
            format 	 ascii;
             class 	 dictionary;
            object 	 blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//

convertToMeters 1; 

vertices
(
	 (0 0 0)
	 (1.500000e+00 0 0)
	 (1.500000e+00 4.980973e-03 4.357787e-04)
	 (0 4.980973e-03 4.357787e-04)
	 (0 4.980973e-03 -4.357787e-04)
	 (1.500000e+00 4.980973e-03 -4.357787e-04)
);

blocks
(
	 hex (0 1 5 4 0 1 2 3)(200 20 1)simplegrading (1 2.000000e-01 1)
);

edges
(
	 arc 4 3 (0 5.000000e-03 0)
	 arc 5 2 (1.500000e+00 5.000000e-03 0)
);

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

Pressure Boundary Condition:

/*--------------------------------*- 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.0802;
    }

    axis
    {
        type            empty;
    }

    front
    {
        type            symmetry;
    }

    back
    {
        type            symmetry;
    }

    pipewall
    {
        type            zeroGradient;
    }
}

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

Velocity Boundary Condition:

/*--------------------------------*- 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
{
    inlet
    {
        type            fixedValue;
	value		uniform (0.1874 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }

    axis
    {
        type            empty;
    }

    front
    {
        type            symmetry;
    }

    back
    {
        type            symmetry;
    }

    pipewall
    {
        type            fixedValue;
	value		uniform (0 0 0);
    }
}

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

Control Dict file:

/*--------------------------------*- 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       latestTime;

startTime       0;

stopAt          endTime;

endTime         5;

deltaT          0.00005;

writeControl    timeStep;

writeInterval   1000;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

Transport Property file:

/*--------------------------------*- 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.90e-07;


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

Meshing File (For 10 degree):

Velocity Visualization from inlet (at the left):

Pressure Visualization (Left is inlet):

Velocity Magnitude (At x= 0.02 m):

Velocity Magnitude (At x= 1 m):

Pressure Magnitude (x axis: Inlet to outlet; Y-axis: Pressure):

To compare between wedge and symmetry boundary condition the case for 3 degree with wedge boundary condition has been simulated with symmetry condition. A result from the same has been compared at x=1 which shows no difference in velocity magnitude. But the time taken is different. For the wedge b.c., time taken is lesser than the symmetry b.c. But the calculated courant no turns out to be more than symmetry condition.

For the comparison of the different wedge angle in symmetry condition, the velocity profiles have been plotted at x= 0.02m and x=1 m. In both the cases, profiles have been plotted for 10, 25 and 45 degree of included angle between the symmetry faces.

From the result it has been found that near the wall viscosity is effecting more for lower angles and that\'s why for a longer transverse length near-wall the velocity is almost zero. Near the free stream i.e. near the axis, velocity is almost same for every angles.

Another conclusion is the time. The simulation time for larger angles are more than smaller angles.

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.