Challenge

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

CONTINUATION OF WEEEK 11(THEORY)

MATLAB PROGRAM FOR BLOCKMESH DICT

PREPROCSSED SHEAR STRESS SAME AS IN WEEK 11 PART 1

%11
clear all
close all
clc
rno=2100;
r=0.005;
d=2*r;
ang=input('enter the value of angle');
%dynamic viscosity
dv=0.1874;
%water density
rho=1000;
%kinematic viscosity
kv=dv/rho;
le=0.12*rno*r;
lt=le+0.25*le;
vavg=(rno*kv)/(2*rho);
vmax=2*vavg;
dp=(8*dv*vavg*lt)/r^2;
%kinematic pressure
pk=dp/rho;

k=linspace(-r,r,1000)
for i=1:length(k)
    tu(i)=2*vmax*dv*(abs(k(i)))/r^2;
end
plot(k,tu,'b')
xlabel('radius')
ylabel('shear stress')
grid on
legend('post processed shear stress')
    
p0=[0 0 0]
p1=[0 r*cosd(ang/2) -r*sind(ang/2)]
p2=[0 r*cosd(ang/2) r*sind(ang/2)]
p3=[lt 0 0]
p4=[lt r*cosd(ang/2) -r*sind(ang/2)]
p5=[lt r*cosd(ang/2) r*sind(ang/2)]
f1=fopen('blockMeshDict.txt','w')
%creating blockMeshDict file in openFoam
l1='/*------------------------------------*-C++ -*---------------------------------*|';
l2='| =========                             |                                       |';
l3='| \\      /F ield                       | openFoam:  The open source CFD toolbox|';
l4='|  \\    / O operation                  | website:   https://opemfoam.org       |';
l5='|   \\  /  A nd                         | Version:   8                          |';
l6='|    \\/ M manipulation                 |                                       |';
l7='\*-----------------------------------------------------------------------------*/';
l8='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';

fprintf(f1,'%s\n',l1)
fprintf(f1,'%s\n',l2)
fprintf(f1,'%s\n',l3)
fprintf(f1,'%s\n',l4)
fprintf(f1,'%s\n',l5)
fprintf(f1,'%s\n',l6)
fprintf(f1,'%s\n \n',l7)
fprintf(f1,'FoamFile \n {\n')
fprintf(f1,'%16s %10s\n','version','2.0;')
fprintf(f1,'%16s %12s\n','format','ascii;')
fprintf(f1,'%16s %17s\n','class','dictionary;')
fprintf(f1,'%16s %20\n','object','blockMeshDict;')
fprintf(f1,'%2s\n','}')

fprintf(f1,'%2s\n\n','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//');
fprintf(f1,'%2s\n\n','convertToMeters 1;')
fprintf(f1,'vertices \n (\n')
fprintf(f1,'\t(%d %d %d)\n',p0)
fprintf(f1,'\t(%d %d %d)\n',p1)
fprintf(f1,'\t(%d %d %d)\n',p2)
fprintf(f1,'\t(%d %d %d)\n',p3)
fprintf(f1,'\t(%d %d %d)\n',p4)
fprintf(f1,'\t(%d %d %d)\n',p5)
fprintf(f1,' %2s\n\n', ');')

fprintf(f1,'blocks \n (\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\n')

fprintf(f1,'edges \n (\n')
fprintf(f1,' \t %s (0 %d 0)\n','arc 1 2',r)
fprintf(f1,'\t %s (%d %d 0)\n','arc 4 5',r)
fprintf(f1,' %2s\n\n', ');')

fprintf(f1,'boundary \n (\n')
fprintf(f1,'\t %5s \n','axis','{')
fprintf(f1,'\t %13s \n','type','empty;')
fprintf(f1,'\t %14s \n%18s\n','faces','(')
fprintf(f1,'\t \t %15s\n %19s\n\n %14s\n\n','(0 3 3 0)',');','}')

fprintf(f1,' \t %5s \n','top','{')
fprintf(f1,'\t %13s \n','type','wall;')
fprintf(f1,'\t %14s \n%18s\n','faces','(')
fprintf(f1,'\t \t %15s\n %19s\n\n %14s\n\n','(1 4 5 2)',');','}')

fprintf(f1,' \t %5s \n','inlet','{')
fprintf(f1,'\t %13s \n','type','patch;')
fprintf(f1,'\t %14s \n%18s\n','faces','(')
fprintf(f1,'\t \t %15s\n %19s\n\n %14s\n\n','(0 1 2 0)',');','}')

fprintf(f1,' \t %5s \n','outlet','{')
fprintf(f1,'\t %13s \n','type','patch;')
fprintf(f1,'\t %14s \n%18s\n','faces','(')
fprintf(f1,'\t \t %15s\n %19s\n\n %14s\n\n','(3 5 4 3)',');','}')

fprintf(f1,' \t %5s \n','front','{')
fprintf(f1,'\t %13s \n','type','wedge;')
fprintf(f1,'\t %14s \n%18s\n','faces','(')
fprintf(f1,'\t \t %15s\n %19s\n\n %14s\n\n','(0 3 4 1)',');','}')

fprintf(f1,' \t %5s \n','back','{')
fprintf(f1,'\t %13s \n','type','wedge;')
fprintf(f1,'\t %14s \n%18s\n','faces','(')
fprintf(f1,'\t \t %15s\n %19s\n\n %14s\n\n','(0 2 5 3)',');','}',');')

fprintf(f1,'mergePatchPairs \n (\n );\n')
fprintf(f1,'%2s\n\n','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//')

fclose(f1)



 

WEDGE ANGLES

ONLY THE ANGLES CHANGE REMAINING ALL PARAMETERS RAEMAIN SAME

ANGLE =10 DEGREE

blockMeshDict file

CROSS SECTION OF THE WEDGE

MESH REPRESENTSTION OF THE GEOMETRY(PRESSURE MESH AT AN INSTANT)

VELOCITY MESHING AT AN INSTANT

VELOCITY MESSING AT THE END

PLOT OF U,P ALONG THE LENGTH OF THE GEOMETRY

controldicr,transportproperties,p,U remain same for all

CONTROL DICT:
 
/*--------------------------------*- 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;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         8;

deltaT          4.4469e-04;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

 
VELOCITY:
 
/*--------------------------------*- 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.1874 0 0);

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

    outlet
    {
        type            zeroGradient;
    }
    
    axis
    {
        type            empty;
    }
    
    top
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }
    
    front
    {
        type            wedge;
    }
    
    back
    {
        type            wedge;
    }
}

// ************************************************************************* //
 
PRESSURE:
 
/*--------------------------------*- 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.10709;
    }

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

// ************************************************************************* //
 
TRANSPORT PROPERTIES:
 
/*--------------------------------*- 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;
    location    "constant";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

nu              [0 2 -1 0 0 0 0] 8.9267e-07;


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


ANGLE =25 DEGREES

BLOCKESHDICTFILE

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

vertices
(
	 (0 0 0)
	 (0 0.0488 0.0108)
	 (0 0.0488 -0.0108)
	 (2 0 0)
	 (2 0.0488 0.0108)
	 (2 0.0488 -0.0108)
);

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

);

edges
(
	 arc 1 2 (0 5.000000e-02 0)
	 arc 4 5 (2 5.000000e-02 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)
		 );
	 }
	 front
	 {
		 type wedge;
		 faces
		 (
			 (0 3 4 1)
		 );
	 }
	 back
	 {
		 type wedge;
		 faces
		 (
			 (0 2 5 3)
		 );
	 }
	 axis
	 {
		 type empty;
		 faces
		 (
			 (0 3 3 0)
		 );
	 }
); 

mergePatchPairs
(
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//

);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

same plots

pressure messhing

wedge cross section

prsssure meshing

plot

ANGLE =45 DEGREES

for 45 degrees,the y and z for changable points is 0.0462 and 0.0191 respesctively

and the wedge angel get inceased.

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.