CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Running a test (https://www.cfd-online.com/Forums/openfoam-solving/230213-running-test.html)

ramrebol September 13, 2020 14:07

Running a test
 
Hello.



I executed some tutorials, and now I try to run my own test. I have tried to understand why it does not run, but I can't understand it. It is a fluid (Navier-Stokes) in a curved tube. There are "inlet", "outlet" and "walls" faces. I made the mesh in salome. I'm trying to use icoFoam.


I tryied to use OpenFoam 8 and foam-extend 4.0 and 4.1 versions. Are there differences when implementing the same example in these differents OpenFoam versions?

I'm new in OpenFoam world, and I'm trying my best to learn how to use it.


Modifying somethings appears different errors, that's why I think could be easier to detect the error sharing my codes with you to understand where is the error.



https://www.dropbox.com/s/hvys04778v...tpipe.zip?dl=0


Thanks in advance.

petros September 14, 2020 07:53

Hi,

First things first, please try to provide to the community a snippet of the errors that you get using the code tags. Usually, errors are self-explanatoty, especially in the beginning of your OpenFOAM experience. Also, as a beginner do not try to build a case from scratch. Instead, use the tutorials that come with every OpenFOAM branch that you wish to use.

From a quick look at your case:
  • The 0 folder should be placed outside of the constant folder.
  • The type of your boundaries in the boundary file should be the same with the ones used in the 0 directory.
  • When you set velocity inlet you must let the flow exit the domain so fix the pressure at the outlet.

I suspect that you tried to follow the cavity case but you didn't notice that the boundaries are walls and not patches as in your case.

I hope that the above info will help getting you started.

Best,
Petros

ramrebol September 16, 2020 00:10

Thanks petros, you are right, the files were in wrong place, and also I'm editing the cavity example for my problem. Since I'm new in the OpenFoam world, I really appreciate your support.

Now I'm running a simpler test as before: a straight cylinder example with circular base (without using any symmetry).


1. I read that icoFoam is just for laminar fluid, Can I use it for transient or turbulent fluid? My question is, icoFoam solves the following Navier--Stokes equations or I must to be careful with some assumption?


u_t-\nu\Delta u+(\nabla u)u+\nabla p=f in \Omega
\nabla\cdot u=0 in \Omega
(plus boundary conditions)



2. I separated the non-interior faces in three groups: "inlet", "outlet" and "walls" ("walls" are the non-interior faces that are not inlet nor outlet). For the outlet I want to impose Neumann boundary condition, that I know are


-(\nu\nabla u+p)n=0


This is the typical Neumann boundary condition that appears in Finite Element method, and may be here, as OpenFoam uses Finite Volume Method, is not the same. As I not see how to implement this boundary condition in the tutorials, I would like to be sure that I'm doing it right. The data in my input files are:



0/p:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  8
    \\/    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  fixedValue;
      value  uniform 0.02;
    }
 
  outlet
    {
      type  fixedValue;
      value  uniform 0.0;
    }
 
  walls
    {
      type  zeroGradient;
    }
}

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

0/u
Code:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  8
    \\/    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    pressureInletVelocity;
      value  uniform (0 0 0);
    }

    outlet
    {
      type    zeroGradient;
    }

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

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


3. I'm trying to implement a Poiseuille flow. Do you think I did well?
p_{\textrm{inlet}}=20 and p_{\textrm{outlet}}=0.

petros September 16, 2020 13:00

1. icoFoam is for incompressible, laminar and transient flows of Newtonian fluids so it doesn't handle turbulence.

2. The Neumann boundary condition is a fixedGradient. As for your case, you have correctly chosen the fixedValue BC, which is a Dirichlet BC.

Just to remind you that the Neumann BC in OpenFOAM is:

\phi_f = \phi_c+\Delta\nabla \phi

where \Delta is the face-to-cell distance.

3. In incompressible solvers the pressure is the kinematic pressure measured in m^2/s^2 because we devide by the density. Your values are correct only if your fluid is water with an assumed density of 1000 kg/m^3.

Best,
Petros

ramrebol September 17, 2020 12:34

Thank you very much. I hope not to abuse your patience to continue clarifying certain doubts.

1. Thanks !
3. Yes it is, I'm running tests where I can compare known solutions to understand how OpenFoam works.


2. About Neumann boundary conditions, I come from the "Finite Elements" world, where the Neumann boundary condition are:

-(\nu\nabla u+p)n=0

I don't know if it is an abuse to ask you to explain (or send me a link) to learn how this relates to OpenFoam's implementation of Neumann conditions, I mean, the numerical algorithm inside. If you think it is too much (or require an answer to long), you may not aswer this question.


I have some little questions too:


Question A:
--------------------------------------------
For the pressure:

inlet
{
type fixedValue;
value uniform 0.02;
}


For me this is ok, because we have impose a fixed value for the inflow pressure


But, for the velocity

inlet
{
type pressureInletVelocity;
value uniform (0 0 0);
}


What the "value uniform (0 0 0 );" means? I'm fixing the inlet velocity value to cero? Is this ok?

Furthermore, for the velocity:

outlet
{
type zeroGradient;
}

--------------------------------------------

I suppose that the "zeroGradient" for the outlet velocity is related with the Neumann boundary condition.

If -(\nu\nabla u+p)n=0 is the Neumann boundary condition, \nabla u n=0 because we are supposing that the fluid is fully development?



--------------------------------------------

Question B:

For me, it is natural to impose velocity equal to zero in the walls, but, why we can (or must) impose the "zeroGradient" for the pressure?

walls
{
type zeroGradient;
}

petros September 18, 2020 15:07

The implementation of the Neumann boundary condition in OpenFOAM can be found here. You may also want to have a look at the respective source code here.

Quote:

Originally Posted by ramrebol (Post 783034)

What the "value uniform (0 0 0 );" means? I'm fixing the inlet velocity value to cero? Is this ok?

This value is just an initial value needed by the solver to start the iteration.


Quote:

Originally Posted by ramrebol (Post 783034)

I suppose that the "zeroGradient" for the outlet velocity is related with the Neumann boundary condition.

If -(\nu\nabla u+p)n=0 is the Neumann boundary condition, \nabla u n=0 because we are supposing that the fluid is fully development?

The zeroGradient is a Neumann boundary condition. Try to think in terms of finite volume and how OpenFOAM treats the boundaries. The Neumann boundary condition is the way that we calculate the patch values from the adjacent cell centres. And yes, you can say that a fully developed flow implies zeroGradient for your flow variables at the outlet, but also for your case relates to the fact that you have fixed the pressure at the inlet.

Quote:

Originally Posted by ramrebol (Post 783034)

Question B:

For me, it is natural to impose velocity equal to zero in the walls, but, why we can (or must) impose the "zeroGradient" for the pressure?

Yes this is the common practice. But don't be confused, zeroGradient does not mean that we fix the value at the boundary. This is actually an interesting topic and you can learn more by some discussion elsewhere, e.g. here and here.

I hope my comments were helpful.

Best,
Petros

ramrebol September 21, 2020 23:30

Thanks petros for your huge patience. I'm analyzing your answer.
I feel that I have a lot to learn about the software, and your guidance is very useful.


All times are GMT -4. The time now is 06:32.