Project

BlockMesh Drill down challenge

OBJECTIVE

  • To Generate the blockMesh file for the given Geometry using OpenFOAM and use the icoFoarn solver to
    simulate the low through a backward-facing step.
  • To create multiple meshes and will be comparing the results obtained from each mesh.
  • To show the velocity magnitude profile change as a function of mesh grading factor. Use Factors, 0.2, 0.5, 0.8
  • To Measure the velocity profile at 0.085 rn from the inlet of the geometry
  • To Plot a line plot

Mesh specification

  1. Number of cells along the x direction (longer dimension) = 200
  2. Number of cells along the y direction = 10
  3. Use a graded mesh. Grading factor near all walls should be 0.2,0.5,0.8

PROCEDURE

  1. In virtual box open the terminal
  2. Type \'tut\' and it takes you to the in-built tutorial ties of the OpenFOAM software.
  3. Type Is (list) to view the contents in the tutorials
  4. From that choose incompressible\'cd incompressible\'. and then \'ls\'. It takes into the incompressible directory file.
  5. Now type \'cd icoFoarn\'. then \'Is\', This step takes into the ice Foam directory file
  6. Type \'cd cavity and ls to list the contents.
  7. Copy cavity by type \'cp -r cavity/ $FOAM_RUN. This command copies the cavity and pastes directly in the run folder
  8. Type \'cd\' SFOAM RUN\'. It takes to the run folder which creates automatically by the software and we can see file that we copied.
  9. We need to get to cavity and system by changing directory so to proceede the process of editing Type \'Is\' to see the contents.There we see blockMeshDict, controlDict, fvschemes and fvslolution
  10. Get in to the editing text by typing \'gedit blockNieshDict. Here we structure the problem, applying the mesh grading, vertices long with that we also provide the the mesh grading factor in the patatheis of simple grading
  11. Similarly edit controlDict file where we provide the start time ,end time and time step ie deltat(remember that delta t must be given in such a way that the courant number doesnt exceeds.
  12. we move ahead to edit the velocity and pressure files according to the problem. for that, we need to go to \'0\' tile.
  13. Open the files using the change directory \'cd command.
  14. After all the editing and alllocating we further proceede to make mesh for the geometry so for that we use the command blockMesh
  15. To check whether the mesh is succesful we use checkMesh command
  16. After the succcessful mesh and calculation and we icoFoam to simalate
  17. Lastly type paraFaom,that to take us to para view an inbuilt.

IcoFoam

IcoFoam is a solver solves the incompressible laminar Navier-Stokes equations using the PISO {Pressure-Implicit with Splitting of Operators} algorithm. The code is inherently transient, requiring an initial condition (such as zero velocity) and boundary conditions. The icoFOAM code can take mesh non-orthogonality into account with successive non-orthogonality iterations. The number of PISO corrections and non-orthogonality corrections are controlled through user input.

Simple Grading

The ratio is that of the width of the end cell along one edge of a block to the
width of the start cell along that edge

POINTS TO BE NOTED

Never run the the simulation in the tutorial cause it may corrupt the file and we may end up option but to reinstall

Always use the correct syntax and make sure that spellings are correct and always end the line with semicolon

BlockMeshDict 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;
	object  	blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
	(0 0 0)      	// pt 0
	(0.08 0 0)   	// pt 1
	(0.08 0.005 0)   // pt 2
	(0 0.005 0)  	// pt 3
	(0.08 0.01 0)	// pt 4
	(0 0.01 0)    	// pt 5
	(0.2 0.01 0)  	// pt 6
	(0.2 0.005 0)  	// pt 7
	(0.2 0 0)    	// pt 8
	(0.2 -0.01 0) 	// pt 9
	(0.08 -0.01 0)	// pt 10
	(0 0 0.01)   	// pt 11
	(0.08 0 0.01)	// pt 12
	(0.08 0.005 0.01)// pt 13
	(0 0.005 0.01)   // pt 14
	(0.08 0.01 0.01) // pt 15
	(0 0.01 0.01)	// pt 16
	(0.2 0.01 0.01)  // pt 17
	(0.2 0.005 0.01) // pt 18
	(0.2 0 0.01) 	// pt 19
	(0.2 -0.01 0.01) // pt 20
	(0.08 -0.01 0.01)// pt 21
    
    
);

blocks
(
	hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (1 5 1)
	hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (1 0.2 1)
	hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (5 0.2 1)
	hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (5 5 1)
	hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (5 5 1)
);

edges
(
);

boundary
(
	inlet
	{
    	type patch;
    	faces
    	(
        	(0 11 14 3)
        	(3 14 16 5)
    	);
	}
	outlet
	{
    	type patch;
    	faces
    	(
        	(6 17 18 7)
        	(7 18 19 8)
        	(8 19 20 9)
    	);
	}
	frontAndBack
	{
    	type empty;
    	faces
    	(
        	(11 12 13 14)
        	(14 13 15 16)
        	(13 18 17 15)
        	(12 19 18 13)
        	(21 20 19 12)
        	(0 3 2 1)
        	(3 5 4 2)
        	(2 4 6 7)
        	(1 2 7 8)
        	(10 1 8 9)
    	);
	}
   
    
	fixedWalls
	{
    	type wall;
    	faces
    	(
        	(16 15 4 5)
        	(15 17 6 4)
        	(0 1 12 11)
        	(10 9 20 21)
        	(1 10 21 12)
       	 
    	);
	}
);

mergePatchPairs
(
);

Controldict 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   	startTime;

startTime   	0;

stopAt      	endTime;

endTime     	0.01;

deltaT      	1e-5;

writeControl	timeStep;

writeInterval   20;

purgeWrite  	0;

writeFormat 	ascii;

writePrecision  6;

writeCompression off;

timeFormat  	general;

timePrecision   6;

runTimeModifiable true;


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

Pressure and Velocity file

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

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

internalField   uniform 0;

boundaryField
{
	inlet
	{
    	type        	zeroGradient;
   	 
	}

	outlet
	{
    	type        	fixedValue;
    	value       	uniform 0;
    	 
     	 
     	}

	frontAndBack
	{
    	type        	empty;
	}
 	


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

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

internalField   uniform (0 0 0);

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

  outlet
	{
    	type        	zeroGradient;
            	 
	}

	frontAndBack
	{
    	type        	empty;
	}

	fixedWalls
	{
    	type        	noSlip;
	}
}

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

Contour of Velocity and Pressure at grading factor 0.2

Contour of Velocity and Pressure at grading factor 0.5

blocks
(
	hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (1 2 1)
	hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (1 0.5 1)
	hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (2 0.5 1)
	hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (2 2 1)
	hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (2 2 1)
);

Contour of Velocity and Pressure at grading factor 0.8

blocks
(
	hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (1 1.25 1)
	hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (1 0.8 1)
	hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (1.25 0.8 1)
	hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1.25 1.25 1)
	hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1.25 1.25 1)
);



Conclusion

The above velocity and pressure graphs are taken taken at distance of 0.085m ie the step region from the inlet and along the y axis of the grometry

It can be seen from the above plots that the velocity profile looks same for the for different grading factor but when looked at zoom level there results were different with minute difference

Grading factor. Maximum velciity

0.2. 1.1948m/s

0.5. 1.1865m/s

0.8 1.8121m/s

From this we conclude that the one that has lower grading factor gives the most accurate results because of finer mesh

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.