CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Trouble setting groovyBC interFoam Inlet BC (http://www.cfd-online.com/Forums/openfoam/103968-trouble-setting-groovybc-interfoam-inlet-bc.html)

mgdenno June 30, 2012 14:37

Trouble setting groovyBC interFoam Inlet BC
 
1 Attachment(s)
Hello,

As indicated in the post title, I am trying to use groovyBC to set the inlet boundary condition for a interFoam simulation. I am using OpenFOAM 2.1.0 running on kubuntu 11.10. The attached picture (colored as p_rgh) shows a 2D view of the problem which is flow in a channel over a spillway. The inlet is on the right, the outlet is on the left, top is atmosphere, bottom is wall, and front and back are symmetry plane. Historically I have split my inlet patch into 2 separate patches, one for air and one for water. I was hoping that I would be able to use groovyBC to accomplish the same thing with one patch so that I can change the inlet water level without changing my mesh. Anyway, the simulation seems to run ok, and the water surface looks ok (although I haven't compared to physical model data yet), but the pressure at the inlet seems to be funky. You can see in the picture that the p_rgh is 0 at the inlet, and p (not shown) has a significant negative pressure at the inlet.

This seems incorrect to me. Can anyone provide any insight regarding what is happening? Are my boundary conditions (below) specified incorrectly?

p_rgh:
Code:

/*--------------------------------*- 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_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField  uniform 0;

boundaryField
{
    top
    {
        type            totalPressure;
        p0              uniform 0;
        U              U;
        phi            phi;
        rho            rho;
        psi            none;
        gamma          1;
        value          uniform 0;
    }
    bottom
    {
        type            buoyantPressure;
        value          uniform 0;
    }
    inlet
    {
        type            buoyantPressure;
        value          uniform 0;
    }
    outlet
    {
      type            totalPressure;
      p0              uniform 0;
      U              U;
      phi            phi;
      rho            rho;
      psi            none;
      gamma          1;
      value          uniform 0;
    }
    walls
    {
        type            symmetryPlane;
    }
    wes
    {
        type            buoyantPressure;
        value          uniform 0;
    }
}

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

alpha1:
Code:

/*--------------------------------*- 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      alpha1;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 0 0 0 0];

internalField  uniform 0;

boundaryField
{
    top
    {
        type            inletOutlet;
        inletValue      uniform 0;
        value          uniform 0;
    }
    bottom
    {
        type            zeroGradient;
    }
    inlet
    {
      type            groovyBC;
      valueExpression "1";
      fractionExpression "(pos().z<28) ? 1 : 0";
      value            uniform 1;
    }
    outlet
    {
        type            inletOutlet;
        inletValue      uniform 0;
        value          uniform 0;
    }
    walls
    {
        type            symmetryPlane;
    }
    wes
    {
        type            zeroGradient;
    }
}

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

U
Code:

/*--------------------------------*- 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      volVectorField;
    location    "0";
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField  uniform (0 0 0);

boundaryField
{
    top
    {
        type            pressureInletOutletVelocity;
        value          uniform (0 0 0);
    }
    bottom
    {
        type            slip;
    }
    inlet
    {
      type            groovyBC;
      valueExpression "(pos().z<28) ? vector(1.981,0,0) : vector(0,0,0)";
      value          uniform (0 0 0);
    }
    outlet
    {
        type            inletOutlet;
        inletValue      uniform (0 0 0);
        value          uniform (0 0 0);
    }
    walls
    {
        type            symmetryPlane;
    }
    wes
    {
        type            slip;
    }
}


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

Thanks in advance. I look forward to your input.

nimasam June 30, 2012 15:47

have you ever tried it with zeroGradient for inlet pressure?

mgdenno June 30, 2012 16:52

Hi nimasam,

Thanks for your input. Yes, I have tried with zeroGradient for pressure at inlet. it yields very similar results.

The weird thing is that my boundary conditions are the same as another case where I don't see those weird pressure results.

Not sure where to go from here...

MD

And checkMesh says all is good...

gschaider July 1, 2012 04:49

Quote:

Originally Posted by mgdenno (Post 369023)
Hello,

As indicated in the post title, I am trying to use groovyBC to set the inlet boundary condition for a interFoam simulation. I am using OpenFOAM 2.1.0 running on kubuntu 11.10. The attached picture (colored as p_rgh) shows a 2D view of the problem which is flow in a channel over a spillway. The inlet is on the right, the outlet is on the left, top is atmosphere, bottom is wall, and front and back are symmetry plane. Historically I have split my inlet patch into 2 separate patches, one for air and one for water. I was hoping that I would be able to use groovyBC to accomplish the same thing with one patch so that I can change the inlet water level without changing my mesh. Anyway, the simulation seems to run ok, and the water surface looks ok (although I haven't compared to physical model data yet), but the pressure at the inlet seems to be funky. You can see in the picture that the p_rgh is 0 at the inlet, and p (not shown) has a significant negative pressure at the inlet.

<snip>

Thanks in advance. I look forward to your input.

A remark to the graph: Am I right that you used point-values and not cell values for visualizing? DON'T DO THAT if you want to see the "real values". Point values mean that you're looking at how Paraview interpolates/interprets OFs data (use point-values ONLY when you're preparing picture for a presentation)

Last thing: have a look at p and p_rgh directly (with "less" or a text editor) and see what OF has written in "values" (at the end of the day these are the only values that really count). It is my suspicion that there are no values present on the inlet in p_rgh and paraview therefor assumes them to be 0 (as the reader doesn't know about the real physical meaning of the bCs)

mgdenno July 1, 2012 08:16

Bernhard,

Thanks so much for your suggestion. You are absolutely correct. The values I was seeing were only paraviews interpretation of the data. The real cell values are much more believable.

I have to admit, now that you say this, I recall seeing another recent post regarding a different "problem" where you made the same suggestion to another user. At the time I though, "yeah that makes lots of sense", then when it came to my own case I pushed forward with the interpolated values thinking I had a problem (blinders on).

Thanks for all the work you do on OF and the time you spend answering questions on the forums, and of couse thanks again for your help on my problem.

MD


All times are GMT -4. The time now is 20:40.