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

Utility to export field data

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 13, 2016, 11:42
Default Utility to export field data
  #1
New Member
 
Thomas Kelly
Join Date: Jul 2016
Posts: 1
Rep Power: 0
tbrycekelly is on a distinguished road
Good morning,

I have looked through the file structure used by openfoam and see that the field data I want (i.e the U vectors) are listed based on cell number:
Quote:
60000
(
(-8.48111e-06 -4.16254e-07 4.41009e-06)
(-2.36502e-05 -5.02387e-07 2.36241e-06)
(-2.78477e-05 -5.26683e-07 1.28443e-06)
(-3.10586e-05 -5.27151e-07 7.17121e-07)
(-3.2329e-05 -5.41e-07 2.91129e-07)
...
I would like to use this information with the polymesh location data for use in some code that I'm writing, but the polymesh data is far from user friendly. In order to determine the center of the cell (i.e. the location data for the U vectors above), it requires parsing owner to determine the faces of the cell, then parsing faces to find the points that make up that cell, and finally using points to determine the physical location of the cell. While I see the logic in such a structure, it may be beyond my programming/mental abilities to organize.

I am hoping that there is a utility or script out there which would streamline this process so I can quickly export the physical coordinates of each cell to be used in combination with the vector data.

Ultimately I'll likely be using this data to make a gridded product to be used in my own model, but I can handle that aspect.
tbrycekelly is offline   Reply With Quote

Old   November 23, 2024, 08:48
Default
  #2
New Member
 
Enrico DL
Join Date: Feb 2024
Location: Barcelona
Posts: 2
Rep Power: 0
enricodl is on a distinguished road
Hi, eventually it's late but in case some new student has the same question..
1)If you're writing your own solver or functionObject, from the code you can access the vector through the method mesh.C() of the mesh class, that return all the cell centres coordinates as a vectorField, e.g.:


const vectorField& myCellCentres = mesh.C();

2)There is a postProcess command to obtain all the cell centres:
$ cd myOFcase
$ postProcess -func writeCellCentres


note: if you're running on a HPC and you have to use slurm and can't run commands directly on terminal, remember to put the header in your .sh script sourcing OF. e.g. :


#!/bin/bash
source /usr/lib/openfoam/openfoam2306/etc/bashrc
postProcess -func writeCellCentres
enricodl is offline   Reply With Quote

Reply

Tags
export data, polymesh, positions


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
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 92 May 21, 2024 08:56
Comsol Magnetic field data to Fluent MHD dean993 FLUENT 4 December 17, 2018 13:31
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 19:57
sample utility surfaceformat as grid data for gnuplot circular crosssection cfddwarf OpenFOAM Post-Processing 0 July 13, 2012 10:05
chtMultiRegionFoam - exchange data between flow field and temperature phsieh2005 OpenFOAM Running, Solving & CFD 0 February 7, 2012 10:16


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