CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   porousInterFoam with a permeable wall: which BC should be used? (https://www.cfd-online.com/Forums/openfoam-solving/157077-porousinterfoam-permeable-wall-bc-should-used.html)

Majed July 18, 2015 14:29

porousInterFoam with a permeable wall: which BC should be used?
 
1 Attachment(s)
Dear Foamers.

I am a new OpenFOAM user. I am using porousInterFoam solver for doing a simulation in a porous medium. I have already run my model, and comparing the results of the vertical velocity profiles with the experimental data showed that there is something wrong with my model. I have realized that the problem is with NOT defining a boundary condition for the permeable wall. I do not know what boundary conditions I should define for the wall so that the flow pass through it.

I am attaching a photo of my model.

Any help is greatly appreciated.

wyldckat July 19, 2015 14:34

Greetings Majed,

I got the PM you sent me, so I'm answering it here. In addition, I've moved your question to a new thread, since the other two weren't exactly on the same topic (from what I understood, they were looking at "permeable wall" from other perspectives).

I don't fully understand your question, so I have to ask: Do you mean that you have a porous region near this wall and that you need the wall to also be porous?
In addition, the fluid that goes out of this wall, is meant to come back in from the other wall?

Best regards,
Bruno

Majed July 19, 2015 14:45

Hello Bruno,

Thank you so much for your reply.

The region that you see below the curved line, which is the boundary wall between the surface water in the channel and porous zone, is my porous medium. When the surface water reaches the zone it is pushed into the porous medium follows a path and again comes back to the surface.

Actually every thing in my model works properly. The shape of the streamlines in the porous medium corresponds very well with experiment. The only problem is with the region where the height of the porous medium is decreasing (after x=7.2 m, in the photo). In reality in that region the flow is a mixture of surface flow which is running in the channel and the flow which is coming out of the porous medium. But since no wall function has been defined for that wall, the model can not simulate the flow in that region properly, and we only see the streamlines which are coming out of the porous medium, which is wrong. I must find a way to define boundary conditions for a wall that water passes through it. If OpenFOAM had this feature that we could define a patch as permeableWall instead of wall, my problem could be solved easily.

With thanks,

wyldckat July 19, 2015 15:23

Sorry, but I don't have time to go into details, but in essence what you need is:
  1. Use a baffle creation strategy, as exemplified in the tutorial "incompressible/pimpleFoam/TJunctionFan".
  2. Then use a porous baffle, as exemplified in the tutorial "multiphase/interFoam/ras/damBreakPorousBaffle".
  3. More examples can be found with the following commands:
    Code:

    find $FOAM_TUTORIALS -name U -type f | xargs grep poro
    find $FOAM_TUTORIALS -type f | xargs grep baffle


Majed July 20, 2015 17:08

Hello Bruno,

It didn't work. I think a new code must be written for it. I don't know how, though!!

Majed August 13, 2015 08:45

Hello Bruno,

I have been working on my model, and made some progress. I changed the internal face, which is the boundary between the porous medium and fluid, to a boundary face named as porousWall-1 and PorousWall-2. PorousWall-1 is the face which is in fluid, and porousWall-2 is the face which is in porous medium. Then I tried to define appropriate boundary conditions on them to couple the solution between two regions. I defined these boundary conditions for p-rgh and U. The model runs, but the problem is that the two regions are not connected, so that when I change the porosity in the porous medium, the velocity field in the fluid zone does not change! :( Could you help me to solve this problem.

P.S.: for k, omega and nut, I have defined zeroGradaient on porousWall-1 and porousWall-2.

porousWall-3 represents 3 other faces that are in the porous medium zone.

Thank you in advance.

Best regards,

Hessam

Code:

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

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

internalField  uniform (0 0 0);

boundaryField
{
    waterSurface
    {
    type        symmetryPlane;
    }
    walls
    {
          type            fixedValue;
        value          uniform (0 0 0);
    }
    bed
    {
          type            fixedValue;
        value          uniform (0 0 0);
    }
  inlet
    {
      type            flowRateInletVelocity;
      volumetricFlowRate constant 0.024;
    }
    outlet
    {
        type            inletOutlet;
        inletValue      uniform (0 0 0);
        value          $internalField;
    }
    porousWall-1
    {
    type            groovyBC;
        valueExpression "Uinlet";
        variables      "Uinlet{porousWall-2}=U;";
        value          uniform (0 0 0);

    }
    porousWall-2
    {
    type            groovyBC;
        valueExpression "Uoutlet";
        variables      "Uoutlet{porousWall-1}=U;";
        value          uniform (0 0 0);
    }
    porousWall-3
    {
        type            slip;
        value          uniform (0 0 0);

    }

}

Code:

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

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

internalField  uniform 0;

boundaryField
{
    waterSurface
    {
     
    type            symmetryPlane;
    }

  inlet
    {
      type            zeroGradient;
    }
  outlet
    {
      type            fixedValue;
      value          uniform 0;
  }
    walls
    {
        type            zeroGradient;
    }
    bed
    {
      type            zeroGradient;
    }
  porousWall-1
    {
      type            zeroGradient;
    //type            groovyBC;
        //valueExpression "poutlet";
        //variables      "poutlet{porousWall-2}=p;";
        //value          uniform 0;
    }

    porousWall-2
    {
        type                mapped;
        value              uniform 0;
        interpolationScheme cell;
        setAverage          true;
        average            0.1;
    }
    porousWall-3
    {
        type            zeroGradient;
    }

}


Majed August 13, 2015 16:34

Hi again,

My test case can be found in the following link:

https://drive.google.com/open?id=0B_...HkzSXNIOXVjbDQ

It should be mentioned that to save time, I changed from porousInterFoam to porousSimpleFoam.

Thank you for your help.

Best regards,

Hessam

wyldckat August 15, 2015 07:12

Hi Hessam,

I'm trying to look into this right now. There is something I need to know: the image you provided in the first post is the profile that you're trying to achieve or is the result you first got from OpenFOAM?

In addition, I'm quoting part of what you sent me via PM, since it's relevant to this discussion:
Quote:

Originally Posted by Majed
I defined the "patch type" for porousWall-1 and porousWall-2 as "cyclic" and therefore the BCs for all parameters were changed to "cyclic". By running this model, the results were similar to the case in which no BCs were defined for that internal wall, which is the boundary between the porous medium and fluid regions.

I believe what is wrong in the model that I have already uploaded in the forum, is the pressure BC on porousWall-1 and porousWall-2. I think by defining mapped BC the equations between two regions are not coupled and only the pressure values are mapped from porousWall-1 to porousWall-2. If we can find a way to define an appropriate BC for pressure, I think my problem is solved. I don't understand why by defining the BC like this:

porousWall-1
{
type groovyBC;
valueExpression "pInlet";
variables "pInlet{porousWall-2}=p;";
value uniform 0;
}

porousWall-2
{
type groovyBC;
valueExpression "pOutlet";
variables "pOutlet{porousWall-1}=p;";
value uniform 0;

the solution does not converge, while such BC works for velocity!? :(

Best regards,
Bruno

Majed August 15, 2015 07:23

Hello Bruno,

That photo is the result of my first simulation.

With thanks,

Hessam

wyldckat August 15, 2015 09:41

Hi Hessam,

OK, I took a step back further than where you're at and I went to try and study a bit the topic of permeable wall. I found this article on this topic: http://www.aem.umn.edu/people/facult...docs0/67_1.pdf - "Boundary conditions at a naturally permeable wall" by Gordon S. Beavers and Daniel D. Joseph.

According to that document, it seems like you will first need to figure out what are the actual boundary conditions you need to define analytically, before even trying to implement them in OpenFOAM, either with existing boundary conditions or by creating new code.

I say this because I'm having a really hard time to deduce what the boundary condition on a permeable wall should actually be. It sees that one analogy is to think of a permeable wall as a wall that has a lot of small holes in it; in such a scenario, it would mean that the boundary behaves mostly as a wall and that X% of the flow can be lost or gained perpendicularly to the wall. Based on the article, the X% seems to be based on the porous medium properties and the pressure difference, as well as a proportion parameter that is based on experimental data.

I'm only able to deduce that a boundary condition based on "mixedFvPatchField" will be needed: https://github.com/OpenFOAM/OpenFOAM...tchField.H#L31
Quote:

This boundary condition provides a base class for 'mixed' type boundary conditions, i.e. conditions that mix fixed value and patch-normal gradient conditions.
where the fixed value is actually the slip vector for the velocity and the patch normal gradient is derived from the relation between pressure drop and porosity.

My guess is that the pressure boundary should be type "cyclic", so that it allows the continuity defined by the porous medium. As for the turbulence fields, I don't know... zero gradient doesn't sound correct and "cyclic" seems the most realistic, because the fluid is mixed between regions.

As for the boundary conditions you defined on the case you shared, the one for the velocity doesn't seem to make much sense, precisely due to what you're getting: there is little or no flow exchange between the two sides, due to the zero gradient boundary.

All of this to say: if you are able to define analytically or conceptually what is the formulation for the permeable wall boundary condition, I or anyone else might be able to assist you in putting it into practice.

You might also want to take a look at the Code Documentation: http://www.openfoam.org/docs/cpp/
  • At the bottom, click on the link "Boundary Conditions".
    • On that page you will find the lists for each boundary condition that already exists in OpenFOAM. Check if you can find one or more boundary conditions that seem to at least in part what you need.
Best regards,
Bruno

Majed August 15, 2015 12:49

Hello Bruno,

Thank you for putting your time on finding the paper and your complete reply. I had already read that paper. I thought that implementing the method which has been defined in that paper in OpenFOAM would need programming that I am not familiar with it. Therefore, I forgot about it, and tried to implement another method method. I have two regions. One is fluid and the other is porous medium, and I have a solver which the required equations have been defined in it. The only trouble is the wall between two regions. I need to define BCs on this wall in a way that two regions would be coupled (something like multi region in OpenFOAM).

The simplest way was to define cyclic BCs. But the results were the same as the case in which no boundary wall defined between two regions (the figure in my first post). So this showed that, the turbulence parameters shouldn't be defined as cyclic. The next thing that I want try is to try cyclic BCs only for pressure and velocity. But the problem is how to do that!? Regardless, of the type of wall, what BCs should be defined to couple the velocity and pressure between the two regions? I believe the maapedBC is not good for pressure. Could you tell me what is the other BC that I can use to make a cyclic BC for pressure!?

P.S.: By using the BCs in the case that I have attached, I got much more better results regarding the veolicy values , specifically, in the region which is after crest of the berm (X= 7.2m - 7.9m, in that figure). To get this result I tried many BCs. For example, defining nutWallFunction, KqWallFunction and omegaWallFunction on the wall, did not work. Also, I tried mappedBC for velocity, but the velocity vectors showed that there is no exchange between two regions (That's why I believe mappedBC is not appropriate for coupling pressure), whilst by using goovyBC, this problem was resolved and the velocity vectors could exit from the porous media and join fluid zone.

wyldckat August 15, 2015 13:57

The closest mapped type of BC that I could find for your description on the code documentation was "mappedFixedPushedInternalValue".

I've got a feeling that using the "-" character for the patch names is a risk, because this could trigger a bug associated to name parsing. It's preferable to use an underscore, e.g. "porousWall_2".

I'm currently running the case you shared with OpenFOAM 2.2.2, because 2.3.0 wouldn't work with it. After looking at the results, I might be able to diagnose something about the pressure field.

wyldckat August 16, 2015 13:28

Hi Hessam,

Any chance you could post a slightly modified version of your case? The modification is to split the permeable wall into two parts:
  1. The part for x<7.2, with two patches, one for each side of the wall.
  2. The part for x>7.2, also with two patches, one for each side of the wall.
In other words, split "porousWall-1" in half and the same for "porousWall-2".

Because the problem I'm seeing is that without additional coding and by relying only on groovyBC, right now all I can figure out is that we can only allow these baffles to work in one direction, i.e. the flow can only go from top to bottom or bottom to top, it's not possible to make it go both ways.

On the plus side, it will then be possible to restrain how much passes through the wall.

Best regards,
Bruno

Majed August 16, 2015 14:11

Reply
 
Hello Bruno,

Thank you for putting your time on the model. I should explain that I did more simulations, and realized that using groovyBC, in a way that has been defined in my model, has nothing to do with getting better results in the surface water velocity, i.e. the two regions are not coupled. However, I used it because of the information in the link below:

https://openfoamwiki.net/index.php/C...ing_of_patches

I believe I need a BC that switches between cyclic and wall, because when cyclic BC is defined the two regions get connected, and by defining wall, the results in surface water velocity get better, but two regions get disconnected. :(

I did not understand this part of your post. We do not expect that flow goes in both ways. It should go either from top to bottom (Before x=7.2 m) or from bottom to top (After x=7.2 m)!
Quote:

Originally Posted by wyldckat (Post 559750)
the flow can only go from top to bottom or bottom to top, it's not possible to make it go both ways.

Best regards,

Hessam

wyldckat August 16, 2015 14:43

Quote:

Originally Posted by Majed (Post 559757)
I did not understand this part of your post. We do not expect that flow goes in both ways. It should go either from top to bottom (Before x=7.2 m) or from bottom to top (After x=7.2 m)!

Yes, that's exactly why I asked for the separate baffles/patches, one pair for x<7.2 and another for x>7.2.

Currently you have a single baffle, which is composed by two patches, one for each side of the baffle/wall. But the problem is that by only having this single pair, it means that we're not able to easily control a multi-directional flow in separate positions of X.
What I'm able at most to do is to create a cavity-like flow in the porous regions, because the two regions flow separately.

The example you mentioned, the "Simple 2-Way coupling of patches", works exactly because the flow is "teleported" between two patches, in a single direction. In addition, it does this by using an averaged calculation of the flow and pressure values to go between the two patches.

Majed August 17, 2015 00:23

Hello Bruno,

I changed the geometry in a way that you told. You can find it in the link below:

https://drive.google.com/open?id=0B_...Hk4SHVHZ3UxUEE

Best regards,

Hessam

wyldckat August 17, 2015 09:18

2 Attachment(s)
Hi Hessam,

I think I got it. Attached is an image that shows what I got and the "0.tar.gz" is the "0" folder.

The main changes:
"0/p":
Code:

    firstHalfporousWall_1
    {
        type            cyclic;
    }
    secondHalfporousWall_1
    {
        type            groovyBC;
        valueExpression "(pOutlet+p)*0.5";
        variables      "pOutlet{secondHalfporousWall_2}=p;";
        value          uniform 0;
    }
    firstHalfporousWall_2
    {
        type            cyclic;
    }
    secondHalfporousWall_2
    {
        type            groovyBC;
        valueExpression "(pInlet+p)*0.5";
        variables      "pInlet{secondHalfporousWall_1}=p;";
        value          uniform 0;
    }

"0/U":
Code:

    firstHalfporousWall_1
    {
    type            cyclic;

    }
    secondHalfporousWall_1
    {
        type            groovyBC;
        valueExpression "(UOutlet+U)*0.5";
        variables      "UOutlet{secondHalfporousWall_2}=U;";
        value          uniform (0 0 0);

    }
    firstHalfporousWall_2
    {
      type            cyclic;
    }
    secondHalfporousWall_2
    {
        type            groovyBC;
        valueExpression "(UInlet+U)*0.5";
        variables      "UInlet{secondHalfporousWall_1}=U;";
        value          uniform (0 0 0);
    }

The note here is that the fields are added from both sides and averaged out. Technically you should adjust the weights either manually or based on the porous medium, I don't know for certain, so you will have to test.
For example, you might want to try:
Code:

valueExpression "UOutlet*0.4+U*0.6";

valueExpression "UInlet*0.6+U*0.4";

for giving a higher weight to the flow speed on the top side.

The other fields for turbulence are all set to "zeroGradient", but you might also want to play with groovyBC for creating a mixing layer of sorts...

I ended up not using "mapped" at all.

Best regards,
Bruno

Majed August 17, 2015 09:47

Reply
 
1 Attachment(s)
Hello Bruno,

At first I really appreciate your help. But The shape of the streamlines which corresponds very well with the experiments must be similar to the attached picture. In your opinion I can get such results by changing the weights?

Best regards,

Hessam

Majed August 17, 2015 10:18

Another idea can be dividing the porous medium into 10-20 parts, defining alternately, one part as cyclic and the other as wall. But making such a geometry would be very difficult! :(

wyldckat August 17, 2015 10:37

1 Attachment(s)
But... in the latest case you shared, you already achieved something similar... attached is the image for the time step "300.0" (iteration 3000). The results aren't converged yet and I doubt it will converge.

But that plot you showed only now, there is also flow coming back in on the right most side... i.e., there is flow coming back in near the end of the porous region...

I'm running a few more tests...


All times are GMT -4. The time now is 09:12.