CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Simple straight tube problem (

everyday October 1, 2014 22:28

Simple straight tube problem
Hi everyone, I've been trying to get OpenFOAM up and running and I'd like to start with an easy, verifiable case of Pouseuille flow through two straight parallel planes. This can be a 2D simulation with no-slip on the solid walls and periodic inlet/outlet velocities. I'd like for the pressures to be "periodic" as well.

I am starting with the channel395 example, use a blockMeshDict similar to the lid-driven cavity except without the moving top, and with cyclic inlet/outlets.
I'd like to simulate it with a uniform body force (eg gravity) instead of by specifying the Ubar. However, there are errors whenever pimpleFoam is run. The gravity is specified in a file "constant/g" which I borrowed from the tutorials/multiphase/icoFoam/laminar/damBreak case. I'm also commenting out the lines in the setup files whereever Ubar is specified.

Any help getting me set up with this simple case would be very appreciated!

The error I get when I hit ./Allrun is:


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading field p

Reading field U

Reading/calculating face flux field phi

[0] Illegal master cellID 1001. Should be 0..80
[0] file: /home/andrew/workspace/foam/straightTube/system/fvSolution.PIMPLE from line 60 to line 64.
[0]    From function void Foam::setRefCell
    const volScalarField&,
    const volScalarField&,
    const dictionary&,
    label& scalar&,
[0]    in file cfdTools/general/findRefCell/findRefCell.C at line 66.
FOAM parallel run exiting

everyday October 2, 2014 02:01

Try reading the error message why don't you...
So I took a closer look at the error message, and the answer was obviously inside the fvSolution file, where the pressure reference cell for pimple was set incorrectly.

Anyways, I am now having success in running the very simple flow in this geometry so long as I am using the pressureGradientExplicitSource and specifying a Ubar. Is there a way to specify explicitly what the pressure gradient is? It seems like a much simpler task than finding the pressure gradient for some Ubar, but I can't seem to find any documentation on the available options for momentumSource. Is there anything like "constantAccelerationSource" ?

I found some old forum posts referring to a "channelFoam" tutorial, but I'm guessing that's depracated now and that channel395 is the only one. Any help would still be very much appreciated!

everyday October 2, 2014 12:03

So I am plugging away again, trying to decipher the doxygen (which isn't fully compiling for some reason) and discovered that there is a momentumSource called "vectorExplicitSetValue" which is an explicit typed class of "explicitSetValue". However, there is no documentation on what the options are for explicitSetValueCoeffs or vectorExplicitSetValueCoeffs. Is there a better documentation or example set for this? The most I could find was one older post asking for help, where no one answered him. I hope that isn't what happens to this thread...

Here was his post:

momentumSource {
    type            vectorExplicitSetValue;
    active          on;            //on/off switch
    selectionMode  all;      //cellSet // points //cellZone
      vectorExplicitSetValueCoeffs    {
        injectionRate        {
            F    ( 0.1335 0 0 );

I'm going to try this out and see if it works, and also wrestle with the doxygen generator. But in the meantime, I would STILL very much appreciate some help, or at least some acknowledgement that I'm alive....

everyday October 2, 2014 14:09

So I did manage to get this working now, using the "semiImplicitSource" instead of the "vectorExplicitSetValue". From my prodding around, it seems that "vectorExplicitSetValue", used as above but with "U" instead of "F", directly sets the value of velocity at each time step, which is not what I want.

However, the semiImplicitSource seems to add a source term at each time step, which is precisely how I can treat my simulation. The only thing I don't understand now is the difference between "absolute" and "specific" in the options. I only know that for this simple case, using "absolute" gives a result about 10x bigger than expected, but "specific" gives the expected result.

Here is my fvOptions for any future foamers (myself included):


  type vectorSemiImplicitSource;
  active on;
  selectionMode all;

      //volumeMode      absolute; // specific
      volumeMode        specific;
        U          ( (1 0 0) 0);


All times are GMT -4. The time now is 07:47.