|
[Sponsors] |
February 12, 2010, 08:47 |
OpenFoam data files
|
#1 |
New Member
Join Date: Dec 2009
Posts: 5
Rep Power: 17 |
I would like to post-process OpenFoam velocity field data with Matlab. For this, I am going to use the 'points' file located in constant>polyMesh>points. I am also going to use a 'U' file. The points file containts more rows than the U file. I'm assuming this is the case because the points file contains the boundary points, while the U file does not. This presents a problem
Does anyone know what the correspondence is between these two data files? I need to know which points have which velocities, and which points are on the boundary, and which are in the interior of the boundary? thanks! |
|
February 12, 2010, 10:15 |
|
#2 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37 |
The points in OpenFoam are the the corners of any computational cell, e.g. a hex-cell is made out of 8 points. The velocity is computed in the cell centres of these computational cells, hence there should not be a direct correspondence.
Use the tool "writeCellCentres" to achieve the cell centres, which corresponds to those in the velocity file. Best regards, Niels |
|
February 15, 2010, 06:47 |
|
#3 |
New Member
Join Date: Dec 2009
Posts: 5
Rep Power: 17 |
Thanks for the help. I looked up writeCellCentres.C in the documentation, but they don't have an example of how to enter it into the solver. Is this straightforward or more involved? Any help would be appreciated!
thank you |
|
February 15, 2010, 07:56 |
|
#4 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37 |
You cannot make it a part of the solver, as it is a stand-alone postprocessing tool. Just type writeCellCentres in the command line when you have completed the computation, and the cell centres will be written to each time directory.
Type "writeCellCentres -help" if you are unsure how to use it. Best regards, Niels |
|
February 15, 2010, 08:53 |
|
#5 |
New Member
Join Date: Dec 2009
Posts: 5
Rep Power: 17 |
Tak, Niels!
|
|
April 17, 2014, 11:39 |
|
#6 |
New Member
jeicek
Join Date: Nov 2013
Location: Germany
Posts: 18
Rep Power: 13 |
Hello Guys,
I typed writeCellCenters and it creates files in each time step with names of 'ccx ,ccy and ccz' but the strange thing is that the dimension of these ccx ccy ccz are only m or in other words their dimension is length and not the velocity also their values are not corresponding with U file!!!??? am I wrong?? do you have any idea? |
|
April 17, 2014, 11:51 |
|
#7 |
Senior Member
|
Hi,
Units for coordinates of the centers of cells should be in meters. Why would they be in meters per second? |
|
April 18, 2014, 15:46 |
|
#8 |
New Member
jeicek
Join Date: Nov 2013
Location: Germany
Posts: 18
Rep Power: 13 |
Hi Alexeym, then what are these 'ccx ,ccy and ccz' ?? Aren't they the velocity components in x,y and z directions in the cell center?!?!? if not then what are they?
|
|
April 18, 2014, 15:47 |
|
#9 |
New Member
jeicek
Join Date: Nov 2013
Location: Germany
Posts: 18
Rep Power: 13 |
Hi Alexeym,then what are these 'ccx ,ccy and ccz' ?? Aren't they the velocity components in x,y and z directions in the cell center?!?!? if not then what are they?
|
|
April 18, 2014, 16:33 |
|
#10 |
Senior Member
|
Hi,
no, they are not. Reread the name of the utility - write cell centers. Look at the code of utility: Code:
for (direction i=0; i<vector::nComponents; i++) { volScalarField cci ( IOobject ( "cc" + word(vector::componentNames[i]), runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh.C().component(i) ); cci.write(); } If you'd like to get velocity components use foamCalc. |
|
April 20, 2014, 10:30 |
|
#11 |
New Member
jeicek
Join Date: Nov 2013
Location: Germany
Posts: 18
Rep Power: 13 |
Thank you very much Alexym for clarifying, now it was cleared for me.
|
|
March 10, 2016, 02:29 |
coresponding coordination of gradient filed
|
#12 |
Senior Member
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 17 |
Hi,
I want to know the coordinates of cell centres coresponding to Ug values. Ug is gradient of U that is created by calcFvcGrad. I have used writeCellCentres to have ccx, ccy and ccz. But the number of data that I have for them is a bit more than the number of data that I have for Ug; 515618 for coordinates and 503367 for gradient. Anyone can help me to find the right coordinate for UGrad? Thanks |
|
November 25, 2022, 22:12 |
doesn't work
|
#13 | |
Member
Patti Michelle Sheaffer
Join Date: Sep 2018
Posts: 55
Rep Power: 8 |
Hi Neils - I tried typing writeCellCentres at the linux command line (after sourcing the bashrc file for OF) and it doesn't exist. On a search, I found a directory named writeCellCentres in the subdir /usr/lib/openfoam/openfoam2112/src/functionObjects/field/ containing two files - a header and a C file. Do we have to rebuild all the utilities in that subdir before they can be used?
Please help! Thanks! Code:
(base) patti@linux-lhkc:/OSS/Data_drive/users/00__OF_Combustion_2021-2023/n-Butane_100> setfoam bash@OpenFoam >>> writeCellCentres -help If 'writeCellCentres' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf writeCellCentres bash@OpenFoam >>> ./writeCellCentres -help bash: ./writeCellCentres: No such file or directory bash@OpenFoam >>> Quote:
|
||
November 26, 2022, 06:18 |
|
#14 |
Senior Member
Join Date: Oct 2017
Posts: 133
Rep Power: 9 |
In the current versions of OpenFOAM it is no longer a stand-alone application, but a function object: OpenFOAM 10, OpenFOAM v2112.
|
|
November 26, 2022, 15:42 |
|
#15 | |
Member
Patti Michelle Sheaffer
Join Date: Sep 2018
Posts: 55
Rep Power: 8 |
Thank you very much for the reply, Krapf. I thought it might be a version difference. So now I'm not sure how to use writeCellCentres in my runs. (I guess I only need it to run once)
Do I put this code example, for instance, in controDict or some other OF run file? BTW: the API guide for v2112 Code:
Usage Minimal example by using system/controlDict.functions: writeCellCentres { // Mandatory entries (unmodifiable) type writeCellCentres; libs (fieldFunctionObjects); // Optional (inherited) entries ... } Minimal example by using the postProcess utility: postProcess -func writeCellCentres This runs with some OF screen output - but I didn't see any outputs... Hmmm,maybe I need to "reconstruct" the (parallel) case first... (runApplication -append reconstructPar) Quote:
|
||
December 7, 2022, 16:03 |
help with conversion?
|
#16 |
Member
Patti Michelle Sheaffer
Join Date: Sep 2018
Posts: 55
Rep Power: 8 |
Thank you very much - I was able to create files, but I'm not sure how to read them. They are, like the raw datafiles, mixtures of ASCII and what appears to be (compressed?) binary data. Is there a utility to convert the data to ASCII for easy reading? (I don't see such an option in postProcess -func writeCellCentres -help-full) I was able to export the written cell center data to ASCII (as ".csv" files) using paraFoam - but I was just wondering if there was a specific OF command I'm not finding.
Thanks, PattiM Edit: I was able to load the output of writeCellCenters into paraFoam and to write them to CSV files from paraFoam - the but number of points output by paraFoam is 12,283 points, whereas my 2D solution is on 48x126 = 6,048cells. This may arise because I'm exporting from paraFoam. Isn't there a way to output a flat acsii data file directly from OpenFoam that can be to imported into matlab/python/etc.? Anyone? Edit2: The final fix was to use the python package "openfoamparser" - no issues with formats, etc. Last edited by pattim; December 20, 2022 at 12:33. |
|
Tags |
correspondence points, data file, points data file, post processing, u data file |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OF 1.6 | Ubuntu 9.10 (64bit) | GLIBCXX_3.4.11 not found | piprus | OpenFOAM Installation | 22 | February 25, 2010 14:43 |
getting data from case and data files | mkrao | FLUENT | 2 | February 10, 2009 01:11 |
Converting formatted data files to unformatted | mrangitschdowcom | OpenFOAM Post-Processing | 2 | August 1, 2008 11:20 |
200 data files to post process (how?) | Mark R | FLUENT | 1 | August 9, 2001 14:35 |
[making animations] fclose fails to close files? | Mika | FLUENT | 0 | March 30, 2001 09:19 |