CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Mathematical expression for buoyantPressure boundary condition (http://www.cfd-online.com/Forums/openfoam-solving/114815-mathematical-expression-buoyantpressure-boundary-condition.html)

 amwitt March 18, 2013 10:25

Mathematical expression for buoyantPressure boundary condition

Hello all,

Based on the release notes, "the buoyantPressure boundary condition is applied to the pressure field, which calculates the normal gradient from the local density gradient." I am not fluent in C++ and I'm having some difficulty determining the mathematical expression associated with this condition. The source code computes the gradient as:

I think the equivalent mathematical expression for this is

where n is the normal vector, p is pressure, rho is density, g is gravity and h is cell length. Would anyone be able to confirm or deny this? Thanks.

 amwitt March 18, 2013 12:42

Many thanks to a colleague who just gave me a detailed explanation:

gradient() on the left hand side is clearly the returned gradient of the pressure normal to the boundary, as you indicated.

rho is the density, as you indicated. The syntax rho.snGrad() is calling the function snGrad on the density field. The function snGrad returns the gradient of the scalar, rho, that is normal to the boundary surface. (i.e. snGrad stands for "surface normal gradient").

g is the gravity, as you indicated. I believe that the function value() is simply returning the value of g as a vector pointing in the direction of the acceleration of gravity.

patch() is a little more tricky. I think that this is an object that contains the mesh on the boundary (ie the cell locations, face locations, probably some other stuff). The function Cf() returns a surfaceVectorField with the face centers. I am pretty sure that this simply means it is the location of the center of each face in Cartesian (or polar) coordinates.

Finally, the symbol "&" stands for the dot product in OpenFOAM. So the term (g.value() & patch().Cf()) is taking the dot product of the acceleration of gravity vector and the face centers vector, returning a scalar. This scalar is multiplied by the surface normal gradient of the density, which can either be thought of as a vector, that happens to be normal to the boundary, or as a scalar, that gives the gradient when multiplied by the normal unit vector. This entire expression then gives the pressure gradient, where it again can be thought of as a vector that happens to be normal to the boundary or as a scalar that gives gradient when multiplied by the normal unit vector. I'm not sure whether OpenFoam is using a scalar or vector to describe it in the code.

Also, I don't normally find the doxygen documentation to be very helpful, but in this case it is: http://foam.sourceforge.net/docs/cpp...0.html#details . It doesn't really explain the source code, but it writes out the boundary condition in "math language".

 david89 May 24, 2013 04:31

thanks for your explanation, itīs really helpful. But I still donīt understand how to specify this BC type. Considering the example from doxygen documentation:
myPatch { type buoyantPressure; rho rho; value uniform 0; }What does the specified value refer to in this example? Does anybody know the answer?

Davide

 giack June 25, 2013 11:08

Hi,
thanks for your explanations,it's very helpful. I have a question: the pressure to which refers the formula is static pressure or p_rgh? In doxygen documentation it write p and seems is the static pressure but the formula is:

p_rgh= p -rgh

so I think that if doxygen refers to a static pressure there is a sign error...
Probably is only an unfortunatly notation and p refers to ones of the pressure elencated (p_rgh,pd or ph_rgh)

Thanks

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