fluent msh file to tecplot by fortran
I read a fluent 'msh' file with fortran to my own cfd solver. It is easy to get cells' node list, but the sequence of node in cells' node list is wild. So it is need same methods the rank the node list in order to make use of tecplot to do post.
Is there someone had a similar experience? Hope this can be discussed.
in my spare time i work on a MATLAB tool to play with unstructured meshes and related techniques. It is in a very early stage development phase but the following is present:
- reading of gambit .msh or fluent .cas (ascii) files
- output to .vtk legacy files (ascii) in unstructured_grid format (working both in 2D/3D)
I don't know exactly the Tecplot format, but if you check this:
and you think there is some chance for my contribution to be useful i can surely share it.
thank you for your reply, Paolo. i think your code will help me a lot. i read the vtk file format. i found the node list in cell is mostly same to tecplot.
my email: firstname.lastname@example.org
you can find the tool at the following link:
Now, for several reasons, i put in the link the whole tool. So, in order for you to fruitfully use the part you need, some explanations are needed.
The tool is actually a collection of functions, grouped by tasks under several folders plus a main test.m file which contains some useful examples.
The following folders are present (in logical order):
input: it is the folder for the mesh files input. It includes a subfolder "files" with actual example .msh files and a simple single-block structured grid generator (the three routines inside the folder).
grid: it contains the main routine (readmsh.m) for reading .msh grids and .cas fluent case files (both in ascii format) and routine trasformation.m to apply a simple manipulation to the grid nodes.
NOTE: In order to understand how the writing to the .vtk file is done, you need to clearly understand how the data in the .msh file is stored internally after reading it.
fvgeom: this folder contains several pre-processing tools which are useful within the code. They are all important for several reasons, but for your task it is probably fvgeom.m which needs a better look.
fieldfunctions: basic routines to define a scalar or vectorial test field or its derivative.
fvcomp: it contains a gradient and a filtering routine.
kdtree: routines and data structures for a k-search algorithm. Fully taken from MATLAB Exchange without any modification.
rbf: simple routines to perform basic Radial Basis Function Interpolation and derivative computation.
plot: a collection of plotting functions.
vtk: the routine used to export to .vtk, with the resulting file (both in 2D/3D) being readily available for plotting in Paraview. This is the main routine you are interested in (after you understand how data is stored internally). Note that, at the moment, there is no support for general polyhedral cells (i was unable to find a reference) but only for hexa/quad, tetra/tri, wedge, pyramids.
This is more or less a description of the several tools available. In the test.m file there are several examples on the different tools and all the subroutines are, in my opinion, heavily commented so you should be able (after a while) to understand how things work.
As you can see, all the material is at a very rough development stage yet so, it goes without saying, EVERYTHING COMES WITHOUT ANY FORM OF WARRANTY. Besides this, you can use it as you want.
I want to collect here the critical points/routines or parts where a full testing is still needed:
- general: boundary conditions are read from the .msh file but, NOWHERE IN THE TOOL they are considered (e.g., in the gradient computation).
- input\writemsh.m: it actually works and i've been using it for a while now without any problem. Nonetheless, sometimes Fluent launches a warning in reading the meshes written by this file... still, it can work it out without problems.
- fvcomp\fvfilter.m: i never used the routine or even tested it; might also be totally wrong (ok, maybe not that bad...).
- kdtree\...: the whole tool was not developed by me and i know nothing about it.
- vtk\vtkwrite.m: i already said this but i repeat it, there is a lack of support for polyhedral cells. I don't know if polygonal cells (2D) are supported because i didn't have any tool to create them.
Thank you very much for your selfless giving! I will do my best to understand it.
|All times are GMT -4. The time now is 23:18.|