Project

3D simulation of water in a curved pipe using snappyhexmesh in openfoam

Aim : To simulate the flow of water in a curved pipe using snappyhexmesh in openfoam

Geometry in Meshlab :

The different .stl files can be viewed in Meshlabs and the identification of refinement zones would become easy .

Input data:

velocity of water at the pipe inlet = 7m/sec at 25 deg

blockMeshDict File :

FoamFile
{
	version	2.0;
	format	ascii;
	class	dictionary;
	location	"system";
	object	blockMeshDict;
}
vertices	(
	(-0.2725 -0.45512927 -0.45512927)
	(-0.2725 -0.45512927 0.45512927)
	(4.2725 -0.45512927 0.45512927)
	(4.2725 -0.45512927 -0.45512927)
	(-0.2725 0.45512927 -0.45512927)
	(-0.2725 0.45512927 0.45512927)
	(4.2725 0.45512927 0.45512927)
	(4.2725 0.45512927 -0.45512927)
	(-0.2725 -0.91025853 -0.91025853)
	(-0.2725 -0.91025853 0.91025853)
	(4.2725 -0.91025853 0.91025853)
	(4.2725 -0.91025853 -0.91025853)
	(-0.2725 0.91025853 -0.91025853)
	(-0.2725 0.91025853 0.91025853)
	(4.2725 0.91025853 0.91025853)
	(4.2725 0.91025853 -0.91025853)
);
blocks	(
	hex	(0 1 2 3 4 5 6 7) (10 200 10) simpleGrading (1.0 1.0 1.0)
	hex	(1 0 3 2 9 8 11 10) (10 200 10) simpleGrading (1.0 1.0 1.0)
	hex	(5 1 2 6 13 9 10 14) (10 200 10) simpleGrading (1.0 1.0 1.0)
	hex	(4 5 6 7 12 13 14 15) (10 200 10) simpleGrading (1.0 1.0 1.0)
	hex	(0 4 7 3 8 12 15 11) (10 200 10) simpleGrading (1.0 1.0 1.0)
);
edges	(
	arc	0 1 (-0.2725 -0.5382704 0.0)
	arc	1 5 (-0.2725 0.0 0.5382704)
	arc	4 5 (-0.2725 0.5382704 0.0)
	arc	0 4 (-0.2725 0.0 -0.5382704)
	arc	3 2 (4.2725 -0.5382704 0.0)
	arc	2 6 (4.2725 0.0 0.5382704)
	arc	7 6 (4.2725 0.5382704 0.0)
	arc	3 7 (4.2725 0.0 -0.5382704)
	arc	8 9 (-0.2725 -1.2873 0.0)
	arc	9 13 (-0.2725 0.0 1.2873)
	arc	12 13 (-0.2725 1.2873 0.0)
	arc	8 12 (-0.2725 0.0 -1.2873)
	arc	11 10 (4.2725 -1.2873 0.0)
	arc	10 14 (4.2725 0.0 1.2873)
	arc	15 14 (4.2725 1.2873 0.0)
	arc	11 15 (4.2725 0.0 -1.2873)
);
boundary	(
	inlet
	{
		type	patch;
		faces	(
			(1 5 4 0)
			(5 13 12 4)
			(4 12 8 0)
			(0 8 9 1)
			(1 9 13 5)
		);
	}
	outlet
	{
		type	patch;
		faces	(
			(3 7 6 2)
			(6 14 10 2)
			(2 10 11 3)
			(3 11 15 7)
			(7 15 14 6)
		);
	}
	boundaries
	{
		type	wall;
		faces	(
			(13 14 15 12)
			(12 15 11 8)
			(8 11 10 9)
			(9 10 14 13)
		);
	}
);

SnappyHexMesh file :

FoamFile
{
	version	2.0;
	class	dictionary;
	format	ascii;
	location	"system";
	object	snappyHexMeshDict;
}
castellatedMesh	true;
snap	true;
addLayers	false;
geometry
{
	inlet.stl
	{
		type	triSurfaceMesh;
		simflowType	stl;
		name	inlet;
		includedAngle	120.0;
	}
	outlet.stl
	{
		type	triSurfaceMesh;
		simflowType	stl;
		name	outlet;
		includedAngle	120.0;
	}
	s_pipe.stl
	{
		type	triSurfaceMesh;
		simflowType	stl;
		name	s_pipe;
		includedAngle	120.0;
		faceGroups
		{
			inlet
			{
				name	s_pipe;
			}
			wall
			{
				name	s_pipe;
			}
			outlet
			{
				name	s_pipe;
			}
		}
	}
	wall.stl
	{
		type	triSurfaceMesh;
		simflowType	stl;
		name	wall;
		includedAngle	120.0;
	}
}
castellatedMeshControls
{
	locationInMesh	(0.0 0.0 -0.25);
	refinementSurfaces
	{
		inlet
		{
			level	( 0 0 );
			patchInfo
			{
				type	wall;
			}
		}
		outlet
		{
			level	( 0 0 );
			patchInfo
			{
				type	wall;
			}
		}
		wall
		{
			level	( 0 0 );
			patchInfo
			{
				type	wall;
			}
		}
	}
	refinementRegions
	{
	}
	limitRegions
	{
	}
	features	
	(
	{
		file	"inlet.eMesh";
		levels	((0 0));
	}
	{
		file	"outlet.eMesh";
		levels	((0 0));
	}
	{
		file	"wall.eMesh";
		levels	((0 0));
	}
	);
	maxLocalCells	1000000;
	maxGlobalCells	10000000;
	nCellsBetweenLevels	1;
	maxLoadUnbalance	0.1;
	minRefinementCells	10;
	resolveFeatureAngle	30.0;
	allowFreeStandingZoneFaces	true;
}
snapControls
{
	tolerance	10.0;
	nSmoothPatch	3;
	nSolveIter	500;
	nRelaxIter	5;
	nFeatureSnapIter	10;
	implicitFeatureSnap	true;
	explicitFeatureSnap	true;
	multiRegionFeatureSnap	true;
	nFaceSplitInterval	5;
}
addLayersControls
{
	layers
	{
	}
	relativeSizes	true;
	minThickness	0.1;
	firstLayerThickness	0.2;
	expansionRatio	1.25;
	nGrow	0;
	featureAngle	180.0;
	maxFaceThicknessRatio	0.5;
	nSmoothSurfaceNormals	5;
	nSmoothThickness	10;
	minMedialAxisAngle	90.0;
	maxThicknessToMedialRatio	0.5;
	nMedialAxisIter	100;
	nSmoothNormals	3;
	slipFeatureAngle	30.0;
	nRelaxIter	5;
	nBufferCellsNoExtrude	0;
	nLayerIter	50;
	nRelaxedIter	20;
	detectExtrusionIsland	true;
}
meshQualityControls
{
	maxNonOrtho	65.0;
	maxBoundarySkewness	20.0;
	maxInternalSkewness	4.0;
	maxConcave	80.0;
	minVol	1.0E-14;
	minTetQuality	1.0E-20;
	minArea	-1.0;
	minTwist	0.02;
	minTriangleTwist	-1.0;
	minDeterminant	0.01;
	minFaceWeight	0.05;
	minVolRatio	0.01;
	minVolCollapseRatio	0.1;
	nSmoothScale	4;
	errorReduction	0.75;
	relaxed
	{
		maxNonOrtho	75.0;
	}
}
mergeTolerance	1.0E-6;
debug	0;

The mesh is generated by the snappyhexmesh and is ready to undergo for solving

Geometry in paraview :

Mesh generated by snappyhex :

Mesh refinement and adding layers :

The first layer thickness and minimum thickness is modified to obtain the desired mesh refinement. And for the different stl files we can refine the mesh so that the wall boundaries and cruitial regions are refined.

Turbulence model choosen:

The Y+ plus value is calculated based on that the turbulence model is choosen. The calculated Y+ value is in the range of 20< Y+ <200 so k-Epsilon model is choosen.

k-w sst can also be choosen if results to be obtained on the wall boundaries are our priority.

Output files:

velocity contour :

The 3 D geometry is cut by taking a section plane and the velocity contour is plotted.

The vector field of velocity is plotted to examine how the velocity changes at the curves of the pipe.

pressure contour :

The pressure drop can be calculated by taking the pressure difference at the inlet and the outlet.

conclusion :

The velocity and pressure contours are plotted and the simulation is performed by using snappyHexMesh in openfoam

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.