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

[swak4Foam] Trouble setting groovyBC interFoam Inlet BC

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 30, 2012, 15:37
Default Trouble setting groovyBC interFoam Inlet BC
  #1
Senior Member
 
Matthew Denno
Join Date: Feb 2010
Posts: 138
Rep Power: 16
mgdenno is on a distinguished road
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.
Attached Images
File Type: jpg overview.jpg (37.1 KB, 126 views)
mgdenno is offline   Reply With Quote

Old   June 30, 2012, 16:47
Default
  #2
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
have you ever tried it with zeroGradient for inlet pressure?
nimasam is offline   Reply With Quote

Old   June 30, 2012, 17:52
Default
  #3
Senior Member
 
Matthew Denno
Join Date: Feb 2010
Posts: 138
Rep Power: 16
mgdenno is on a distinguished road
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...

Last edited by mgdenno; June 30, 2012 at 17:53. Reason: checkMesh comment
mgdenno is offline   Reply With Quote

Old   July 1, 2012, 05:49
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by mgdenno View Post
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 likes this.
gschaider is offline   Reply With Quote

Old   July 1, 2012, 09:16
Default
  #5
Senior Member
 
Matthew Denno
Join Date: Feb 2010
Posts: 138
Rep Power: 16
mgdenno is on a distinguished road
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
mgdenno 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
interFoam vs. simpleFoam channel flow comparison DanM OpenFOAM Running, Solving & CFD 12 January 31, 2020 16:26
interFoam (HELYX-OS) pressure boundary conditions SFr OpenFOAM Running, Solving & CFD 8 June 23, 2016 17:36
problem with inlet BC setting Tanjina Fluent Multiphase 4 July 1, 2013 14:06
[swak4Foam] Scale discrete inlet velocity profile with groovyBC cboss OpenFOAM Community Contributions 1 June 20, 2010 14:02
Warning 097- AB Siemens 6 November 15, 2004 05:41


All times are GMT -4. The time now is 16:13.