where to find the labels of the hex ?
when I look at the output file of u or p, it is a long list of numbers.
I know each number corresponds to one hex, but I am wondering what hex the number corresponds to. Where can I find the hex labels, just like the point labels, so I will know which number goes to which hex which is hex number __ and is composed by point__, __, __, ...
It's not easy. I'd suggest you use a post-processing program, or the built-in sample utility.
If you don't have mesh motion, your mesh details will be in: /case/constant/polyMesh/
If you do have mesh motion, you also have to refer to your time directories.
1. The geometry starts with points. The points are clear to understand... but they aren't explicitly numbered.
2. Number them, starting at zero from the top.
3. Next comes faces. These are groups of points that form a face. The numbers in the groups correspond to the numbers you gave the points list (in step 2). Again, the faces aren't explicitly numbered... but you don't need to number them.
4. Next come the cells. This is what you are looking for... each cell corresponds with the numbers in your velocity or pressure output files. Finally, after all that work! ... there is no cells file ... but there are two other files: neighbours and owners. The numbers in these files are the cell numbers. These files have a one to one correspondence with the faces file. Using these three files in concert, you can figure out which faces are "owned" by which cells, and which are "neighbours". Outside faces don't have neighbours, so the owners file is longer.
There's probably a way to output the cell centres, in a list, corresponding to the cell numbers.
Notice that the "I" counter maps directly from fvMesh::cells to the vol*Field, because each F value is related to a single cell centre. So, the position of the value in your field F is actually the label of the cell in the field cells. Its indirect, and gets clear if you write some loops over the lists yourself, output that and anaylse. Check out Foam:: PrimitiveMesh class for connectivity information.
Hope this helps,
Thanks to marupio and Tomislav.
I would match the numbers in the "face" file and that in the "owner" file to get the points of the cell. Then I would use the "points" file to find the coordinates. If I would like to find the center of the cell, I find the avg of the points :)
Also I can write a code according to Tomislav's suggestion.
Check out the Doxygen C++ documentation and search there for the stuff you need.
If you need local cell computation (like I do), then use Foam::cell::centre (be aware that the local cell computation of the volume magnitude and centre are approximative and don't check for non-planar faces). If you want the cell magnitude or centre for every cell of the mesh, use fvMesh::C() method.
Search for the methods in the src directory, or go here and search:
|All times are GMT -4. The time now is 21:50.|