CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Problem / Misunderstanding with mesh.C() : get the cell centers

Register Blogs Community New Posts Updated Threads Search

Like Tree11Likes

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   October 15, 2010, 07:31
Default Problem / Misunderstanding with mesh.C() : get the cell centers
  #1
Edy
Member
 
Join Date: Sep 2010
Posts: 35
Rep Power: 15
Edy is on a distinguished road
Hej,

This is probably very simple but I experienced unexpected results with the .C() function.

It is supposed to return the cell centers of the mesh it is applied to. I think that I am right so far...

However i have a 2D geometry defined for x between 0.0 and 0.0127 and y between 0.0 and 1.7, as you can see from my blockMeshDict below :

Code:
vertices
(
    (0      0   0)//0
    (0.0127 0   0)//1
    (0.0127 1.7 0)//2
    (0      1.7 0)//3
    (0      0   0.1)//4
    (0.0127 0   0.1)//5
    (0.0127 1.7 0.1)//6
    (0      1.7 0.1)//7

);

blocks
(
    hex (0 1 2 3 4 5 6 7) (20 170 1) simpleGrading (1 1 1)
);
Therefore if I consider a cell center, its x-value should be between 0.0+delta and 0.0127+delta, simply because the cell has a certain dimension and the cell center cannot be located at the boundary.

However, i wrote this piece of code :
Code:
volVectorField centres = Ua.mesh().C();
volScalarField x = centres.component(0);
          Info<< min(x) << nl << endl;
          Info<< max(x) << nl << endl;
In my terminal i get:
min(x)=0.0
max(x)=0.0127

So basically it means that there are cell centers located at the boundaries, which is nonsense!

Could you please help me and tell me what i have not properly understood, and how to solve it.

Thanks in advance.
Best

/Ed
CFDelix likes this.
Edy is offline   Reply With Quote

 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell Reynolds Number laliong Main CFD Forum 12 September 17, 2019 03:18
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13
Cell face values computation un unstructured grids Sergio Rossi Main CFD Forum 2 May 28, 2006 10:04
May I use global coordinate of cell centers in subroutine Posdat H. Shen Siemens 4 March 29, 2000 09:20
extremely simple problem... can you solve it properly? Mikhail Main CFD Forum 40 September 9, 1999 09:11


All times are GMT -4. The time now is 08:02.