CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

How to get the cells coordinate

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes
  • 7 Post By fumiya
  • 2 Post By opedrofunk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 17, 2013, 21:33
Question How to get the cells coordinate
  #1
New Member
 
Wang Han
Join Date: May 2012
Location: Shanghai China
Posts: 21
Rep Power: 13
whyingwang is on a distinguished road
Hi,foamers
Recently I get some troubles.The reslut store in the time file,e.g. 100,200.
The value store the cell's value.But in the polyMesh folder,the points file store the point's coordinate.I don't find the cells file,only the cellZone file.
I want to know, How can I get every cells coordinate?I can only see the point's coordinate, not the cell's.
Thanks
whyingwang is offline   Reply With Quote

Old   January 18, 2013, 10:32
Default
  #2
Senior Member
 
fumiya's Avatar
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 18
fumiya is on a distinguished road
Hi,

The cells file is not necessary to run the OpenFOAM applications.
I don't understand what exactly you mean by the cell's coordinate,
but you can access the coordinates of cell centers using the
mesh.C():

Code:
forAll(U, cellI)
{
    Info<< mesh.C()[cellI] << endl; //cell center coordinate of cellI
}
You can also use the utility "writeCellCentres" to output to the file.

Hope that helps,
Fumiya
fumiya is offline   Reply With Quote

Old   February 3, 2015, 23:53
Default Here's a utility I wrote to write the cell centers to a file at each specified time.
  #3
Member
 
Peter
Join Date: Feb 2015
Location: New York
Posts: 73
Rep Power: 11
opedrofunk is on a distinguished road
Download, instructions, usage, and examples are here:

https://bitbucket.org/peterjvonk/cellcenters

You can use the utility in the standard way, i.e.:

Code:
$ cellCenters -latestTime
Or in parallel:
Code:
$ mpirun -np <num-processors> cellCenters -parallel -latestTime
This is a bit different than the writeCellCentres utility that comes with OpenFOAM, as it writes the vector to a single file (rather than to three separate files, one for x, y, and z). I found it a bit cumbersome to work with three files, so I wrote this. Hope it helps.

Regards,
Peter
nishant.kumar and Utkan like this.

Last edited by opedrofunk; February 4, 2015 at 02:38.
opedrofunk is offline   Reply With Quote

Old   March 21, 2015, 15:05
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

@Peter: I've created a basic wiki page to help getting your cellCenters utility known to the community that uses OpenFOAM technology: http://openfoamwiki.net/index.php/Contrib/cellCenters

May you or anyone else feel free to update that wiki page!

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   October 25, 2017, 03:51
Default
  #5
New Member
 
Ayush Agrawal
Join Date: Jun 2014
Posts: 16
Rep Power: 11
ayushmorx is on a distinguished road
Hello,

I am trying to get cellCenters working for the past couple of days, but unfortunately I am having problems using it. I have attached the output here. Would be glad for any help!
--------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 4.1
Exec : cellCenters
Date : Oct 25 2017
Time : 03:44:04
Host : "Ayush-Work"
PID : 19641
Case : /media/ayushmorx/HD2/lownu_mine
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 5

Time = 5


--> FOAM FATAL IO ERROR:
error in IOstream "/media/ayushmorx/HD2/lownu_mine/5/cellCenters" for operation Ostream& operator<<(Ostream&, const char)

file: /media/ayushmorx/HD2/lownu_mine/5/cellCenters at line 18.

From function virtual bool Foam::IOstream::check(const char*) const
in file db/IOstreams/IOstreams/IOstream.C at line 96.

FOAM exiting
----------------------------------------------------------------------------------------------------------------
ayushmorx is offline   Reply With Quote

Old   March 21, 2022, 02:25
Default
  #6
New Member
 
ZhuangLi
Join Date: Jan 2022
Posts: 13
Rep Power: 4
zhuangli is on a distinguished road
Quote:
Originally Posted by opedrofunk View Post
Download, instructions, usage, and examples are here:

https://bitbucket.org/peterjvonk/cellcenters

You can use the utility in the standard way, i.e.:

Code:
$ cellCenters -latestTime
Or in parallel:
Code:
$ mpirun -np <num-processors> cellCenters -parallel -latestTime
This is a bit different than the writeCellCentres utility that comes with OpenFOAM, as it writes the vector to a single file (rather than to three separate files, one for x, y, and z). I found it a bit cumbersome to work with three files, so I wrote this. Hope it helps.

Regards,
Peter

Hi,
Sorry to bother.
I want to make sure that after using the cellcnter tool ,the order of cell center coordinate in OpenFOAM file is as same as the cellZones ' s order, what my think is right or not?
Thanks in advance.

_________________
Best regards
Zhuangli
zhuangli is offline   Reply With Quote

Reply


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
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 05:50
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 21:11
[snappyHexMesh] snappyHexMesh aborting Tobi OpenFOAM Meshing & Mesh Conversion 0 November 10, 2010 03:23
physical boundary error!! kris Siemens 2 August 3, 2005 00:32


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