Tutorial 01 Heat transfer analysis in Pipe Flow in Elbow pipe structure OPENFOAM


 Title: Heat transfer analysis in Pipe Flow in Elbow pipe structure


Figure 1.1 Meshed domain of elbow section
Problem Identification
This problem is simple pipe flow problem, in which air is flow in elbow section from two inlet conditions having different flow and energy boundary conditions. (See the following figure). Air properties are selected from literature material available in digital medium.
buoyantBoussinesqPimpleFoam is selected as solver for this problem. Open Foam software is installed on Win 7, provided by FSD blueCAPE Lda: http://bluecfd.com/
Note: This tutorial is not endorsed/ supported by any provider of software's which are used in this tutorial. This tutorial is made for educational purpose only.


Figure1.2 Different Boundary Conditions
The simulation is solved in ambient conditions at transient flow scheme available in selected solver.
Pre-Processing
This problem is selected as turbulent flow problem, so the solver must have capability to solve turbulent flow conditions, that’s why buoyantBoussinesqPimpleFoamis selected as solver. The very first step is import suitable mesh file in open-foam software. There are various methods available in software to read mesh file, but we use “fluentMeshToFoam” command to read *.msh file generated by Ansys Fluent software. It is required to make a folder in home directory of your open-foam software, where important sub-folders are already presented (see the following figure)

Figure 1.3 Folder in home directory for this tutorial
After desired folder creation, run open-foam software (see the following figure)


Figure 1.4 Run Open-Foam using blueCFD terminal
Run “ls” command in this terminal to verify the user created folder (see the following figure)
 Figure 1.5 ls command to check the folders in home directory
After verification of user folder (ELBOW01), run “cd” command to enter in this folder (see the following figure)
 Figure 1.6 cd command to enter desired folder
Run “fluentMeshToFoam” command in terminal (see the following figure), it must be ensure by user that msh file is available in main folder by run command “ls” again, in this tutorial elbow.msh file is used (copy from tutorial available in open-foam software)
Figure 1.7 ls command to verify msh file
Figure 1.8 mesh command to convert msh file in poly mesh file
This command create a sub-folder named polymesh in sub-folder constant which we create in starting phase of problem. (see the following figure )
In polymesh bolder various files are created. These files have geometry information of elbow.msh but our consideration is on boundary file (red highlighted in figure)

Figure 1.9 Polymesh folder created by “fluentMeshToFoam” command
Note down all boundary names created from msh file by open the boundary file available in polymesh folder using word-pad/notepad (see the following figure)


Figure 1.10 Boundary name use in 0 subdirectory
Boundary Conditions
After creation of polymesh in constant folder, its time to create boundary files in directory 0 created by user in starting point of problem. The boundary files depend on governing equations which will be solved during numerical simulation, for this problem the main variables(total eight variables) which must be solved are present in the following figure


Figure 1.11 Boundary conditions for present problem
There is large number of boundary conditions are available which must be provide to boundary conditions, the selection is depend on type of boundary conditions. In this tutorial some important boundary conditions are used but no detail information is provided. All files are created using note-pad-2 (provided in software package)
Note: We copy these files from tutorial available in open-foam program files (see the following figure)
 Figure 1.12 Copy pee-generated files for present problem
Now edit these boundary files as per given details for all boundary conditions:
alphat boundary condition for elbow problem
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.0                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      alphat;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 2 -1 0 0 0 0];
internalField   uniform 2.3039e-5;
boundaryField
{
    velocity-inlet-5
    {
    type         fixedValue;
    value           $internalField;
    }
    velocity-inlet-6
    {
    type         fixedValue;
    value           $internalField;
    }
    pressure-outlet-7
    {
    type zeroGradient;
    }
    wall-4
    {
        type            alphatJayatillekeWallFunction;
        Prt            0.71;
        value           $internalField;
    }
    wall-8
    {
        type            alphatJayatillekeWallFunction;
        Prt            0.71;
        value           $internalField;
    }
    frontAndBackPlanes
    {
        type            empty;
       }
}
// ************************************************************************* //
Epsilon boundary condition for elbow problem
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.0                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 2 -3 0 0 0 0];
internalField   uniform 5e-5;
boundaryField
{
    velocity-inlet-5
    {
        type            fixedValue;
        value           $internalField;
    }
    velocity-inlet-6
    {
        type            fixedValue;
        value           $internalField;
    }
    pressure-outlet-7
    {
        type            zeroGradient;
    }
    wall-4
    {
        type            epsilonWallFunction;
        value           $internalField;
    }
    wall-8
    {
        type            epsilonWallFunction;
        value           $internalField;
    }
    frontAndBackPlanes
    {
        type            empty;
    }
}
// ************************************************************************* //
K boundary condition for elbow problem
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.0                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 2 -2 0 0 0 0];
internalField   uniform 1e-4;
boundaryField
{
    velocity-inlet-5
    {
        type            fixedValue;
        value           $internalField;
    }
    velocity-inlet-6
    {
        type            fixedValue;
        value           $internalField;
    }
    pressure-outlet-7
    {
        type            zeroGradient;
    }
    wall-4
    {
        type            kqRWallFunction;
        value           $internalField;
    }
    wall-8
    {
        type            kqRWallFunction;
        value           $internalField;
    }
    frontAndBackPlanes
    {
        type            empty;
        
    }
}
// ************************************************************************* //
Nut boundary condition for elbow problem
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.0                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 2 -1 0 0 0 0];
internalField   uniform 0;
boundaryField
{
    velocity-inlet-5
    {
        type            fixedValue;
        value           $internalField;
    }
    velocity-inlet-6
    {
        type            fixedValue;
        value           $internalField;
    }
    pressure-outlet-7
    {
        type            zeroGradient;
    }
    wall-4
    {
        type            nutkWallFunction;
        value           uniform 0;
    }
    wall-8
    {
        type            nutkWallFunction;
        value           uniform 0;
    }
    frontAndBackPlanes
    {
        type            empty;
        
    }
}
// ************************************************************************* //

P boundary condition for elbow problem
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.0                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 2 -2 0 0 0 0];
internalField   uniform 101325;
boundaryField
{
    velocity-inlet-5
    {
        type            zeroGradient;
    }
    velocity-inlet-6
    {
        type            zeroGradient;
    }
    pressure-outlet-7
    {
        type            fixedValue;
        value           $internalField;
    }
    wall-4
    {
        type            zeroGradient;
    }
    wall-8
    {
        type            zeroGradient;
    }
    frontAndBackPlanes
    {
        type            empty;
    }
}
// ************************************************************************* //
P_rgh boundary condition for elbow problem
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.0                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 2 -2 0 0 0 0];
internalField   uniform 101325;
boundaryField
{
    velocity-inlet-5
    {
        type            fixedValue;
        value           $internalField;
    }
    velocity-inlet-6
    {
        type            fixedValue;
        value           $internalField;
    }
    pressure-outlet-7
    {
        type            fixedValue;
        value           $internalField;
    }
    wall-4
    {
        type            zeroGradient;
    }
    wall-8
    {
        type            zeroGradient;
    }
    frontAndBackPlanes
    {
        type            empty;

    }
}
// ************************************************************************* //
T boundary condition for elbow problem
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.0                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 0 0 1 0 0 0];
internalField   uniform 300;
boundaryField
{
    velocity-inlet-5
    {
        type            fixedValue;
        value         uniform 350;
    }
    velocity-inlet-6
    {
        type            fixedValue;
        value         uniform 310;
    }
    pressure-outlet-7
    {
        type            zeroGradient;
    }
    wall-4
    {
        type            fixedValue;
        value         uniform 302;
    }
    wall-8
    {
        type            fixedValue;
        value         uniform 302;
    }
    frontAndbackPlanes
    {
        type            empty;
        
    }
}
// ************************************************************************* //


U boundary condition for elbow problem
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.0                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     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
{
    velocity-inlet-5
    {
        type            fixedValue;
        value         uniform (2.5 0 0);
    }
    velocity-inlet-6
    {
        type            fixedValue;
        value         uniform (0 4.5 0);
    }
    pressure-outlet-7
    {
        type            zeroGradient;
    }
    wall-4
    {
        type            noSlip;
    }
    wall-8
    {
        type            noSlip;
    }
    frontAndbackPlanes
    {
        type            empty;
    }
}
// ************************************************************************* //
Fluid Flow Properties (Transport and Turbulence)
These properties are present in directory constant where polymesh is available, the process is same like previous section. For simplicity copy these files from tutorial available in open-foam program files path for selected solver.
Source code for g
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       uniformDimensionedVectorField;
    location    "constant";
    object      g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 1 -2 0 0 0 0];
value           (0 -9.81 0);
// ************************************************************************* //
Source code for Transport Properties
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
// Laminar viscosity
nu              [0 2 -1 0 0 0 0] 1e-05;
// Thermal expansion coefficient
beta            [0 0 0 -1 0 0 0] 3e-03;
// Reference temperature
TRef            [0 0 0 1 0 0 0] 300;
// Laminar Prandtl number
Pr              [0 0 0 0 0 0 0] 0.7;
// Turbulent Prandtl number
Prt             [0 0 0 0 0 0 0] 0.85;
// ************************************************************************* //
Source code for Turbulence Properties
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
    RASModel        kEpsilon;
    turbulence      on;
    printCoeffs     on;
}
// ************************************************************************* //
Time/Solver (Input-Output)
Like other CFD software, Open-Foam is also required time size as per requirement of problem. This task is fulfill by creating controlDict file in directory “system”
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application     buoyantBoussinesqPimpleFoam;
startFrom       startTime;
startTime       0;
stopAt          endTime;
endTime         35;
deltaT          0.005;
writeControl    timeStep;
writeInterval   500;
purgeWrite      0;
writeFormat     ascii;
writePrecision  6;
writeCompression off;
timeFormat      general;
timePrecision   6;
runTimeModifiable true;
adjustTimeStep  no;
maxCo           0.5;
// ************************************************************************* //
Numerical Schemes
The numerical schemes are defined in file fvSchemes available in directory system created by user in starting phase of problem.
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
    default         Euler;
}
gradSchemes
{
    default         Gauss linear;
}
divSchemes
{
    default         none;
    div(phi,U)      Gauss upwind;
    div(phi,T)      Gauss upwind;
    div(phi,k)      Gauss upwind;
    div(phi,epsilon) Gauss upwind;
    div(phi,R)      Gauss upwind;
    div(R)          Gauss linear;
    div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
    default         Gauss linear uncorrected;
}
interpolationSchemes
{
    default         linear;
}
snGradSchemes
{
    default         uncorrected;
}
// ************************************************************************* //
Solution Control
Solution is controlled by making file fvSolution in directory system 
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
    p_rgh
    {
        solver          PCG;
        preconditioner  DIC;
        tolerance       1e-8;
        relTol          0.01;
    }
    p_rghFinal
    {
        $p_rgh;
        relTol          0;
    }
    "(U|T|k|epsilon|R)"
    {
        solver          PBiCGStab;
        preconditioner  DILU;
        tolerance       1e-6;
        relTol          0.1;
    }
    "(U|T|k|epsilon|R)Final"
    {
        $U;
        relTol          0;
    }
}
PIMPLE
{
    momentumPredictor no;
    nOuterCorrectors 1;
    nCorrectors     2;
    nNonOrthogonalCorrectors 0;
    pRefCell        0;
    pRefValue       0;
}
relaxationFactors
{
    equations
    {
        "(U|T|k|epsilon|R)" 1;
        "(U|T|k|epsilon|R)Final" 1;
    }
}
// ************************************************************************* //
In the last one another source code is required to solve the problem. It is also available in directory system.
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
    volScalarFieldValue T 300
);
regions
(
    // Set patch values (using ==)
    boxToFace
    {
        box (4.5 -1000 4.5) (5.5 1e-5 5.5);
        fieldValues
        (
            volScalarFieldValue T 600
        );
    }
);
// ************************************************************************* //
Solver Running
After created the all desired source files for present problem only last step is to run the solver by provide the command “” (see the following figure)


Figure 1.13 command for run the solver
As the solver is running it must be take care of Courant number issue


Figure 1.14 Solver running in open-foam code
After successful ending of solver running condition, various sub-folders are created in user directory ELBOW01 for different time conditions (see the following figure)


Figure 1.15 Directory after solution ending for present problem
Post-Processing
In this step solved problem is analysis by using para-foam software available with open-foam software. To run this software run command “para-foam” in terminal of open-foam software. It must take care that terminal selected ELBOW folder before run this command.


Figure 1.16 para-foam for post-processing of problem
Para-view is very large software for post-processing of CFD simulation files so in this tutorial we skip this software at this stage. Only some important results are present here.
Temperature Contours



Velocity Contours


This offering is not approved or endorsed by OpenCFD Limited, producer and distributor of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks.
END

Comments