CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   (x,y,z) of cell center (http://www.cfd-online.com/Forums/openfoam/96455-x-y-z-cell-center.html)

 newOFuser January 23, 2012 15:11

(x,y,z) of cell center

Hello,

Does anyone know how we can get (x,y,z) of cell centers in the mesh?

I want to access cells whose center's x coordinate lies 10mm either side of xo = 0.05

Thank you,
amit

 newOFuser January 23, 2012 17:22

i think i got it
mesh.C[celli].component(0) should work... (for x location)

 ngj January 23, 2012 17:40

Yes that is true, however, if this limit is static throughout the simulation, then you should consider cellSets combined with setsToZones. This will give you access to a cellZone inside the simulation, where the cells, which fulfill your spatial requirement, are listed.

In this way you do not have to recompile your solver in case you decide to change x0 or any other parameter.

Kind regards,

Niels

 Zvex June 24, 2013 15:37

Quote:
 Originally Posted by ngj (Post 340733) Yes that is true, however, if this limit is static throughout the simulation, then you should consider cellSets combined with setsToZones. This will give you access to a cellZone inside the simulation, where the cells, which fulfill your spatial requirement, are listed. In this way you do not have to recompile your solver in case you decide to change x0 or any other parameter. Kind regards, Niels
Hello,

does it mean, that I can control the center of cells during calculations? I want to experiment with algorithm for choosing cell centers to minimize the non-orthogonality effects.

I really need it, because i've constructed a mesh with triangle prisms, with acute triangles - so using Voronoy points as cell centers would solve problems with errors because of non-orthogonality.

Forcing OpenFOAM to use my custom cell centers in ALL calculations - is it possible?

regards,
Andrej

 All times are GMT -4. The time now is 04:31.