CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   boundary condition of an internal surface (

ynsudo June 29, 2011 21:16

boundary condition of an internal surface
Dear all,

I would like to calculate mass flow rate of a small surface put in flow. The surface is put just for calculating flow rate so it should not affect the flow.

The solver I use is interFoam. I wonder if I have to define the small surface as a patch and pose boundary condition of gradient zero for pressure, velocity, and volume fraction or there is other better ways. Iíd be glad if you give me advice.
Thank you in advance for your help.


Van de Leur June 30, 2011 09:23

Dear Yu,

Sampling data is explained in paragraph 6.5 of the OF user guide.
You can take samples anywhere in your domain without defining a surface, just create a file called sampleDict.



ynsudo June 30, 2011 21:59

Dear Kevin,

Thank you for your advice. Itís great that if I donít have to specify patch for my purpose since I donít have to think about boundary condition that doesnít affect the flow.

I have a question about the sampleDict.
According to the paragraph 6.5 of the OF user guide, it seems that I could choose keyword "surfaces" in the sampleDict.

The shape of a surface where I want to calculate flow rate is an ellipse so I want to know how to calculate flow rate on surface with any shape. I think it can be specified by the STL file. I am wondering if that is possible in sampleDict. Or if there is any other way to solve my problem and teach me it would be appreciated.

Best regards,

Van de Leur July 4, 2011 03:51

You could create a surface/patch to take samples. This is certainly possible for boundary patches but I'm not sure how it works with patches in the middle of a domain.

Another way is to use the 'cloud' option in the sampleDict and specify the coordinates of the points (on your ellipse) you want to sample.



ynsudo July 4, 2011 05:55

Hello Kevin,
Thank you for your reply. It is very helpful.

About the first way you mentioned Iím not sure but it seems that I have to define boundary patches so I need to think about proper boundary conditions that donít affect flow around the patch.

The second way seems to work. For example, I may need a STL file for the shape such as an ellipse, then get the area and the coordinates of a triangle consisting of the STL, then get velocity for the coordinate by sampleDict with Ďcloudí option, then calculate flow rate by multiplying the velocity by the area for a triangle and summing up them. I may need to make a program to calculate it.


miles_davis September 13, 2011 09:52

hi ynsudo,

I have the same problem: I want to have the flow rate throug a given surface. The surface is already defined in my mesh so it would be a boundary patch or a cyclic patch.
What I do not uynderstand when I look at the SampleDict example in the Userguide is how to find the syntaxe for programming the flow rate through each face of the patch surface and then sum it over all the faces of the surface patch. surface
Any help would be welcomed.


ynsudo September 13, 2011 20:37

Hello Miles

I am trying to use a routine named calcMassFlow to calculate the mass flow rate.
There would be a program for higher versions.
This routine could calculate the mass flow rate for one-phase flow.
If you would like to calculate the mass flow rate for two-phase flow you would need to modify the program.

miles_davis September 14, 2011 04:17

Thanks you
I am gonna check this... as soon as I have found a good programming tuto on openfoam.

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