CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Finding Coordinates of individual cell in U.internalField() (

brosemu November 5, 2009 15:29

Finding Coordinates of individual cell in U.internalField()

I'm working on a procedure that requires looping through every cell in the U.internalField() and performing some operations. At each cell center I need to find the (x,y,z) location which I initially thought was going to be a trivial task (and it still may be), but I'm pretty stuck right now. As far as I can tell, all of the spatial information is contained in mesh.C(), my problem is how do I index correctly into mesh.C() so that I get the correct (x,y,z) for the current cell in U.internalField()?

I'm using a loop like the one below, and when I use "i" to index into U.internalField() and mesh.C() I don't think that I'm getting what I want. Does the i-th entry of U.internalField() correlate directly to the i-th entry of mesh.C()?




brosemu November 5, 2009 17:34

Please disregard my previous post.

It turns out that the i-th cell in U.internalField() does directly correspond to the i-th value in mesh.C().

All times are GMT -4. The time now is 06:43.