CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Flow around cube and cube natural convection (http://www.cfd-online.com/Forums/openfoam-solving/118776-flow-around-cube-cube-natural-convection.html)

Mirage12 June 4, 2013 05:44

Flow around cube and cube natural convection
 
Hello everyone, :)

I am a new OpenFoam user and have tried to understand since 3 weeks, how OpenFoam is working. That's why i decided like to simulate a flow around cube and also cube natural convection and i hope that this topic will help the new user of OpenFoam.
I chose a cube because it is simple geometry, the solver
Code:

simpleFoam
for#Flow around cubeand the solver
Code:

buoyantPimpleFoam
for the #Cube natural convection.

I am not sure, if
Code:

buoyantPimpleFoam
is the right solver for the #Cube natural convection...

Here is my blockMeshDict-File

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  | Author:  Amine Abd.                            |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.1;

vertices
(
    (0 0 0)//0
    (1 0 0)//1
    (2 0 0)//2
    (3 0 0)//3
    (3 1 0)//4
    (3 2 0)//5
    (3 3 0)//6
    (2 3 0)//7
    (1 3 0)//8
    (0 3 0)//9
    (0 2 0)//10
    (0 1 0)//11
    (1 1 0)//12
    (2 1 0)//13
    (2 2 0)//14
    (1 2 0)//15
    (0 0 0.5)//16
    (1 0 0.5)//17
    (2 0 0.5)//18
    (3 0 0.5)//19
    (3 1 0.5)//20
    (3 2 0.5)//21
    (3 3 0.5)//22
    (2 3 0.5)//23
    (1 3 0.5)//24
    (0 3 0.5)//25
    (0 2 0.5)//26
    (0 1 0.5)//27
    (1 1 0.5)//28
    (2 1 0.5)//29
    (2 2 0.5)//30
    (1 2 0.5)//31
);


blocks
(
    hex (0 1 12 11 16 17 28 27) (20 20 10) simpleGrading (1 1 1) //1

    hex (1 2 13 12 17 18 29 28) (20 20 10) simpleGrading (1 1 1) //2

    hex (2 3 4 13 18 19 20 29) (20 20 10) simpleGrading (1 1 1) //3

    hex (13 4 5 14 29 20 21 30) (20 20 10) simpleGrading (1 1 1) //4

    hex (14 5 6 7 30 21 22 23) (20 20 10) simpleGrading (1 1 1) //5

    hex (15 14 7 8 31 30 23 24) (20 20 10) simpleGrading (1 1 1) //6

    hex (10 15 8 9 26 31 24 25) (20 20 10) simpleGrading (1 1 1) //7

    hex (11 12 15 10 27 28 31 26) (20 20 10) simpleGrading (1 1 1) //8

);

edges
(


);
boundary
(
    outlet
    {
        type patch;
        faces
        (
            (3 4 20 19)
            (4 5 21 20)
            (5 6 22 21)
           
     
             
        );
    }
    inlet
    {
        type patch;
        faces
        (
         
          (9 10 26 25)
          (10 11 27 26)
          (11 0 16 27)
        );
    }
    fixedWalls
    {
        type wall;
        faces
        (
              (14 13 29 30)
              (12 15 31 28)
              (14 15 31 30)
              (12 13 29 28)
        );
    }
);

mergePatchPairs
(
);

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

I built the mesh using
Code:

blockMesh
and got this warning:


Code:

Creating block mesh topology
--> FOAM Warning :
    From function polyMesh::polyMesh(... construct from shapes...)
    in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 901
    Found 22 undefined faces in mesh; adding to default patch.

but the meshing was good....i don't understand the meaning of the Warning.:confused: any idea ?



Than i typed
Code:

simpleFoam
in order to simulate the cflow around cube.



SimpleFoam seems to work :



Code:

Create time

Create mesh for time = 0

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model SpalartAllmaras
SpalartAllmarasCoeffs
{
    sigmaNut        0.66666;
    kappa          0.41;
    Cb1            0.1355;
    Cb2            0.622;
    Cw2            0.3;
    Cw3            2;
    Cv1            7.1;
    Cv2            5;
}

Creating finite volume options
No finite volume options present


SIMPLE: convergence criteria
    field p    tolerance 1e-05
    field U    tolerance 1e-05
    field nuTilda    tolerance 1e-05


Starting time loop

Time = 1

smoothSolver:  Solving for Ux, Initial residual = 1, Final residual = 0.0726962, No Iterations 2
GAMG:  Solving for p, Initial residual = 1, Final residual = 0.0521262, No Iterations 4
time step continuity errors : sum local = 3.66569, global = -2.27357e-13, cumulative = -2.27357e-13
smoothSolver:  Solving for nuTilda, Initial residual = 1, Final residual = 0.0803582, No Iterations 2
ExecutionTime = 0.84 s  ClockTime = 1 s

Time = 2

smoothSolver:  Solving for Ux, Initial residual = 0.651251, Final residual = 0.0381755, No Iterations 4
GAMG:  Solving for p, Initial residual = 0.811213, Final residual = 0.0665551, No Iterations 2
time step continuity errors : sum local = 12.6457, global = -2.88632e-13, cumulative = -5.15989e-13
smoothSolver:  Solving for nuTilda, Initial residual = 0.268523, Final residual = 0.011164, No Iterations 4
ExecutionTime = 1.36 s  ClockTime = 1 s

Time = 3

smoothSolver:  Solving for Ux, Initial residual = 0.291545, Final residual = 0.0170455, No Iterations 4
GAMG:  Solving for p, Initial residual = 0.78304, Final residual = 0.0427918, No Iterations 2
time step continuity errors : sum local = 16.3457, global = -1.55024e-13, cumulative = -6.71013e-13
smoothSolver:  Solving for nuTilda, Initial residual = 0.182843, Final residual = 0.0105602, No Iterations 4
ExecutionTime = 1.82 s  ClockTime = 2 s

Time = 4

smoothSolver:  Solving for Ux, Initial residual = 0.112318, Final residual = 0.00632812, No Iterations 4
GAMG:  Solving for p, Initial residual = 0.580159, Final residual = 0.028626, No Iterations 2
time step continuity errors : sum local = 12.9383, global = -2.60342e-13, cumulative = -9.31355e-13
smoothSolver:  Solving for nuTilda, Initial residual = 0.158829, Final residual = 0.0102358, No Iterations 4
ExecutionTime = 2.29 s  ClockTime = 2 s

Time = 5

smoothSolver:  Solving for Ux, Initial residual = 0.21411, Final residual = 0.0126197, No Iterations 4
GAMG:  Solving for p, Initial residual = 0.44336, Final residual = 0.0152502, No Iterations 2
time step continuity errors : sum local = 5.62188, global = -2.35846e-13, cumulative = -1.1672e-12
smoothSolver:  Solving for nuTilda, Initial residual = 0.146856, Final residual = 0.00996576, No Iterations 4
ExecutionTime = 2.82 s  ClockTime = 3 s

Time = 6

smoothSolver:  Solving for Ux, Initial residual = 0.240414, Final residual = 0.0148877, No Iterations 4
GAMG:  Solving for p, Initial residual = 0.456608, Final residual = 0.0263508, No Iterations 2
time step continuity errors : sum local = 8.80232, global = -2.33654e-13, cumulative = -1.40086e-12
smoothSolver:  Solving for nuTilda, Initial residual = 0.14195, Final residual = 0.0100417, No Iterations 4
ExecutionTime = 3.31 s  ClockTime = 3 s

Time = 7

smoothSolver:  Solving for Ux, Initial residual = 0.126614, Final residual = 0.00789634, No Iterations 4
GAMG:  Solving for p, Initial residual = 0.398651, Final residual = 0.0255971, No Iterations 2
time step continuity errors : sum local = 7.84955, global = -1.63525e-13, cumulative = -1.56438e-12
smoothSolver:  Solving for nuTilda, Initial residual = 0.139509, Final residual = 0.010145, No Iterations 4
ExecutionTime = 3.81 s  ClockTime = 4 s

Time = 8

smoothSolver:  Solving for Ux, Initial residual = 0.111525, Final residual = 0.0060335, No Iterations 4
GAMG:  Solving for p, Initial residual = 0.338563, Final residual = 0.0178897, No Iterations 2
time step continuity errors : sum local = 5.31132, global = -1.2965e-13, cumulative = -1.69403e-12
smoothSolver:  Solving for nuTilda, Initial residual = 0.138472, Final residual = 0.0102371, No Iterations 4
ExecutionTime = 4.35 s  ClockTime = 4 s

Time = 9

smoothSolver:  Solving for Ux, Initial residual = 0.0770265, Final residual = 0.00430644, No Iterations 4
GAMG:  Solving for p, Initial residual = 0.287078, Final residual = 0.0179152, No Iterations 2
time step continuity errors : sum local = 5.35135, global = -1.76606e-13, cumulative = -1.87064e-12
smoothSolver:  Solving for nuTilda, Initial residual = 0.138024, Final residual = 0.0103762, No Iterations 4
ExecutionTime = 4.81 s  ClockTime = 5 s

Time = 10

smoothSolver:  Solving for Ux, Initial residual = 0.053643, Final residual = 0.00339355, No Iterations 4
GAMG:  Solving for p, Initial residual = 0.253213, Final residual = 0.014103, No Iterations 2
time step continuity errors : sum local = 4.29403, global = -2.67682e-13, cumulative = -2.13832e-12
smoothSolver:  Solving for nuTilda, Initial residual = 0.137795, Final residual = 0.0104911, No Iterations 4
ExecutionTime = 5.29 s  ClockTime = 5 s

End

and after running ParaView i got this Error:


Code:

ERROR: In /home/kitware/Dashboards/MyTests/ParaView-master/VTK/IO/vtkOpenFOAMReader.cxx, line 6882
vtkOpenFOAMReaderPrivate (0x1d9f0f0): boundaryField defaultFaces not found in object U at time = 0


ERROR: In /home/kitware/Dashboards/MyTests/ParaView-master/VTK/IO/vtkOpenFOAMReader.cxx, line 6882
vtkOpenFOAMReaderPrivate (0x1d9f0f0): boundaryField defaultFaces not found in object nuTilda at time = 0


ERROR: In /home/kitware/Dashboards/MyTests/ParaView-master/VTK/IO/vtkOpenFOAMReader.cxx, line 6882
vtkOpenFOAMReaderPrivate (0x1d9f0f0): boundaryField defaultFaces not found in object nut at time = 0


ERROR: In /home/kitware/Dashboards/MyTests/ParaView-master/VTK/IO/vtkOpenFOAMReader.cxx, line 6882
vtkOpenFOAMReaderPrivate (0x1d9f0f0): boundaryField defaultFaces not found in object p at time = 0

and that's why, i couldn't run the simulation....




do you have any idea, how to solve this problem ?



I need your Support:)



Thanks.

Mirage12 June 4, 2013 08:04

Hello everyone, :)

I removed my paraview, which i downloaded from paraview.org and i installed the paraview from this website http://www.openfoam.org/download/ubu..._0-1_amd64.deb (source http://www.openfoam.org).

The simulation is now working, but i got this Error:

p, li { white-space: pre-wrap; }
Code:

ERROR: In /home/opencfd/OpenFOAM/ThirdParty-2.1.x/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6882
 vtkOpenFOAMReaderPrivate (0xf7ef40): boundaryField defaultFaces not found in object nuTilda at time = 0
 

 

 ERROR: In /home/opencfd/OpenFOAM/ThirdParty-2.1.x/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6882
 vtkOpenFOAMReaderPrivate (0xf7ef40): boundaryField defaultFaces not found in object nut at time = 0
 

 

 ERROR: In /home/opencfd/OpenFOAM/ThirdParty-2.1.x/ParaView-3.12.0/VTK/IO/vtkOpenFOAMReader.cxx, line 6882
 vtkOpenFOAMReaderPrivate (0xf7ef40): boundaryField defaultFaces not found in object p at time = 0

and the solutions are not reasonable....

I need your Support:)

Thanks.

wyldckat June 9, 2013 08:32

Hi Amin,

Well this is indeed a bit strange... OK, so the first diagnostic is that your mesh only defines 3 patches: "outlet", "inlet" and "fixedWalls".

blockMesh
then tells you that all of the other faces that you did not specify patches for them, it associated automatically all of them to the default patch name "defaultFaces".

Then, since you were not aware of this, you only defined boundary conditions for the patches you knew about.

In addition, it seems that you have set-up the case to run with a "laminar" transport model, therefore the fields "nut", "k", "epsilon" and so on are not used by the solver, nor did you configure them accordingly.

In the end, the problem you get from ParaView is that it is not aware that the fields "nut", "k", "epsilon" are to be ignored. The trick is to not select them in the selection box "Volume Fields".

Now, the strange thing is about the "p" field. simpleFoam seemed to open the file "0/p" just fine, or perhaps it completely ignored it... either way, the patch name "defaultFaces" should be missing from it, which is why ParaView complained.

Best regards,
Bruno

Mirage12 June 12, 2013 09:23

2 Attachment(s)
Hello Bruno,

Thanks for support :)

I solved the problem. The initialization of my boundaries was not correct.

here ist the correct blockMeshDict File:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |Attachment 22688
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  | Author:  Amine Abd.                            |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.1;

vertices
(
    (0 0 0)//0
    (1 0 0)//1
    (2 0 0)//2
    (9 0 0)//3
    (9 1 0)//4
    (9 2 0)//5
    (9 3 0)//6
    (2 3 0)//7
    (1 3 0)//8
    (0 3 0)//9
    (0 2 0)//10
    (0 1 0)//11
    (1 1 0)//12
    (2 1 0)//13
    (2 2 0)//14
    (1 2 0)//15
    (0 0 1)//16
    (1 0 1)//17
    (2 0 1)//18
    (9 0 1)//19
    (9 1 1)//20
    (9 2 1)//21
    (9 3 1)//22
    (2 3 1)//23
    (1 3 1)//24
    (0 3 1)//25
    (0 2 1)//26
    (0 1 1)//27
    (1 1 1)//28
    (2 1 1)//29
    (2 2 1)//30
    (1 2 1)//31
);


blocks
(
    hex (0 1 12 11 16 17 28 27) (40 40 5) simpleGrading (1 1 1) //1

    hex (1 2 13 12 17 18 29 28) (40 40 5) simpleGrading (1 1 1) //2

    hex (2 3 4 13 18 19 20 29) (90 40 5) simpleGrading (6 1 1) //3

    hex (13 4 5 14 29 20 21 30) (90 40 5) simpleGrading (6 1 1) //4

    hex (14 5 6 7 30 21 22 23) (90 40 5) simpleGrading (6 1 1) //5

    hex (15 14 7 8 31 30 23 24) (40 40 5) simpleGrading (1 1 1) //6

    hex (10 15 8 9 26 31 24 25) (40 40 5) simpleGrading (1 1 1) //7

    hex (11 12 15 10 27 28 31 26) (40 40 5) simpleGrading (1 1 1) //8

);

edges
(


);
boundary
(


        inlet
    {
        type patch;
        faces
        (
         
          (9 10 26 25)
          (10 11 27 26)
          (11 0 16 27)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (3 4 20 19)
            (4 5 21 20)
            (5 6 22 21)
           
     
             
        );
    }
 
    fixedWalls
    {
        type wall;
        faces
        (

          (28 29 13 12)
          (29 30 14 13)
          (30 31 15 14)
          (31 28 12 15)
          (0 1 17 16)
          (1 2 18 17)
          (2 3 19 18)
          (8 9 25 24)
          (7 8 24 23)
          (6 7 23 22) 
         

          );
    }     

    frontAndBack
    {
        type empty;
        faces
        (  (1 0 11 12)
          (2 1 12 13)
          (2 3 4 13)
          (4 13 14 5)
          (5 14 7 6)
          (14 15 8 7)
          (15 10 9 8)
          (12 11 10 15)
          (16 17 28 27)
          (17 18 29 28)
          (18 19 20 29)
          (20 21 30 29)
          (21 22 23 30)
          (30 23 24 31)
          (31 24 25 26)
          (28 31 26 27)

        );
    }
);

mergePatchPairs
(
);

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

and here is the U file in the 0 dictionary :

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.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 (25.75 3.62 0);

boundaryField
{
    inlet
    {
        type            freestream;
        freestreamValue uniform (25.75 3.62 0);
    }

    outlet
    {
        type            freestream;
        freestreamValue uniform (25.75 3.62 0);
    }

  fixedWalls
    {
        type            fixedValue;
        value          uniform (0 0 0);
    }

    frontAndBack
    {
        type            empty;
    }
}

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

In the attachments, you find a screen-shot of the velocity and the mesh.

Mirage12 June 14, 2013 01:23

2 Attachment(s)
Hello everyone, :)

In order to visualize the velocity and pressure, that i used the option #Plot over the Line# in ParaView. ( SEE THE ATTACHMENTS)

I'd like to plot the velocity, Reynolds number and pressure in only one point over the time and the variation of the Reynolds number over the Line.

Any idea, how to plot in only one point the velocity, Reynolds number,pressure, drag and lift over the time??


Thanks :)

wyldckat June 15, 2013 11:20

Hi Amin,

Check this post: http://www.cfd-online.com/Forums/par...tml#post405615 - post #2
The key filter explained there is "Plot selection over time" and that post also explains one way for selecting a specific point.

Best regards,
Bruno


All times are GMT -4. The time now is 14:02.