Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
REPORT Week 12 - Validation studies of symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
AIM
- Simulate the week 11 problem by applying Symmetry Boundary Condition.
- Simulate for the following angles using both symmetry and wedge boundary conditions and validate them with HP equations.
- Angles to test:
- 10 degrees
- 25 degrees
- 45 degrees
Expected Results
- Validate Hydro-dynamic length with the numerical result
- Validate the fully developed flow velocity profile with its analytical profile.
- Validate maximum velocity and pressure drop for fully developed flow.
- Post-process Shear stress and validate wall shear stress for fully developed flow.
- Highlight the difference in both boundary conditions in terms of their usage and application.
EXPLANATION
Wedge Boundary Condition
The wedge boundary condition (BC) is used in CFD to define an axisymmetric situation, for eg cylinder.
- The model and flow are to be axisymmetric along a central line such that all physical variables of the flow have the same value and distribution at a given radius for all angles
- This boundary condition is specified by two planes that must be selected on separated sides of the domain (referred to as front and back) on surfaces running along the axis. It works for 2D simulations only.
- To simulate a two –dimensional model or flow the geometry needs to be specified as a wedge with a small angle (<5 degrees) and a single cell thickness along the curvature.
- One big advantage of a wedge is that it allows for the rotational flow around the axis and this is possible only because the fluxes and normal components are not assumed as zero.
Symmetry Boundary Condition
The symmetry boundary condition defines a mirror face/surface.
- It is used if the physical object or geometry and the expected flow field pattern of the developed solution are mirrored along that surface.
- By using this boundary condition, the domain can essentially be halved, reducing the time to achieve a solution.
- The symmetry condition applies the following constraints on the flow variables:
- The fluxes across the symmetry are zero and the normal components of all variables are set to zero.
- At the symmetry plane, the normal velocity is zero and the normal gradients of all variables are zero.
- It can be applied to both planar and non-planar faces/surfaces on the domain boundaries.
Symmetry BC vs. Wedge BC
- Wedge is different from the symmetry boundary condition in the sense that the wedge BC applies the Navier – Stokes equations in cylindrical coordinates whereas the latter applies in Cartesian coordinates.
- A wedge is used for axial and spherical symmetry and needs to perform a coordinate transformation for the wedge angle and not a simple mirroring.
INPUTS
- Re = 2100
- Water is the considered fluid
- icoFoam solver
- density = 997 kg/m^2
- kinematic viscosity = 1.004*10^-6 m^2/s
- dynamic viscosity = 1.002*10^-3 N.s/m^2
Matlab code to generate the computational mesh for input wedge angle and grading factor for symmetry boundary condition:
% blockMeshDict file %
% symmetry bc %
clear all
close all
clc
L = 5.5;
theta = input('wedge angle = ');
D = 0.05;
R = D/2;
% Grid Point
nx = 100;
ny = 40;
nz = 1;
% coordinates
c0 = [0 0 0]
c1 = [0 R*cosd(theta/2) -R*sind(theta/2)]
c2 = [0 R*cosd(theta/2) R*sind(theta/2)]
c3 = [L 0 0]
c4 = [L R*cosd(theta/2) -R*sind(theta/2)]
c5 = [L R*cosd(theta/2) R*sind(theta/2)]
% creating blockmeshdict file for openfoam
h1='/*--------------------------------*- C++ -*----------------------------------*\';
h2='| ========= | |';
h3='| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |';
h4='| \\ / O peration | Website: https://openfoam.org |';
h5='| \\ / A nd | Version: 9 |';
h6='| \\/ M anipulation | |';
h7='|\*---------------------------------------------------------------------------*/ |';
h8='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//';
a1=fopen('blockMeshDict.txt','wt')
fprintf(a1,'%s\n',h1);
fprintf(a1,'%s\n',h2);
fprintf(a1,'%s\n',h3);
fprintf(a1,'%s\n',h4);
fprintf(a1,'%s\n',h5);
fprintf(a1,'%s\n',h6);
fprintf(a1,'%s\n \n',h7);
fprintf(a1,'FoamFile \n {\n')
fprintf(a1,'%16s %12s\n','format','ascii;')
fprintf(a1,'%16s %17s\n','class','dictionary;')
fprintf(a1,'%16s %20s\n','object','blockMeshDict;')
fprintf(a1,'%2s\n','}')
fprintf(a1,'%2s\n\n','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //')
fprintf(a1,'%2s\n\n','convertToMeters 1;')
fprintf(a1,'vertices \n (\n')
fprintf(a1,'\t(%d %d %d)\n',c0)
fprintf(a1,'\t(%d %d %d)\n',c1)
fprintf(a1,'\t(%d %d %d)\n',c2)
fprintf(a1,'\t(%d %d %d)\n',c3)
fprintf(a1,'\t(%d %d %d)\n',c4)
fprintf(a1,'\t(%d %d %d)\n',c5)
fprintf(a1,' %2s\n\n', ');')
fprintf(a1, 'blocks \n (\n')
fprintf(a1,'\t hex (0 3 5 2 0 3 4 1) (%d %d %d)',nx,ny,nz);
fprintf(a1,'SimpleGrading (1 0.1 1)\n\n');
fprintf(a1,' %2\n\n', ');')
fprintf(a1,'edges\n(\n\t arc %d %d (%f %f %f)\n',1,2,0,R,0);
fprintf(a1,'\t arc %d %d (%f %f %f)\n',4,5,L,R,0);
fprintf(a1,' %2s\n\n', ');')
fprintf(a1,'boundary \n (\n')
fprintf(a1,'\t %5s \n','inlet','{')
fprintf(a1,'\t %13s %s\n','type','patch;')
fprintf(a1,'\t %14s\n %18s\n','faces','(')
fprintf(a1,'\t \t %15s\n %19s\n\n %14s\n\n','(0 1 2 0)',');','}')
fprintf(a1,'\t %5s \n','top','{')
fprintf(a1,'\t %13s %s\n','type','wall;')
fprintf(a1,'\t %14s\n %18s\n','faces','(')
fprintf(a1,'\t \t %15s\n %19s\n\n %14s\n\n','(1 4 5 2)',');','}')
fprintf(a1,'\t %5s \n','outlet','{')
fprintf(a1,'\t %13s %s\n','type','patch;')
fprintf(a1,'\t %14s\n %18s\n','faces','(')
fprintf(a1,'\t \t %15s\n %19s\n\n %14s\n\n','(3 4 5 3)',');','}')
fprintf(a1,'\t %5s \n','front','{')
fprintf(a1,'\t %13s %s\n','type','symmetry;')
fprintf(a1,'\t %14s\n %18s\n','faces','(')
fprintf(a1,'\t \t %15s\n %19s\n\n %14s\n\n','(0 3 4 1)',');','}')
fprintf(a1,'\t %5s \n','back','{')
fprintf(a1,'\t %13s %s\n','type','symmetry;')
fprintf(a1,'\t %14s\n %18s\n','faces','(')
fprintf(a1,'\t \t %15s\n %19s\n\n %14s\n\n %s\n\n','(0 2 5 3)',');','}',');')
fprintf(a1,'\t %5s \n','axis','{')
fprintf(a1,'\t %13s \n','type','empty;')
fprintf(a1,'\t \t %15s\n %19s\n\n %14s\n\n','(0 3 3 0)',');','}')
fprintf(a1,'mergerPatchPairs \n (\n);\n')
fprintf(a1,'%2s\n\n','// ************************************************************************* //')
fclose(a1);
blockMeshDict file generated by Matlab for an angle of 10 degrees with symmetry BC:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.024905 0.002179)
(0 0.024905 -0.002179)
(5.5 0 0)
(5.5 0.024905 0.002179)
(5.5 0.024905 -0.002179)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 30 1) simpleGrading (1 0.1 1)
);
edges
(
arc 1 2 (0 0.025 0)
arc 4 5 (5.5 0.025 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
blockMeshDict file generated by Matlab for an angle of 25 degrees with symmetry BC:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.024407 0.005411)
(0 0.024407 -0.005411)
(5.5 0 0)
(5.5 0.024407 0.005411)
(5.5 0.024407 -0.005411)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 30 1) simpleGrading (1 0.1 1)
);
edges
(
arc 1 2 (0 0.025 0)
arc 4 5 (5.5 0.025 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
blockMeshDict file generated by Matlab for an angle of 45 degrees with symmetry BC:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.023097 0.009567)
(0 0.023097 -0.009567)
(5.5 0 0)
(5.5 0.023097 0.009567)
(5.5 0.023097 -0.009567)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 30 1) simpleGrading (1 0.1 1)
);
edges
(
arc 1 2 (0 0.025 0)
arc 4 5 (5.5 0.025 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Velocity BC:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
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.042168 0 0);
}
top
{
type fixedValue;
value uniform (0 0 0);
}
outlet
{
type zeroGradient;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
axis
{
type empty;
}
}
// ************************************************************************* //
Pressure BC:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
top
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0.0028393;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
axis
{
type empty;
}
}
// ************************************************************************* //
controlDict file:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 50;
deltaT 0.01;
writeControl timeStep;
writeInterval 100;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Transport properties – kinematic viscosity:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 1.004e-6;
// ************************************************************************* //
OUTPUT
- Theta = 10 degree
Mesh

pressure
- pressure at the start of the pipe

- pressure at end of the pipe

velocity

- velocity at the start of the pipe
- velocity at end of the pipe

plot over line

shear stress

- Theta = 25 degree
Mesh

pressure

- pressure at the start of the pipe

- pressure at end of pipe

velocity

- velocity at the start of the pipe

- velocity at end of the pipe
plot over line

shear stress

- Theta = 45 degree
Mesh

pressure

- pressure at the start of the pipe

- pressure at end of the pipe

velocity

- velocity at the start of the pipe

- velocity at end of the pipe

plot over line

shear stress
Analytical solution
velocity profile

CONCLUSION
No extreme changes are observed in the maximum velocities when compared between wedge BC and symmetry BC. The only difference observed is that executed time is a little higher. While the angle increases the error in the maximum velocity is decreased. Though there is not much difference between analytical and numerical results with an increase in the angle of the wedge, the courant number slightly increases.