CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Full force and moment coefficient output (

Newfoamy March 13, 2010 03:03

Full force and moment coefficient output
I'm trying to output full force and moment coefficients components from a simulation, i.e. from pressure contribution along x and viscous term contribution along x, pressure and viscous along y, etc and the pressure and viscous moments about x, y and so on.

I've been pointed toward using the "functionObjects/forces/forces" function but the results I get are not what I expected. I know what the answer should be. Has anybody used the forces function with any success ?

As an check of the forces function output I've even tried post processing the output externally with my own code. I have files named

"points! with 24716 values of x,y,z coordinates,

"faces" with 48480 values which start 4 7835 7832 18451 18448, etc.

and I've created a code to read these and plot them in Tecplot and I can see my mesh.

I also have a file "boundary" which tells me that the wedge1 has a start face of 23765 with 12046 values, wedge 2 starts at 35811 with 12046 values, Wall which starts at 48011 and has 154 values.

I can plot the Wall faces and can see the surface.

I also have field values of pressure with 12046 values but how do I relate these to the Wall faces as they appear to be related to the wedge1 and wedge 2 faces?

Is the key in the "neighbour" file which also has 48480 values but which starts 6 12 21 25 17 494 508, each number being on a new line.

Or is it in "owner" which starts 48480 and then 0 0 0 0 1 1 1 1 2 2 2 2, each number on a new line.

Anybody got any ideas either on the "forces" function or my trying to post process problem. Any help most welcome.

philippose March 13, 2010 06:17

Hello Steve,

A Good Morning to you!

I use the forces function object in OpenFOAM quite often, and I have had no issues with it.... the values that I get are correct, realistic, and usable.

The question is... when you say that you are not "seeing what you are expecting", what are you expecting, and what are you getting, and what is it in the result that differs from your expectations?

Would it be possible to have some more details.... preferably quantitative?

Have a nice day!


Newfoamy March 14, 2010 02:10

Philippose, Thanks for responding.

It is the viscous terms which appear to be a couple of orders of magnitude too low. I know what the answer should be from a computation from another tried and trusted code that I have and this other code has been validated.

Can you explain the cell numbering issue that I also posed ? What are the "owner" and "neighbour" files data telling me. How do I interpret their contents ?

koWUalsky March 16, 2010 04:13

I am still new in OpenFoam, but I read the mesh part of User Guide (the official pdf file). As I know, in page of U-125, it shows what the owner or neighbour is. Based on my understanding, one cell has six faces. And, three of these six faces are owned by this specific cell.

Then, the other thee faces are owned by neighbours. It means each face of these three faces is owned by different cells individually.

In the "owner" and "neighbour" file, these number are cell indexes following the order of faces index. In these two files, there are three same cell indexes. It points out that these three faces belong to one cell. For example, in "owner" file,
1st, 2nd, 3rd face belongs to cell 0, 4~6th face belongs to cell 1...and so on. Or, cell 0 owns 1st, 2nd, 3rd face....The number 872324 is equal to the amount of faces as shown in the "face" file.

In "neighbour" file, the three same cell indexes could be found separately in different places, because each faces belongs to different cells. And one cell has three different neighbour. See:
Face 1 belongs to cell 1, face 2 belongs to cell 106, face 3 belongs to cell 5724. Then, there are other two faces belongs to cell 106. The number 872324 is also equal to the amount of faces. Then, if you see "-1", that means it is boundary. The cell on boundary owns only three faces. Or you can say, the face on bounadry has its owner but has no neighbor.

As your reference, it is quite complicated and confusing. I hope what I know is right and helpful.

best regards,
Ping-Chen Wu

Newfoamy March 16, 2010 13:10

Many thanks. Your explanation of the "owners" and "neighbours" has significantly helped me. I think I now understand what the two files are trying to tell me and how I can use the information.

philippose March 16, 2010 14:13

Hello again Steve,

A Good Evening to you!

Ahh... so you are interested in the Viscous forces, and not the forces due to the pressure distribution on a patch..... So far, I have been able to reliably use the pressure forces, but since the applications I work with are primarily dominated by the pressure forces, I cannot say too much about the accuracy of the viscous forces calculated by OpenFOAM.

I also noticed that you are interested in the OpenFOAM mesh format.... I think on of the most complete descriptions of the OpenFOAM mesh format can be found here:

Hope this helps...!



koWUalsky March 17, 2010 04:19

You are welcome. I also thank this forum very much. I learn a lot here.

My topic is ship flow. Now, I am working on that forces function. But as I know, see:
It works, but seems to get many problems. Until now, my result is similar to that the thread talked about. Like your situation, "the results I get are not what I expected." It doesn't have a good agreement with experiment data. The wave seems good, but the force is strange.

So, we want to use the CFD analysis in Tecplot. I knew the FoamToTecplot, but we don't have tecplot in Linux. So, we may try to make a program to transfer the format. This is why I need to understand the mesh format. Then, I can use Tecplot in Windows.

Or, I learn the programming to modify the source code. Anyway, either way will be a tough work for me. I gotta learn a lot of foam things.

Good luck,

Ping-Chen Wu

All times are GMT -4. The time now is 23:24.