# Running a test

 Register Blogs Members List Search Today's Posts Mark Forums Read

 September 13, 2020, 15:07 Running a test #1 New Member   Ra Miro Join Date: Aug 2020 Posts: 21 Rep Power: 4 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.

 September 14, 2020, 08:53 #2 Member   Petros Ampatzidis Join Date: Oct 2018 Location: Bath, UK Posts: 63 Rep Power: 6 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

 September 16, 2020, 01:10 #3 New Member   Ra Miro Join Date: Aug 2020 Posts: 21 Rep Power: 4 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? in in (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 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? and .

 September 16, 2020, 14:00 #4 Member   Petros Ampatzidis Join Date: Oct 2018 Location: Bath, UK Posts: 63 Rep Power: 6 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: where is the face-to-cell distance. 3. In incompressible solvers the pressure is the kinematic pressure measured in because we devide by the density. Your values are correct only if your fluid is water with an assumed density of . Best, Petros

 September 17, 2020, 13:34 #5 New Member   Ra Miro Join Date: Aug 2020 Posts: 21 Rep Power: 4 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: 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 is the Neumann boundary condition, 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; }

September 18, 2020, 16:07
#6
Member

Petros Ampatzidis
Join Date: Oct 2018
Location: Bath, UK
Posts: 63
Rep Power: 6
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 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 I suppose that the "zeroGradient" for the outlet velocity is related with the Neumann boundary condition. If is the Neumann boundary condition, 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 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.

Best,
Petros

 September 22, 2020, 00:30 #7 New Member   Ra Miro Join Date: Aug 2020 Posts: 21 Rep Power: 4 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.

 Tags foam-extend 4.0, navier stokes equations, pipe flow