Project

Simulating Laminar flow through a pipe using Hagen Poiseuille equation and comparing the results

clear all
close all
clc

f1 = fopen(\'blockMeshDict\',\'w\');

theta = 2.5;          % half of required angle of wedge  
d = 0.125;             % diameter of cylinder in meters
vx_1 = sind(theta);     
vx_2 = cosd(theta);


fprintf(f1,\'convertToMeters 1 \\n\\n\');
fprintf(f1,\'vertices\\n\');
fprintf(f1,\'(\\n\');
fprintf(f1,\'     (0 0 0)\\n\');
fprintf(f1,\'     (%f %f %f)\\n\',0,d*vx_2,-d*vx_1);
fprintf(f1,\'     (%f %f %f)\\n\',0,d*vx_2,d*vx_1);
fprintf(f1,\'     (30 0 0)\\n\');
fprintf(f1,\'     (%f %f %f)\\n\',30,d*vx_2,-d*vx_1);
fprintf(f1,\'     (%f %f %f)\\n\',30,d*vx_2,d*vx_1);
fprintf(f1,\');\\n\\n\');
fprintf(f1,\'blocks\\n\');
fprintf(f1,\'(\\n\');
fprintf(f1,\'     hex (0 1 2 0 3 4 5 3) (50 1 500) simpleGrading (1 1 1)\\n\');
fprintf(f1,\');\\n\\n\');
fprintf(f1,\'edges\\n\');
fprintf(f1,\'(\\n\');
fprintf(f1,\'     arc 1 2 (0 %f 0)\\n\',d);
fprintf(f1,\'     arc 4 5 (30 %f 0)\\n\',d);
fprintf(f1,\');\\n\\n\');
fprintf(f1,\'boundary\\n\');
fprintf(f1,\'(\\n\');
fprintf(f1,\'     axis\\n\');
fprintf(f1,\'     {\\n\');
fprintf(f1,\'           type   empty\\n\');
fprintf(f1,\'           faces   ((0 3 3 0));\\n\');
fprintf(f1,\'     }\\n\\n\');
fprintf(f1,\'     inlet\\n\');
fprintf(f1,\'     {\\n\');
fprintf(f1,\'           type   patch\\n\');
fprintf(f1,\'           faces   ((0 0 2 1));\\n\');
fprintf(f1,\'     }\\n\\n\');
fprintf(f1,\'     outlet\\n\');
fprintf(f1,\'     {\\n\');
fprintf(f1,\'           type   patch\\n\');
fprintf(f1,\'           faces   ((3 4 5 3));\\n\');
fprintf(f1,\'     }\\n\\n\');
fprintf(f1,\'     Wall\\n\');
fprintf(f1,\'     {\\n\');
fprintf(f1,\'           type   wall\\n\');
fprintf(f1,\'           faces   ((2 5 4 1));\\n\');
fprintf(f1,\'     }\\n\\n\');
fprintf(f1,\'     front\\n\');
fprintf(f1,\'     {\\n\');
fprintf(f1,\'           type   wedge\\n\');
fprintf(f1,\'           faces   ((0 3 5 2));\\n\');
fprintf(f1,\'     }\\n\\n\');
fprintf(f1,\'     back\\n\');
fprintf(f1,\'     {\\n\');
fprintf(f1,\'           type   wedge\\n\');
fprintf(f1,\'           faces   ((1 4 3 0));\\n\');
fprintf(f1,\'     }\\n\\n\');
fprintf(f1,\');\\n\\n\');
fprintf(f1,\'mergePatchPairs\\n\');
fprintf(f1,\'(\\n\');
fprintf(f1,\');\\n\');

fclose(f1);

Velocity profiles at different points:

As the velocity near the center of the pipe is approximately twice of the starting velocity (i.e 8.4e-03), we can say that the velocity profile is fully developed, and the solution is converged.

Comparison of Velocity profiles from Hagen-Poiseullie Equation and from Icofoam solution:

Shear stress variation along the radial axis at the end of the pipe:

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.