CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Problem with fvc::domainIntegrate (

seboxx January 9, 2012 12:06

Problem with fvc::domainIntegrate
2 Attachment(s)
Dear Foamers,

I have encountered a problem with the domainIntegrate function.
I actually don't understand why OpenFOAM gets this result and would be happy about suggestions.
Ok, here is the Problem:
I have created 2 geometries with blockMesh. One is a simple square as a reference and the other one is the same square with a hole cut out and a bump merged into it. (see attached files)

Clearly the domain with the bump should have a larger volume, but the result due to domainIntegrate is exactly the same.
I am using domainIntegrate that way:


Info<< "wavesize= " << scale_spaceunit*fvc::domainIntegrate(pos(u-(1e-12))) << endl;
In this case I have given the function u = 1 a constant value.
The result is for both geometries

wavesize= (scale_spaceunit*domainIntegrate(pos((u-1e-12)))) [0 0 0 0 0 0 0] 1600
What went wrong here?

Am I misunderstanding the purpose of domainIntegrate? Is volumeIntegrate working better for my purpose? Are there any other functions?

Oh btw. I am using OpenFOAM 2.0.0

I appreciate your time


mturcios777 January 9, 2012 13:40


. Without knowing what is inside your blockMesh files, its possible that the number of cells in your domain might be the same? You could also try


seboxx January 9, 2012 13:55

Thank you for the hint.
I am not sure what exactly



does, but I assume V is a vector field defined on my mesh right? In my case this would be u, but the point is I want to sum up only the cells where u>0 including the cells volume, thats why I use

I dont see how to incorporate that... Can you point me in a direction?

Also, if both meshes have the same number of cells, the volumes should still be different since I am looking for Volume and not number of cells...

What I am looking for is something like this pseude code:

If u>0:
calculate volume of cell

sum(volumes of all cells where u>0)

greets, seb

mturcios777 January 9, 2012 13:59


is the field that has all the cell volumes. By summing them you obtain the total volume.

seboxx January 14, 2012 07:21

Thanks for the hints,

I have realised the problem is actually not in the integration or the volume as such, but seems to be a more general problem. I guess I will just open a new thread, as the topic doesn't really fit anymore...

All times are GMT -4. The time now is 00:03.