CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   BC development: how can I access to the patch normal? (https://www.cfd-online.com/Forums/openfoam-programming-development/123370-bc-development-how-can-i-access-patch-normal.html)

Sylv September 11, 2013 05:59

BC development: how can I access to the patch normal?
 
Dear Foamer,

I'm currently developing a boundary condition to force a given pressure gradient.

For a gradient boundary condition, OpenFOAM needs the normal gradient, for example, a fixed pressure gradient looks like this (in the p file):
Code:

outlet
    {
        type            fixedValue;
        value          uniform 1;
      //value        uniform (1 0 0); <== this is wrong!
    }

In my new bc, I'm working with the pressure gradient, which is a vector. but at the very end of all my calculations, I need to do the dot product between the pressure gradient and the patch normal, which should lead to something like this:
Code:

Field<scalar>& gradient = this->gradient();
gradient = myGradP*patchNormal  //how to get "patchNormal"?

In this example, "myGradP" is a vectorField with the same size as "gradient".

The problem, I don't now how to access to the patch normal. Any Idea?

Cheers,
Marcel

Phicau September 11, 2013 06:09

Hi, this is what you need:

Code:

    vectorField nVecCell = patch().nf();
Best,

Pablo


All times are GMT -4. The time now is 04:01.