Challenge

Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation

objective-

1. To simulate the same problem as in previous challenge but by applying Symmetry Boundary Condition. for thrta 10 25 nad 45.

and here is matlab code for theta 10 to genrate the blockMeshDict file

L=1
theta=10
D=0.006
r=D/2
line1='/* --------------------------------------------------------------- C++  ---------------------------------------------*\';
line2='|= = = = = = = = =                |                                                 |'
line3='|  \\     /                       |               F    ield                                 openFoam :The  open SourceCFD Toolbox' 
line4='|  \\    /                        |               O    peration                           Version;      4.1'
line5='|  \\   /                         |               A    nd                                       Web: www.openFoam.org'
line6='|   \\  /                         |               M     anipulation'
line7='\-----------------------------------------------------------------------------------------------------------------------\'            

f1=fopen('blockMeshDict'  , 'w')
fprintf(f1,'%s\n', line1)
 fprintf(f1,'%s\n', line2)
 fprintf(f1,'%s\n', line3)
fprintf(f1,'%s\n', line4)
 fprintf(f1,'%s\n', line5)
fprintf(f1,'%s\n', line6)
fprintf(f1,'%s\n', line7)
fprintf(f1 ,'FoamFile\n{\n')
 fprintf(f1, '%12s  \t  2.0; \n' ,'version')
fprintf(f1, '%12s  \t  ascii; \n' ,'format')
fprintf(f1, '%12s  \t  dictionary; \n' ,'class')
fprintf(f1, '%12s  \t  blockMeshDict; \n' ,'object')
fprintf(f1, '}\n')
header8 ='// * * * * * * ****//'
fprintf(f1,'%s\n\n',header8)
fprintf(f1, 'convertToMeters   1 ;\n\n')
fprintf(f1 , 'vertices\n')
fprintf(f1,'(\n')
fprintf(f1, '\t   (%d %d %d)\n', 0 ,0,0) 
fprintf(f1, '\t   (%d %d %d)\n', 0 ,r*cosd(theta/2),sind(theta/2))
fprintf(f1, '\t   (%d %d %d)\n', 0 ,r*cosd(theta/2),-sind(theta/2))
fprintf(f1, '\t   (%d %d %d)\n', L,0,0)
fprintf(f1, '\t   (%d %d %d)\n', L ,r*cosd(theta/2),sind(theta/2))
fprintf(f1, '/t   (%d %d %d)\n', L ,r*cosd(theta/2),-sind(theta/2))
fprintf(f1, '); \n\n')
fprintf(f1,' blocks\n')
	fprintf(f1,'(\n')	
		

fprintf(f1, '\t hex  (0 3 5 2 0 3 4 1) (%d %d %d)',300,30,1)
fprintf(f1,' SimpleGrading  (1  0.1  1)\n\n')
fprintf(f1,');\n')
fprintf(f1, 'edges\n(\n\tarc %d %d  (%d %d %d)\n',1,2,0 ,r,0)



fprintf(f1, '\tarc %d %d  (%d %d %d)\n',4,5,L ,r,0)
fprintf(f1, ');\n\n')
fprintf(f1, 'boundary\n')
fprintf(f1,'(\n')
fprintf(f1, '\t  inlet   \n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t  type  patch  ;\n')
fprintf(f1, '\t \t faces\n')
fprintf(f1,'\t\t  (\n')
fprintf(f1, ' \t \t \t (0 1 2 0)\n')
fprintf(f1,'\t\t   );\n')
fprintf(f1,  '\t  }\n')
fprintf(f1, '\t  outlet   \n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t  type  patch  ;\n')
fprintf(f1, '\t \t faces\n')
fprintf(f1,'\t\t  (\n')
fprintf(f1, ' \t \t \t (3 5 4 3)\n')
fprintf(f1,'\t\t   );\n')
fprintf(f1,  '\t  }\n')
fprintf(f1, '\t  top   \n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t  type  wall  ;\n')
fprintf(f1, '\t \t faces\n')
fprintf(f1,'\t\t  (\n')
fprintf(f1, ' \t \t \t (1 4 5 2)\n')
fprintf(f1,'\t\t   );\n')
fprintf(f1,  '\t  }\n')
fprintf(f1, '\t  back \n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t  type  symmetry ;\n')
fprintf(f1, '\t \t faces\n')
fprintf(f1,'\t\t  (\n')
fprintf(f1, ' \t \t \t (0 2 5 3)\n')
fprintf(f1,'\t\t   );\n')
fprintf(f1,  '\t  }\n')
fprintf(f1, '\t  front \n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t  type  symmetry ;\n')
fprintf(f1, '\t \t faces\n')
fprintf(f1,'\t\t  (\n')
fprintf(f1, ' \t \t \t (0 3 4 1)\n')
fprintf(f1,'\t\t   );\n')
fprintf(f1,  '\t  }\n')

fprintf(f1, '\t  axis \n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t  type  empty ;\n')
fprintf(f1, '\t \t faces\n')
fprintf(f1,'\t\t  (\n')
fprintf(f1, ' \t \t \t (0 3 3 0)\n')
fprintf(f1,'\t\t   );\n')
fprintf(f1,  '\t  }\n')
fprintf(f1,');\n')
fprintf(f1,'mergePatchPairs\n(\n')
fprintf(f1, ');\n')
fprintf(f1, '%s\n',header8)
fclose(f1)

and generated blockMeshDict file is as follows

/*--------------------------------*- 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 2.988584e-03 8.715574e-02)
	   (0 2.988584e-03 -8.715574e-02)
	   (1 0 0)
	   (1 2.988584e-03 8.715574e-02)
   (1 2.988584e-03 -8.715574e-02)
); 

 blocks
(
	 hex  (0 3 5 2 0 3 4 1) (300 30 1) SimpleGrading  (1  0.1  1)

);
edges
(
	arc 1 2  (0 3.000000e-03 0)
	arc 4 5  (1 3.000000e-03 0)
);

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

/*--------------------------------*- 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       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    inlet
    {
        type            zeroGradient;
    }

    outlet
    {
        type            fixedValue;
        value           uniform 0.1552516;
    }

    top
    {
        type            zeroGradient;
        
    }
    back
    {
        type            symmetry;
        
    }
    front
    {
        type            symmetry;
        
    }
     axis
    {
        type            empty;
        
    }
}

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

/*--------------------------------*- 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       volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform (0.3115 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }

   top
    {
        type            noSlip;
    }
    back
    {
        type            symmetry;
    }
     front
    {
        type            symmetry;
    }
     axis
    {
        type            empty;
    }
}

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

for 25

for 45

the velocity for fully developed for theta 45 at distance of 0.75m

comparsion of analytical and simulation

wedge angle cournant number simulation_time velocity analytical simulation velocity error
10 0.341082 504.7 0.623 0.62269 0.00031
25 0.343641 498.49 0.623 0.6285 0.00015
45 0.350561 507.43 0.623 0.62 0.003
wedge angle(theta) courant number simulation time(sec) analytical maximum velocity(m/sec)

simulation velocity

3
10 0.341082 504.7
25 0.343641 498.49
45 0.350561 507.43
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.