CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Commercial meshers] Mesh conversion from Tecplot format - help

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By wyldckat
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 6, 2012, 19:37
Default Mesh conversion from Tecplot format - help
  #1
Senior Member
 
atmcfd's Avatar
 
ATM
Join Date: May 2009
Location: United States
Posts: 104
Rep Power: 16
atmcfd is on a distinguished road
All,

I have been wanting to do a LES simulation of the NASA 2D periodic hill test case given here http://turbmodels.larc.nasa.gov/Other_LES_Data/2dhill_periodic.html
using OpenFOAM.
The 2D mesh provided for the case is in Tecplot 360 format the file is http://turbmodels.larc.nasa.gov/Othe...ll_grid.dat.gz

given in a .dat format. I can open the mesh in Tecplot, but if I write it as a data file , ICEM CFD is not able to import it, and the error msg "cannot open file" appears. I searched online and found that this is an existing issue with reading tecplot files in ICEM.

I am wondering how to import this mesh into OpenFOAM now, after defining all the boundary conditions. I could not find any way to convert this .dat file from tecplot to any format accepted by common mesh generating softwares like icem/hypermesh etc. or even solvers like Fluent.

I have tried converting the dat file into a foam mesh using datToFOAM utility, but the points file somehow shows points in 3D, though the mesh is 2D. I'm quite sure that the points.tmp file is incorrect.

IS there any way to get the mesh into a software so that I can define boundary conditions in it and export it into a common mesh format readable by FOAM???


Thank you in advance!!!
atmcfd is offline   Reply With Quote

Old   October 7, 2012, 03:07
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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 atmcfd,

In OpenFOAM, there is no 2D. It's always 3D, but if one of the directions has empty patches on both sides, then it will simulate as if it was 2D.

Study the tutorial "compressible/rhoCentralFoam/biconic25-55Run35", which provides a good example on how to use datToFoam!

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   October 7, 2012, 03:16
Default
  #3
Senior Member
 
atmcfd's Avatar
 
ATM
Join Date: May 2009
Location: United States
Posts: 104
Rep Power: 16
atmcfd is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Greetings atmcfd,

In OpenFOAM, there is no 2D. It's always 3D, but if one of the directions has empty patches on both sides, then it will simulate as if it was 2D.

Study the tutorial "compressible/rhoCentralFoam/biconic25-55Run35", which provides a good example on how to use datToFoam!

Best regards,
Bruno
dear bruno,

I did tun the biconic dat file through the converter before posting in the forum... though I understood how datToFOAM works, I cannot understand how the points.tmp file had coordinates in the format (x,y,z), whereas the grid file only has x and y.

I know that OF recognizes everything as 3D be default, but I do not understand where the "z" data comes from in the points.tmp file... is it something that OF "assumes", since the data is 2D? Coz, the values look very random, having both positive and negative values - and this makes the resulting mesh useless. Is there any way I can make it read this data file as is, and maybe give it some default "z" value for all the points so that its considered as 3D?

Thank you for your time!!
atmcfd is offline   Reply With Quote

Old   October 7, 2012, 03:57
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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
Hi again atmcfd,

So gave it a shot and it worked fine for me. Here are the steps I took:
  1. Copy the previously mentioned tutorial case folder:
    Code:
    cp -r $FOAM_TUTORIALS/compressible/rhoCentralFoam/biconic25-55Run35 hill_grid
  2. Got and unzipped the 2D mesh:
    Code:
    wget http://turbmodels.larc.nasa.gov/Other_LES_Data/hill_grid.dat.gz
    gunzip hill_grid.dat.gz
  3. Replaced the header in "hill_grid.dat":
    Code:
    variables="x","y"
    zone, t="hill grid points"
    # Note: there may be round-off errors
     STRANDID=0, SOLUTIONTIME=0
     I=197, J=129, K=1, ZONETYPE=Ordered
     DATAPACKING=BLOCK
     DT=(SINGLE SINGLE SINGLE SINGLE SINGLE )
    With this one:
    Code:
     variables = x y
     zone t="hill grid points", i=          197  j=          129  f=block
  4. Edited "constant/polyMesh/blockMeshDict" and replaced the hex line with this one:
    Code:
        hex (0 1 2 3 4 5 6 7) (195 127  1) simpleGrading (1 1 1)
  5. Ran the following commands:
    Code:
    blockMesh
    datToFoam hill_grid.dat 
    cat constant/pointsHeader constant/points.tmp > constant/polyMesh/points
    collapseEdges "2e-07" 5
  6. Moved the "0" folder and remove some excess files:
    Code:
    mv 0 0.org
    rm constant/wedgeScr
  7. Inspected the mesh:
    Code:
    paraFoam
    And confirmed it looked like the one at http://turbmodels.larc.nasa.gov/Other_LES_Data/2dhill_periodic.html
Any questions?

Best regards,
Bruno

PS: Mmm... looks like at the bottom the mesh still has a wedge-like aspect to it... I hope you can figure out how to fix that
JackW likes this.
__________________

Last edited by wyldckat; October 7, 2012 at 04:09. Reason: see "PS:"
wyldckat is offline   Reply With Quote

Old   October 8, 2012, 03:16
Default
  #5
Senior Member
 
atmcfd's Avatar
 
ATM
Join Date: May 2009
Location: United States
Posts: 104
Rep Power: 16
atmcfd is on a distinguished road
Thank you very much Bruno!

I could do the steps and obtain the mesh - it looks good. I have some questions on this method:

1) is the blockMeshDict file containing the default points
vertices
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 0.1)
(1 0 0.1)
(1 1 0.1)
(0 1 0.1)
);

supposed to be edited before I import my mesh using datToFOAM ?
because we have edited the blocks "hex" part , but the don't the vertices and the boundary types specifed in the blockMeshDict refer to an entirely different geometry altogether? I did not know how to edit them according to this mesh since I obviously don't know the points. why cant I just import the mesh from dat format without using blockMesh for a different geometry?


2) Since I need to visually see the mesh to define the boundary conditions, I converted the resulting OF mesh into a Fluent mesh using foamMeshToFluent. I tried importing this in Gambit, it shows an error...something like the header file was wrong etc. The mesh opens perfectly in Fluent , though it shows all the boundary conditions for the mesh as mentioned in the blockMeshDict. Any ideas as to what is happening here?

3) My idea is to open the mesh in a mesh gen software (preferebly in Ansys WB) so that I can define proper boundary conditions and export it as a Fluent .msh , and again import it into OpenFOAM after which I can use it. But then, I have to make sure this mesh opens correctly in a mesh gen software, else I'll be in trouble

Once again, I appreciate the time and help you have given here. forgive me if any of my questions looked very trivial here ..I am very new to OpenFOAM and I wish to learn it a lot more in the near future.

Thanks!


P.S.:

this is how the header for the Fluent mesh (which OpenFOAM created ) starts:

(0 "FOAM to Fluent Mesh File")

(0 "Dimension:")
(2 3)

(0 "Grid dimensions:")
(10 (0 1 c400 0 3))
(12 (0 1 60bd 0 0))
(13 (0 1 18436 0 0))

(10 (1 1 c400 1 3)
(
3.2143503000e-02 1.0033890000e+00 -1.7512432837e-03
6.4291403000e-02 1.0033660000e+00 -1.7512031412e-03 ..........
.................................................. ..............................
........................................
........................................
atmcfd is offline   Reply With Quote

Old   October 8, 2012, 16:56
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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
Hi atmcfd,
Quote:
Originally Posted by atmcfd View Post
1) is the blockMeshDict file containing the default points
vertices
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 0.1)
(1 0 0.1)
(1 1 0.1)
(0 1 0.1)
);

supposed to be edited before I import my mesh using datToFOAM ?
because we have edited the blocks "hex" part , but the don't the vertices and the boundary types specifed in the blockMeshDict refer to an entirely different geometry altogether? I did not know how to edit them according to this mesh since I obviously don't know the points. why cant I just import the mesh from dat format without using blockMesh for a different geometry?
The "blockMeshDict" is used to create the base mesh template. The number of points is almost identical, except for -2 points on both directions... probably due to how each file format works.
datToFoam converts the list of points from ".dat" to OpenFOAM's point list format. Therefore, the points are replaced, but the mesh preserves the topology... at least in theory!

But there is a strange problem here, which I mentioned and left for you to diagnose and try to fix: the original tutorial on which we're basing ourselves, needs the mesh to be in a wedge shape, because it simulates only a thin slice of the original geometry. And it seems to me that datToFoam assumes that this is the standard shape to always be used when converting... which is not what you want on your case.

Quote:
Originally Posted by atmcfd View Post
2) Since I need to visually see the mesh to define the boundary conditions, I converted the resulting OF mesh into a Fluent mesh using foamMeshToFluent. I tried importing this in Gambit, it shows an error...something like the header file was wrong etc. The mesh opens perfectly in Fluent , though it shows all the boundary conditions for the mesh as mentioned in the blockMeshDict. Any ideas as to what is happening here?
Like I wrote on the previous paragraph, the mesh has a wedge shape, which is not what you want. This is what leads to the flaws in the mesh.

As for the names of the boundary conditions: you can define them properly in "blockMeshDict", at least for the most part. If you need to have more than one patch on one of the sides, you can use createPatch.

Quote:
Originally Posted by atmcfd View Post
3) My idea is to open the mesh in a mesh gen software (preferebly in Ansys WB) so that I can define proper boundary conditions and export it as a Fluent .msh , and again import it into OpenFOAM after which I can use it. But then, I have to make sure this mesh opens correctly in a mesh gen software, else I'll be in trouble

Once again, I appreciate the time and help you have given here. forgive me if any of my questions looked very trivial here ..I am very new to OpenFOAM and I wish to learn it a lot more in the near future.

Thanks!
I don't have the time right now to diagnose what is happening with the mesh when converting from ".dat" to OpenFOAM. If you can fix that, you can easily use the converted Fluent mesh in Ansys WB.

Good luck!
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   October 12, 2012, 01:55
Default
  #7
Senior Member
 
atmcfd's Avatar
 
ATM
Join Date: May 2009
Location: United States
Posts: 104
Rep Power: 16
atmcfd is on a distinguished road
Bruno,

Thanks for the heads up. Just an update here:

I made some changes to the datToFoam source code, in the places where the comments say that the the lines of code are meant for biconic meshes. I commented out those lines of code

Code:
    // We ignore the first layer of points in i and j the biconic meshes
  //  label nPointsij = (iPoints - 1)*(jPoints - 1);
.......
// if statement ignores the first layer in i and j
             //   if (i>0 && j>0)
            //    {
          //          points[p++][comp] = coord;
        //        }
      //      }
    //    }
  //  }

    // correct error in biconic meshes
   // forAll(points, i)
   // {
     //   if (points[i][1] < 1e-07)
       // {
        //    points[i][1] = 0.0;
having done so, I can convert the mesh into FOAM format, and subsequently into Fluent .msh format. I do not get the wedge now. Atleast, thats what it looks like.

I can open this mesh in Ansys Workbench, Fluent and Ansys CFX-Pre., whereas I cannot do so in Gambit or ICEM-CFD.

Thanks !!
atmcfd is offline   Reply With Quote

Old   October 12, 2012, 16:19
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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
Hi atmcfd,

I'm glad you figured it out and shared the solution! Hopefully this will be useful for or people looking for the same solution!

As for the problem with importing the mesh: did you run checkMesh to confirm if the mesh is OK? There might be some weird glitch that some mesh importers don't mind, but others complain about due to the weird imperfections...

By the way, this line might be affecting the resulting mesh:
Code:
collapseEdges "2e-07" 5
In the sense that very small edges might be being collapsed when they shouldn't be.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   October 14, 2012, 16:10
Default
  #9
Senior Member
 
atmcfd's Avatar
 
ATM
Join Date: May 2009
Location: United States
Posts: 104
Rep Power: 16
atmcfd is on a distinguished road
Hi Bruno,

I ran checkMesh and this is the output I get
Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:           50176
    internal points:  0
    faces:            99382
    internal faces:   49208
    cells:            24765
    boundary patches: 6
    point zones:      0
    face zones:       0
    cell zones:       0

Overall number of cells of each type:
    hexahedra:     24765
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:     0

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces ...
    Patch               Faces    Points   Surface topology                  
    cone                195      392      ok (non-closed singly connected)  
    outlet              127      256      ok (non-closed singly connected)  
    freestream          195      392      ok (non-closed singly connected)  
    centreLeft          127      256      ok (non-closed singly connected)  
    wedge1              24765    25088    ok (non-closed singly connected)  
    wedge2              24765    25088    ok (non-closed singly connected)  

Checking geometry...
    Overall domain bounding box (0.032143503 0.0032018241 -0.00529831775495462) (9.000004 3.035714 0.00529831775495462)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (-1.52238576634444e-19 3.07654883655731e-18 -6.06932897918858e-16) OK.
 ***High aspect ratio cells found, Max aspect ratio: 4085.63956462773, number of cells 348
  <<Writing 348 cells with high aspect ratio to set highAspectRatioCells
    Minumum face area = 5.58437171834072e-08. Maximum face area = 0.00523889579076825.  Face area magnitudes OK.
    Min volume = 2.56474769257852e-09. Max volume = 5.4806642013295e-05.  Total volume = 0.141533400036473.  Cell volumes OK.
    Mesh non-orthogonality Max: 12.946271206595 average: 4.83060081614222
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 0.136404763277092 OK.
    Coupled point location match (average 0) OK.

Failed 1 mesh checks.

End
I just wanted to know why you rename the "0" folder to "0.org" ...
The checkMesh demands there be a "0" folder, without which the utility exits. I had to rename it to make it to "0" to make it work.

And as you suggested, I created the mesh without collapsing the edges this time., and I still get the same "Failed 1 mesh checks" with the same numbers.

Also, something I noticed here:

1) When I open the mesh through paraFoam, I get this

Code:
created temporary 'hill_grid.OpenFOAM'
--> FOAM Serious Error : 
    From function IOobject::readHeader(Istream&)
    in file db/IOobject/IOobjectReadHeader.C at line 89
    Reading "/home/arvind/OpenFOAM/arvind-2.1.1/run/hill_grid/constant/points.tmp" at line 2
    First token could not be read or is not the keyword 'FoamFile'

Check header is of the form:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       IOobject;
    location    "constant";
    object      points.tmp;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
though I can see the mesh in Paraview. Then, I added the header to the points file in the constant dir, and the error msg disappeared. However, it didnt seem to make any difference to what I was seeing in Paraview.

2) I just wanted to know why you rename the "0" folder to "0.org" ... I saw that paraview doesnt show the mesh unless its renamed to 0.org, whereas
The checkMesh demands there be a "0" folder, without which the utility exits. I had to rename it to make it to "0" to make it work.

I then convert the mesh to Fluent format using foamMeshToFluent:

Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Writing Header
End
However, these were just small things I noticed. But the major question still remains....I cannot get this to open in ICEM or Gambit.

Thank you again!!
atmcfd is offline   Reply With Quote

Old   October 15, 2012, 06:38
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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
I renamed "0" to "0.org" simply because the boundary conditions would no longer be valid, given the very different settings. It was the quickest temporary fix, so we could focus on the mesh.

To check the mesh without "0":
Code:
checkMesh -constant
The warning that ParaView gives is ignorable. The quickest/proper fix would probably be to remove the "points.tmp" file after being successfully used.

As for the message given by checkMesh: that's is a very high value of aspect ratio. You can inspect the cellSet "highAspectRatioCells" in ParaView, either using the "see sets" option on the object inspector, our by using the "-cellSet" option in foamToVTK.
atmcfd likes this.
__________________
wyldckat is offline   Reply With Quote

Old   November 1, 2012, 20:51
Default
  #11
Senior Member
 
atmcfd's Avatar
 
ATM
Join Date: May 2009
Location: United States
Posts: 104
Rep Power: 16
atmcfd is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
I renamed "0" to "0.org" simply because the boundary conditions would no longer be valid, given the very different settings. It was the quickest temporary fix, so we could focus on the mesh.

To check the mesh without "0":
Code:
checkMesh -constant
The warning that ParaView gives is ignorable. The quickest/proper fix would probably be to remove the "points.tmp" file after being successfully used.

As for the message given by checkMesh: that's is a very high value of aspect ratio. You can inspect the cellSet "highAspectRatioCells" in ParaView, either using the "see sets" option on the object inspector, our by using the "-cellSet" option in foamToVTK.
Bruno,

Sorry for getting back late. I just wanted to thank you for your help and post my solution here....
I had finally managed to get the mesh into OF. As you said, the high aspect ratio was the problem. So, I wrote a C++ code to extrude the given mesh into 3D, with the desired mesh spacing and distance, and output the resulting 3D mesh in plot3d format.the mesh spacing I chose took care of the aspect ratio issue, and the checkMesh report was fine. After that, I just used plot3dtoFoam utility and the mesh was saved in OF. Then I used setSet to specify the boundary faces.

Turned out to be simple after all!
atmcfd is offline   Reply With Quote

Old   February 22, 2014, 06:34
Default Tecplot mesh to OpenFOAM format
  #12
New Member
 
anonymous
Join Date: Oct 2013
Posts: 9
Rep Power: 12
ankit171032 is on a distinguished road
Dear Sir,

How have you converted the tecplot mesh to OpenFOAM format.In your last message you have mentioned that you have written a code to extrude mesh to 3d and then converted that 3D mesh to plot3Dformat.Can you please elaborate on this ?
I also have the same problem.I have a tecplot .plt file and I want to open the file in OpenFoam to do some further analysis


Thanks and Regards
ankit171032 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
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 06:09
[snappyHexMesh] Creating multiple multiple cell zones with snappyHexMesh - a newbie in deep water! divergence OpenFOAM Meshing & Mesh Conversion 0 January 23, 2019 04:17
Mesh Boundary Assignment Question Wandadars Mesh Generation & Pre-Processing 1 June 13, 2016 17:19
Mesh motion with Translation & Rotation Doginal CFX 2 January 12, 2014 06:21
[snappyHexMesh] Layers:problem with curvature giulio.topazio OpenFOAM Meshing & Mesh Conversion 10 August 22, 2012 09:03


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