CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Poiseuille flow in a channel

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By meindert

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 20, 2012, 11:46
Default Poiseuille flow in a channel
  #1
Member
 
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 14
camille131 is on a distinguished road
Hello I m new on open foam and I m trying to run a poiseuille flow.

I have defined my mesh in blockMeshDict with cyclic conditions.

But actually I don't know if I have to run it with icoFoam or channel Foam.

with icoFoam, the velocity diffuses until it reaches 0
with channelFoam it diffuses a little but not until 0.

so I suppose I have to use channelFoam. But, channelFoam uses LEScalculation so I put a laminar LESModel in LESproperties file.

is that right?

I also introduces a constant velocity in the internaField.

for the moment I have zeroGradient condition for the pressure but I'd like to indroduce a linear gradient such as to have 2 (or 1) at the inflow and 1 (or 0.1 respectively) at the outflow.

how do I have to change my 0/p file?

thank you very much for your help.


Quote:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.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 0;//profil linéaire entre 1 et 0.1

boundaryField
{
TopAndBottom
{
type zeroGradient;
}

Inflow
{
type cyclic; // changer
}
Outflow
{
type cyclic;
}

frontAndBack
{
type empty;
}
}

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

Quote:
*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0.5 0 0);

boundaryField
{
TopAndBottom
{
type fixedValue;
value uniform (0 0 0);
}

Inflow
{
type cyclic;
}
Outflow
{
type cyclic;
}

frontAndBack
{
type empty;
}
}

// ************************************************** *********************** //
Quote:
*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.1;

vertices
(
(0 0 0)
(1 0 0)
(1 0.5 0)
(0 0.5 0)
(0 0 0.1)
(1 0 0.1)
(1 0.5 0.1)
(0 0.5 0.1)
);

blocks
(
hex (0 1 2 3 4 5 6 7) (40 20 1) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
TopAndBottom
{
type wall;
faces
(
(3 7 6 2)
(1 5 4 0)
);
}
Inflow
{
type cyclic;
neighbourPatch Outflow;
faces
(
(0 4 7 3)
);
}
Outflow
{
type cyclic;
neighbourPatch Inflow;
faces
(
(2 6 5 1)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(4 5 6 7)
);
}
);

mergePatchPairs
(
);

// ************************************************** *********************** //
camille131 is offline   Reply With Quote

Old   October 20, 2012, 15:38
Default
  #2
Member
 
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 14
meindert is on a distinguished road
Quote:
Originally Posted by camille131 View Post
Thank you for your answer actually I also have to kearn how to search correctly on the help guide ^^

but so , what s the difference between nuEff and nu? and what does the temperature T have to do here? it because the problem is coupled? in laminar case we don't care?

thank you
sorry it s not so easy to come from nowhere ..


I have then introduced a new subject for other questions about Poiseuille. here: http://www.cfd-online.com/Forums/ope...tml#post387650
I understand it's not easy. I was there myself not too long ago.

However, I really want to encourage you to try and understand the code using Doxygen. The questions that you are asking can be answered by either searching the forum or by using the search box on http://www.openfoam.org/docs/cpp/.

I will give you a quick answer. The difference between nuEff and nu is that nuEff is the sum of nu and nuSgs, where nuSgs is the subgrid-scale viscosity. If you are considering laminar flow, there is no difference. The definition of nuEff might be different for different subgrid-scale models. You should try to check that yourself.
T stands for transpose here, not temperature.

Last edited by meindert; October 20, 2012 at 17:29.
meindert is offline   Reply With Quote

Old   October 23, 2012, 10:32
Default
  #3
Member
 
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 14
camille131 is on a distinguished road
Thank you fo your answer meindert.

i m now running the tutorial channel395 as you told me but it takes a long time. Is it necessary to run until endTime 1000 with such a small deltaT : 0.2 ?
camille131 is offline   Reply With Quote

Old   October 23, 2012, 11:55
Default
  #4
Member
 
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 14
camille131 is on a distinguished road
Finally I stopped it at 440 beacause it is too slow.

About ma problem of simulation poiseuille flow. I found a subject : http://www.cfd-online.com/Forums/ope...utlet-b-c.html
which explains how to introduces a pressure gardient but it does not seems to work really well.
$is t because I m not using 1.7.1 version of OpenFoam but version 2.1.1?
or because I m using this with channelFoam and I can't?


Actually I modified my previous 0/p file like that : (the 0/U file does not change)

Quote:
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField uniform 0;//profil linéaire entre 1 et 0.1

boundaryField
{
TopAndBottom
{
type zeroGradient;
}

Inflow
{
type cyclic;
f List<scalar> 1(-0.005); // p_OF = p_real / rho
value uniform 0;
}
Outflow
{
type cyclic;
}

frontAndBack
{
type empty;
}
}
Maybe I don't write the pressure drop at the right place? how can I put a linear profile of pressure?


Thank you for your help

Camille
camille131 is offline   Reply With Quote

Old   October 23, 2012, 12:03
Default
  #5
Member
 
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 14
meindert is on a distinguished road
Hi Camille,

Have a look at the Courant number and you will realise that the value for deltaT is not that small for this particalur case. Is it necessary to run until time 1000? Maybe, maybe not. It should take about an hour and a half to complete the simulation. I think it would be good for your understanding to let the simulation finish.
meindert is offline   Reply With Quote

Old   October 23, 2012, 12:24
Default
  #6
Member
 
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 14
meindert is on a distinguished road
To be honest, I am not sure if that will work with the channelFoam solver.

The channelFoam solver splits the pressure in periodic component and a pressure drop (called gradP). This allows you to use periodic boundary conditions. The input for the channelFoam solver is the flow rate and the channelFoam solver adjusts gradP to maintain this flow rate. After a certain time you will see that gradP stabilizes. So, given a flow rate, the channelFoam solver will give you a pressure drop.

I realise this is the opposite of what you actually want. Perhaps you should try the above with the icoFoam solver. I am afraid I cannot help you beyond that point.
sunliming likes this.
meindert is offline   Reply With Quote

Old   October 23, 2012, 13:07
Default
  #7
Member
 
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 14
camille131 is on a distinguished road
Ok maindert I will try with icoFoam and let you know after that . but before I have to wait for the end od channel395 :-) at the moment I m at 640 .
Thank you for the precisions
camille131 is offline   Reply With Quote

Old   October 23, 2012, 16:34
Default
  #8
Member
 
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 14
camille131 is on a distinguished road
Good evening ,
finally my computer just just down while running channelFoam tutorial.. it was too hot. I will have to use the computer of the university if I don't want to break my own computer^^


About the pressure gradient with icoFoam
it seem to work now but...
I don't know which value I have to choose.
I ve chosen a uniform velocity for the internalField of 0.5 m/s in the x-direction and 0 in the 2 other ones.

dx=d/n=1/40

so as we need a Courant number smaller or equal to one, dt must be smaller or equal to 0.05 . Actually I put 0.005 as in icoFoam tutorial.

it is ok except when I change value for the pressure. and at the end of the simulation I get this image : http://imageshack.us/photo/my-images/694/pt05.jpg/

for the code described below:

Quote:
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField uniform 0;

boundaryField
{
TopAndBottom
{
type zeroGradient;
}

Inflow
{
type fan;
patchType cyclic;
f List<scalar> 1(-0.005); // p_OF = p_real / rho
value uniform 50;
}
Outflow
{
type fan;
patchType cyclic;
f List<scalar> 1(-0.005); // p_OF = p_real / rho
value uniform 50;
}

frontAndBack
{
type empty;
}
}
what does the pressure have to do with current number? it is because the pressure changes the velocity and then de courant number. But how to choose a good valu for pressure?
Thank you

Cam
camille131 is offline   Reply With Quote

Old   October 24, 2012, 08:34
Default
  #9
Member
 
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 14
meindert is on a distinguished road
Hi Camille,

The flow is pressure driven, so the pressure will affect the velocity field. You will see this in the Courant number of course.

Regarding the pressure field, I think you need to think about what you want exactly. Do you want to fix a certain pressure drop or do you want set a specific flow rate?
You have probably noticed there is something going on in the pressure field near the periodic boundaries. I am not familiar with the fan type, but I would say this should alarm you. Think about it. If you impose a pressure drop over your domain, it will create a discontinuity in the pressure field if you use periodic boundary conditions. This explains the sharp pressure increase near the inflow and the outflow. Unless the fan type does something magical, you need to do something about this.

You could do two things now.

Option one is accept that you do not know your pressure drop in advance and set a certain flow rate, in which case you would go with the channelFoam solver. I am not sure if you have tried running the chan395 tutorial case without touching any of the settings. If you have not done that yet, I would advise you to do so. Use it to understand what the channelFoam solver does exactly.

Option two is modifying the icoFoam solver by splitting the pressure in a periodic component and a pressure drop in a similar way as the channelFoam solver does. I am sure people have done this before, so try searching the Internet a bit if you decide to do this. I would say option one is by far the easiest way to go, especially if you do not have much experience with OpenFoam.

Last edited by meindert; October 24, 2012 at 09:18.
meindert is offline   Reply With Quote

Old   October 25, 2012, 12:26
Default
  #10
Member
 
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 14
camille131 is on a distinguished road
Hi Meindert,
Thank you for your answer.
Of course I noticed something was wrong with my boundaries but
I didn't run channel395 because my computer does not seems to support it..

Actually I would like to impose a pressure drop and not a specific flow rate.


Going into icoFoam code seems quite difficult :-/
camille131 is offline   Reply With Quote

Old   October 25, 2012, 12:44
Default
  #11
Member
 
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 14
camille131 is on a distinguished road
With channelFoam I obtain a pressure field like that : http://imageshack.us/a/img109/3633/pt05w.jpg

does not seems good either.
camille131 is offline   Reply With Quote

Old   October 25, 2012, 13:29
Default
  #12
Member
 
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 14
meindert is on a distinguished road
Hi Camille,

In which cell did you set the reference pressure? Try to set it in a cell which is not too close to the boundaries. I have been told that setting the reference pressure in a cell too close to the boundaries might cause unwanted numerical behavior.

I understand you are not happy with this pressure field, but I would like to remind you that the pressure field p represents the periodic component of the pressure for a channelFoam case. The pressure drop gradP is stored separately in the time directories in a subdirectory called uniform.
meindert is offline   Reply With Quote

Old   October 25, 2012, 13:36
Default
  #13
Member
 
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 14
camille131 is on a distinguished road
euh... is it in fvSolution file that I have to change pRefCell and pRefValue? they are set both to 0 as in the tutorial. which values shouldd I try?

you say
Quote:
The pressure drop gradP is stored separately in the time directories in a subdirectory called uniform.
but I don't find it . in which file ?I have no time directory
camille131 is offline   Reply With Quote

Old   October 25, 2012, 13:49
Default
  #14
Member
 
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 14
meindert is on a distinguished road
You can leave pRefValue at 0. Actually, it does not really matter which value you set there. In a closed system only pressure differences are important.
The value of pRefCell depends on the size of the grid. Cell 0 is a corner cell. I am sure you can find a cell that lies inside the domain.

Of course you have time directories. How else would you access the data? Every N^{\text{th}} time step data is stored in a time directory, e.g. a directory called 1000.
meindert is offline   Reply With Quote

Old   October 25, 2012, 14:05
Default
  #15
Member
 
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 14
camille131 is on a distinguished road
oh yes sorry I didn't understand but now I ve found. gradP is a .raw file and when i open it, it shows me a black window..

Other question, how can I know that a particular cell won't be onthe boundary?
camille131 is offline   Reply With Quote

Old   October 25, 2012, 14:34
Default
  #16
Member
 
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 14
meindert is on a distinguished road
Have you read the User's Guide? If you know how the mesh is created with the blockMesh utility, a simple calculation will give the cell number of any cell. Another way to find the cell number is by using Paraview, but for a simple geometry you should not have to use that. Read the User's Guide. You could also benefit from reading the Programmer's Guide in addition to that.
meindert is offline   Reply With Quote

Old   October 31, 2012, 07:38
Default
  #17
Member
 
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 14
camille131 is on a distinguished road
Sorry I was away for a few days.

Y es i have read the user guide but I don't see where they explain how the cells are numbered.

what is the computation to do? And how to see these numbers in Paraview? with wireframe I can see the cells but not their number...


I have defined hex (0 1 2 3 4 5 6 7) (40 20 1) simpleGrading (1 1 1)
So :
40 cells in x-direction
20 cells in y-direction
1 cell in z-direction.


Ok but where do we begin to count?
camille131 is offline   Reply With Quote

Old   November 1, 2012, 06:00
Default
  #18
Member
 
Camille
Join Date: Oct 2012
Posts: 54
Rep Power: 14
camille131 is on a distinguished road
Hi,
finally I obtain something that seems better using icoFoam and not cyclic condition.

here are the plot at the end of the simulation :
p : http://img440.imageshack.us/img440/1235/pt05.jpg
U : http://img89.imageshack.us/img89/1756/ut05m.jpg

and the significant part of the code :

0/p file

Quote:
internalField uniform 0;

boundaryField
{
inlet
{
type fixedValue;
value uniform 5;
}

outlet
{
type fixedValue;
value uniform 4;
}
upAndDown
{
type zeroGradient;
}
0/U file

Quote:
internalField uniform (0 0 0);

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

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

upAndDown
{
type fixedValue;
value uniform (0 0 0);
}
with all the patch of type wall


But I don't know if I can be satisfied of the plot of the initial condition at t0:
for U it's value 0 everywhere, not interesting

for p : http://img507.imageshack.us/img507/4530/pt0hv.jpg

I would like the p field inside to decrease linearly from 5 to 4 and not to fall down to 0 between the BC. is it possible?

I suppose I have to change in 0/p field the internalField. Can I put a gradient condition?

Thanks you in advance for your help
camille131 is offline   Reply With Quote

Old   November 1, 2012, 07:30
Default
  #19
Member
 
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 14
meindert is on a distinguished road
Have a look at swak4Foam (http://openfoamwiki.net/index.php/Contrib/swak4Foam). With the funkySetFields utility you should be able to do what you want.
meindert is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Channel flow using InterFOAM DanM OpenFOAM Running, Solving & CFD 49 July 31, 2020 12:43
Yacht in Open Channel Flow andreimour FLUENT 1 October 15, 2010 00:54
Stabilizing turbulence equation in channel flow Biga Main CFD Forum 5 March 22, 2005 21:06
Channel flow - Galerkin method Ingo Meisel Main CFD Forum 1 November 15, 2002 06:15
Inviscid Drag at subsonic, subcritical Mach # Axel Rohde Main CFD Forum 1 November 19, 2001 13:19


All times are GMT -4. The time now is 21:23.