CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] groovy boundary condition for pressure (https://www.cfd-online.com/Forums/openfoam-community-contributions/124842-groovy-boundary-condition-pressure.html)

Ahmed Khattab October 14, 2013 11:51

groovy boundary condition for pressure
 
Hi,

i'm using groovy boundary condition to express velocity as a relation of pressure difference of pressure of two regions. the problem is that velocity is vector field while pressure is scalar so, there is a problem to express vector value as a relation of scalar value. i think that if i use gradp instead of p it will be helpful but openfoam can't understand gradp since it is not stored in file.

any one can help me figuring out a solution for this problem.:)

gschaider October 14, 2013 17:29

Quote:

Originally Posted by rebel ahmed (Post 456877)
Hi,

i'm using groovy boundary condition to express velocity as a relation of pressure difference of pressure of two regions. the problem is that velocity is vector field while pressure is scalar so, there is a problem to express vector value as a relation of scalar value. i think that if i use gradp instead of p it will be helpful but openfoam can't understand gradp since it is not stored in file.

any one can help me figuring out a solution for this problem.:)

If you look at http://openfoamwiki.net/index.php/Co...her_field_are: then you'll find that snGrad(p) gives you the gradient of p in the normal()-direction

Ahmed Khattab October 15, 2013 02:26

Dear gschaider,

thanks for your reply, i tried this Boundary condition for velocity
Code:

              type            groovyBC;
             
              valueExpression "(pUpperFlow-pMiddleFlow)/(mu)";
              variables "pUpperFlow{patch'upperFlow_to_upperFilter}=snGrad(p);pMiddleFlow{patch'middleFlow_to_upperFilter/middleFlow}=snGrad(p);";
              value uniform (0 0 0);

and this is the error message:
Code:

[2] --> FOAM FATAL ERROR: [3]
[3]
[3] --> FOAM FATAL ERROR:
[3] The expected return type vector is different from the stored result type "scalar"

--> FOAM FATAL ERROR:
[1] The expected return type vector is different from the stored result type "scalar"

[1]
[1]
[1]    From function tmp<Field<Type> > ExpressionResult::getResult()
[1]
[2] The expected return type vector is different from the stored result type "scalar"


gschaider October 15, 2013 05:30

Quote:

Originally Posted by rebel ahmed (Post 456970)
Dear gschaider,

thanks for your reply, i tried this Boundary condition for velocity
Code:

              type            groovyBC;
             
              valueExpression "(pUpperFlow-pMiddleFlow)/(mu)";
              variables "pUpperFlow{patch'upperFlow_to_upperFilter}=snGrad(p);pMiddleFlow{patch'middleFlow_to_upperFilter/middleFlow}=snGrad(p);";
              value uniform (0 0 0);

and this is the error message:
Code:

[2] --> FOAM FATAL ERROR: [3]
[3]
[3] --> FOAM FATAL ERROR:
[3] The expected return type vector is different from the stored result type "scalar"

--> FOAM FATAL ERROR:
[1] The expected return type vector is different from the stored result type "scalar"

[1]
[1]
[1]    From function tmp<Field<Type> > ExpressionResult::getResult()
[1]
[2] The expected return type vector is different from the stored result type "scalar"


As I said below: snGrad is the gradient IN THE DIRECTION NORMAL TO THE BOUNDARY. So it is a scalar. To get the actual vector multiply it with normal()

STutexas November 14, 2015 20:18

Hi
I am a new Openfoam user and I have a question about the snGrad operator. In the post you describe the use of operator on a scalar field. But if the operator is applied to a vector field would it give a tensor?


All times are GMT -4. The time now is 02:56.