segunda-feira, 10 de junho de 2013

How to set Icofoam to solve the Annular Flow problem

As you observed, I solved the problem already. This post is a step-by-step to help you to solve the same problem.

What do we need?

  1. Prepare a set of folders to run Openfoam;
  2. Export the created mesh to unv;
  3. Convert the unv to Openfoam;
  4. Prepare Icofoam to run.

1 - Prepare a set of folders to run Openfoam

I'm here not to reinvent the wheel. You can see a good Openfoam introduction in http://www.openfoam.org/docs/user/cavity.php

At this type of annular incompressible flow I choose to use Icofoam ... it is not the closest flow model to the problem ... it is the flow model. So, pick the cavity problem itself and copy to where you are going to run your simulation.

2 - Export the created mesh to unv

The best way, to me, is to export to a unv file. 
Right click over the mesh and choose to export to UNV file
When you export the file, please, export to the root folder of your problem. For example, if you copied "cavity" folder, this mesh should be on "cavity".

3 - Convert unv file to Openfoam

If you read some of my reports, you will see, we set the environment to succeed on this process. We have the Inlet, Outlet, Inner Wall and Outer Wall boundaries. So, this process should be straight forward. If you don't succeed you are maybe facing issues in your mesh or in your Salomé (6.5!) version (Take a look at http://openfoamwiki.net/index.php/IdeasUnvToFoam).

Is your unv file in the correct folder? If yes, just type:

  ideasUnvToFoam Annular.unv

My file is called "Annular.unv"

Ok. Type:
  
  checkMesh

And in your output you should be looking for this:

Checking patch topology for multiply connected surfaces ...
    Patch                      Faces    Points   Surface topology                  
    Inlet                       1296      1368     ok (non-closed singly connected)  
    Outlet                    1296      1368     ok (non-closed singly connected)  
    Outer_Wall           14400    14472    ok (non-closed singly connected)  
    Inner_Wall            14400    14472    ok (non-closed singly connected)  

As you can see, we have everything. Inlet, Outlet, Outer_Wall and Inner_Wall.

4 - Prepare Icofoam to run

Now comes the part that took me a while to understand. Take a look on the following link http://www.openfoam.org/docs/user/boundaries.php

Let's take care of the boundary conditions. Open the "p" file on the subfolder "0" (zero) and substitute for this one:


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

boundaryField
{
    Inlet
    {
        type            zeroGradient;
    }

    Outlet
    {
        type            fixedValue;
        value           uniform 0;
    }

    Inner_Wall
    {
        type            zeroGradient;
    }

    Outer_Wall
    {
        type            zeroGradient;
    }

}

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

You can find an explanation of this file in here: http://www.openfoam.org/docs/user/basic-file-format.php.

But the there are some few things that I must call your attention.

On the line that says:

   dimensions      [0 2 -2 0 0 0 0];

Is saying that you have a dimension of m²/s². Well, it is a pressure file so, we should be expecting in SI units a dimension of kg/(m.s²). What is the problem? No problem at all. With Icofoam we will use kinematic viscosity and to keep the units coherent on the solver we must divide the pressure by density.

Type zeroGradient:

As you can see, I'm using zeroGradient in every patch except "Outlet". It is only because I'm not using the gravity for this problem and solving the Navier-Stokes Equations for this setting you will find a zero pressure gradient. On the Outlet I'm using fixed value because the flow runs is not constrained anymore and goes to the environment that has zero pressure.

On the same "0" subfolder let us see the "U" file and substitute for the following:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.1                                 |
|   \\  /    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
{
    Inlet
    {
        type            fixedValue;
        value           uniform (0 0 1.66);
    }

    Outlet
    {
        type            zeroGradient;
    }
 
    Inner_Wall
    {
type            fixedValue;
        value           uniform (0 0 0);
    }

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

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


As you can see, is very straightforward. You have the no-slip condition on the walls and the velocity inlet.

Now we should move to the subfolder "constant". In there you should find the polyMesh folder (don't need to touch it. It came from the unv conversion) and "transportProperties" file. Open it and substitute for:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

nu              nu [ 0 2 -1 0 0 0 0 ] 7.27e-5;


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

As I said, IcoFoam uses the kinematic viscosity. You have the correct dimensions and the attribute value that came from http://chasingaftermystuff.blogspot.com.br/2013/05/using-icofoam-to-solve-annular-flow.html.

To the folder "System" I would advise you to wait a little bit more. I don't understand it as a whole yet and would suggest you to look into Openfoam's website for further information.

But if you have any doubt, just contact me ...




Nenhum comentário:

Postar um comentário