|
[Sponsors] |
May 26, 2010, 08:51 |
Import xyz data
|
#1 |
Senior Member
Eelco van Vliet
Join Date: Mar 2009
Location: The Netherlands
Posts: 124
Rep Power: 19 |
Dear Foamers,
I have a question on importing an arbitrary xyz (or csv) file into OpenFoam. I want to run a mhdFoam calculation. But the initial B-field is obtain from Comsol, which can only export .cvs files. Is there a way to interpolate an arbitrary xyz column file onto an OpenFoam mesh ? Similar like for instance mapFields. Many thanks! Regards, Eelco |
|
May 27, 2010, 15:03 |
|
#2 |
Member
M. Mahdi Salehi
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 50
Rep Power: 17 |
There is a function called "interpolateXY" available in OpenFOAM. You can use that, but you should write a code to do this.
|
|
May 28, 2010, 09:01 |
|
#3 |
Senior Member
Eelco van Vliet
Join Date: Mar 2009
Location: The Netherlands
Posts: 124
Rep Power: 19 |
Thank you for your suggestion. Although I was hoping that there would be a little utility already there which works like mapfields but instead takes a cvs data file as input.
Ideally I want to convert the magnetic field which is stored in an external cvs file in to a openFoam format B-field in the zero directory, so you can read this file when you start the simulations. Hopefully somebody has already accomplished this, otherwise I need to write it myself. Regards, Eelco |
|
May 28, 2010, 11:03 |
|
#4 |
Senior Member
|
Unfortunatly VTK does only have a OpenFOAMReader http://www.vtk.org/doc/release/5.6/html/a01234.html but no OpenFOAMWriter exists
|
|
June 8, 2010, 09:05 |
solution csv data import
|
#5 |
Senior Member
Eelco van Vliet
Join Date: Mar 2009
Location: The Netherlands
Posts: 124
Rep Power: 19 |
Dear Foamers,
In case anybody is interested, here my solution how to read a csv asci file with asci columns on a regular grid and interpolate it on an openFoam grid file. I wrote a little perl script which converts the cvs file with x,y,z,v1,v2,...vN data columns and put them with a new file header into a regular structure plot3d file. Then I modified the plot3dToFoam utility in order to read the newly created p3d data file and interpolate it on the openFoam grid. The OF grid is obtained from a vector field which is called Bf, hence this must be present in the 0 directory. Rename this field in the code and recompile it if you need it to be interpolated on another grid. So, starting from the csv file do csv2p3d.pl Bfield.csv this generates Bfield.p3d Then run in the OF case directory plot3DmapField Bfield.p3d This interpolates the Bfield.p3d field into the OF Bf field in the 0 directory. Although this OF utility works perfectly fine for me, I am sharing it because hopefully somebody can suggest improvements. Especially, the field which is being interpolated must be a vector field which is called Bf (which is the magnetic field in my case). This works for me, but it should be possible to make the utility more generic, such that the field can have any name and type. Ideally, I would have liked to have something like foamCalc, where you can give as an option the field name to interpolate on, and a external file name representing the asci file. Something like foamCalc <of-data-fieldname> <ascifield-to-be-read-and-interpolated> Unfortunately, how this foamCalc is programmed is a bit to untransparant for me. A suggestion for the new release of OF? I think that the interpolation of an arbitrary data field obtained from measurements or another simulation program to an OF data field should be something standard present in OF. Another ugly thing in my solution is that I define my own interpolation of the regular grid to the OF grid, but probably this should be possible with interpolation functions which are present in OF already. However, I just don't see how to do that. Anybody? In conclusion. This utility works, recompile for your own needs, but please get back with suggestions if you have a way to make it more generic, such that others can enjoy it as well. In my opinion, this kind of generic utilities (i.e.: non-process specific solutions) should be shared as much as possible such the OF gets better accessible for a larger group of people. The more people use and share OF, the faster the developments, which is in everybodies interest (except the interest of Ansys of course). Regards. Eelco |
|
October 22, 2010, 13:29 |
import xyz data
|
#6 |
Senior Member
abdikerim kurbanaliev
Join Date: Jun 2010
Location: Kyrgyzstan, Osh
Posts: 121
Rep Power: 16 |
Dear ellcovv
I'm a new openfoam user and interested in importing terrain data in xyz format into openfoam. My data looks like this body, div, table, thead, tbody, tfoot, tr, th, td, p { font-family: "Arial"; font-size: x-small; } X Y Z 426626.39 5051125.35 2351.69 426626.39 5051155.35 2351.7 426626.39 5051185.35 2351.58 426626.39 5051215.35 2351.32 426626.39 5051245.35 2351.08 Could you help me, please? Kerim |
|
July 11, 2013, 12:26 |
|
#7 |
Member
Felipe Alves Portela
Join Date: Dec 2012
Location: FR
Posts: 70
Rep Power: 14 |
Hello!
I managed to get the mesh converter to take in a data file (Q file) as an option. With some help from Eelco's program, I read in this data and "interpolate" it to the cell centres. For my case it was enough to simply average the point values at the cell centre. I am attaching it here as it might be useful to other people, note that for my case, I was reading rho u v w T from the Q-file, which differs from the standard rho rhoU rhoV rhoW T. Furthermore, the routine is quite slow as I didn't find an efficient way (honestly I don't understand most of the mesh conversion) to get the correspondence between the order in which the nodes are stored in the mesh file and the order in which they are written in OpenFOAM. |
|
February 25, 2014, 13:45 |
Hiii
|
#8 |
Member
Manjunath Reddy
Join Date: Jun 2013
Posts: 47
Rep Power: 13 |
I to have a same doubt. on searching i got this csv reader at the location
/opt/openfoam222/src/OpenFOAM/interpolations/interpolationTable/tableReaders/csv/csvTableReader.H Regards N.Manjunath Reddy |
|
May 30, 2016, 10:03 |
|
#9 |
New Member
hisham
Join Date: Nov 2015
Location: Japan
Posts: 12
Rep Power: 11 |
Dear eelcovv,
I'm new in OpenFOAM. Can you please guide me step by step how to do the interpolation in OpenFOAM start from convert the CSV file? I couldn`t understand how to keep the CSV file and run the csv2p3d.pl? and also how to call the plot3DmapField command? my CSV file as attached. Hope can hear from you soon. Please help. Hisham |
|
Tags |
csv, import |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] [DesignModeler] import data XYZ | zelito | ANSYS Meshing & Geometry | 0 | December 15, 2009 15:48 |
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug | unoder | OpenFOAM Installation | 11 | January 30, 2008 21:30 |
XYZ (ASCII format) data points into GAMBIT | Neil | FLUENT | 1 | August 7, 2007 10:24 |
How to update polyPatchbs localPoints | liu | OpenFOAM Running, Solving & CFD | 6 | December 30, 2005 18:27 |
I-DEAS CAD data import with boundary conditions | Yunus | FLUENT | 2 | March 14, 2001 15:45 |