- **OpenFOAM**
(*https://www.cfd-online.com/Forums/openfoam/*)

- - **volumeIntegrate ?**
(*https://www.cfd-online.com/Forums/openfoam/87143-volumeintegrate.html*)

volumeIntegrate ?Hi Foamers,
any ideas how to code the volumeIntegrate function inside the solver, in order to get the volume integral on a group of cells, let's say for example "a sphere" inside the mesh ? thanks, T.D. |

Hi T.D.
have you had any success on this one? I am facing a pretty similiar question right now. Can post my results once I have achieved something... was just wondering whether you got it already. Cheers, seboxx |

I've written a pre-Processing app that initializes a spherical vof field. I'm thinking you could do something like this:
Code:
` volVectorField positions` |

The OpenFOAM library provides a function to compute integrals over the domain: fvc::domainIntegrate.
To integrate a scalar solution variable (volScalarField) p over the domain and write the answer to the standard output, add the following line to the solver source code. Code:
`Info<< nl << "Integral of p: " ` |

Hi there,
thank you for the comments. I know that domainIntegrate works, but what if my problem is a little more complex. Like, I wanna calculate an Integral of the Heaviside function over the domain. I thought I can do a simple if(mag(u)>0) then add the volume of the cell that I am currently in. But I am not quite sure how to get that to work. My volScalarField is named u, and so far I can't access the magnitude of u, I simply don't know how to address it... Then my idea was to do a for-loop over the whole domain, with the if condition check whether u is above a certain threshold, and when that is the case just add the volume over all those cells where the threshold condition is fulfilled. How to I get the volume of that cell I am working with? Any comment is greatly appreciated. seboxx |

Oh it's actually not complex at all, after the hint of flowman at least ;)
All I did is something like: Code:
`Info<< nl << "Integral of p: " ` seboxx |

All times are GMT -4. The time now is 10:49. |