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

capturing cell centers

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 27, 2022, 01:31
Default capturing cell center to center distances
  #1
Member
 
hari charan
Join Date: Sep 2021
Location: India,hyderabad
Posts: 97
Rep Power: 5
saicharan662000@gmail.com is on a distinguished road
Hi guys,
I added a code for getting cell center to center distance. And I want only the center to center distances on x direction. But i am not getting the expected result. I am attaching the code

Code:
const unallocLabelList& neighbour = mesh.neighbour();
const unallocLabelList& owner = mesh.owner();
 const volVectorField& C = mesh.C();
forAll(owner, facei)
 {
  vector delta = C[neighbour[facei]] - C[owner[facei]];

  const dimensionedScalar len("len",dimLength,delta.component(vector::X));
 
  Info << "len: " << len.value() << " m" <<endl;
  
}
as my cell size is (0.01,0.0025,0.05) and uniform mesh I should get len = 0.01 all over the timesteps,
But i am getting worng result. I am attaching the result
Code:
len: 0.01 m
len: -8.67362e-19 m
len: 0.01 m
len: 1.73472e-18 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 6.93889e-18 m
len: 0.01 m
len: 2.08167e-17 m
len: 0.01 m
len: 6.93889e-18 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: -1.38778e-17 m
len: 0.01 m
len: 1.38778e-17 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 2.77556e-17 m
len: 0.01 m
len: -1.38778e-17 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: -2.77556e-17 m
len: 0.01 m
len: -2.77556e-17 m
len: 0.01 m
len: -2.77556e-17 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: -2.77556e-17 m
len: 0.01 m
len: 2.77556e-17 m
len: 0.01 m
len: -2.77556e-17 m
len: 0.01 m
len: -5.55112e-17 m
len: 0.01 m
len: -8.32667e-17 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 5.55112e-17 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: -5.55112e-17 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: -5.55112e-17 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 5.55112e-17 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 0 m
len: 0.01 m
len: 5.55112e-17 m
len: 0.01 m
len: -5.55112e-17 m
Can anyone tell me whats wrong ? open to accept any advice.

Thanks in advance

Last edited by saicharan662000@gmail.com; May 27, 2022 at 05:48.
saicharan662000@gmail.com is offline   Reply With Quote

Reply

Tags
openfoam, openfoam8


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
How to use "translation" in solidBodyMotionFunction in OpenFOAM rupesh_w OpenFOAM Running, Solving & CFD 5 August 16, 2016 05:27
How can I define the cell centers without using writeCellCenters? Taylorreihe OpenFOAM Post-Processing 4 February 19, 2016 13:46
[General] 2 datas on one plot Akuji ParaView 46 December 1, 2013 15:06
Using a custom algorithm for cell center calculations Zvex OpenFOAM Programming & Development 7 June 30, 2013 06:01
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15


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