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

...converting PLOT3D mesh files by NASA?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Display Modes
Old   May 5, 2011, 09:44
Default ...converting PLOT3D mesh files by NASA?
  #1
Member
 
AleDR's Avatar
 
Alessandro
Join Date: May 2009
Location: Genova
Posts: 45
Rep Power: 9
AleDR is on a distinguished road
Hi FOAMers!

I have some problems with mesh file conversion!!
I'm trying to import NASA grid for the flat plate test case in OpenFOAM... but I don't know how to!!
I am puzzled by the file extension... .p3dmft ? It should be a PLOT3D file format, but I couldn't handle it in ParaView.

I tried the plot3dToFoam but I got this error:

Create time

--> FOAM FATAL IO ERROR:
Attempt to get back from bad stream

file: flatplate_clust2_4levelsdown_35x25.p3dmft at line 1.

From function void Istream::getBack(token&)
in file db/IOstreams/IOstreams/Istream.C at line 38.

FOAM exiting

Can anybody help me? Thanks!
AleDR is offline   Reply With Quote

Old   January 18, 2014, 06:29
Default
  #2
Member
 
Ye Zhang
Join Date: Dec 2009
Location: Delft,Netherland
Posts: 92
Rep Power: 9
kiddmax is on a distinguished road
Hey Alessandro

Did you solve the problem?

Best
Ye
kiddmax is offline   Reply With Quote

Old   January 27, 2015, 10:38
Default
  #3
New Member
 
Vincent HUBER
Join Date: Jan 2015
Location: Strasbourg - France
Posts: 2
Rep Power: 0
VincentHUBER is on a distinguished road
I'm highly interested in the issue ! Have you successfully converted the mesh ?
VincentHUBER is offline   Reply With Quote

Old   January 27, 2015, 15:14
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,438
Rep Power: 25
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

I was not successful in converting meshes with OpenFOAM's plot3dToFoam (and any way there is not much sense in converting just geometry), so I have created Python script for conversion from Plot3D to Gmsh (https://github.com/mrklein/p3d2gmsh) then you can use gmshToFoam to convert mesh into OpenFOAM's format.

In general you will need geometry file (*.p3dfmt) and Neutral Map File with description of boundary conditions. I have tested the script on verification cases from http://turbmodels.larc.nasa.gov, it seems to be converting the meshes and BCs correctly.
chegdan likes this.
alexeym is offline   Reply With Quote

Old   January 27, 2015, 17:31
Default
  #5
New Member
 
Vincent HUBER
Join Date: Jan 2015
Location: Strasbourg - France
Posts: 2
Rep Power: 0
VincentHUBER is on a distinguished road
Wonderfull ! (Actually, I was planning to get Gmsh mesh files :-) )

Bonus questioon
- do you know a way to get the 3D gmsh mesh in 2D (cut along a plane) ?
OR
- can your script (that I ran successfully) be applied to p2dfmt ... without the neutral map file ?
VincentHUBER is offline   Reply With Quote

Old   January 28, 2015, 04:22
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,438
Rep Power: 25
alexeym will become famous soon enoughalexeym will become famous soon enough
No, I don't know the way to flatten mesh in Gmsh. In OpenFOAM there us flattenMesh utility, though its output is a point field, i.e. there will be no information about edges, boundaries, etc. Also there is Gmsh plugins like CutPlane, but again it will lose boundary information.

Initially I started with p2dfmt files but then realized there is no information on boundary conditions, so I've abandoned the idea.
alexeym is offline   Reply With Quote

Old   April 27, 2016, 14:33
Default error when run ./p3d2gmsh.py
  #7
New Member
 
adhi makayasa
Join Date: Apr 2015
Posts: 20
Rep Power: 3
makayasa is on a distinguished road
hi alexym, after seraching how to convet plot3dtoFoam finally I find this forum. But i get error message when running sript p3d2gmsh.py. How do fix this?


Can't open [-o. Skipping.
Can't open naca0012]. Skipping.
Can't open [-m. Skipping.
Can't open n0012]. Skipping.
makayasa is offline   Reply With Quote

Old   April 29, 2016, 04:34
Default
  #8
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,438
Rep Power: 25
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

Your output suggests that you have decided to copy command line with brackets (i.e. [-o naca0012] instead of just -o naca0012), while command should be something like:

Code:
./p3d2gmsh.py -o naca0012.msh -m naca0012.nmf naca0012.p3d
This is just a guess and could be irrelevant, since your post lacks information on the way you have got the error.
alexeym is offline   Reply With Quote

Old   April 29, 2016, 11:22
Default
  #9
New Member
 
adhi makayasa
Join Date: Apr 2015
Posts: 20
Rep Power: 3
makayasa is on a distinguished road
Thanks for reply alexym.
After run command ./p3d2gmsh.py -o naca0012.msh -m naca0012.nmf naca0012.p3d
I am get error message :

Traceback (most recent call last):
File "./p3d2gmsh.py", line 585, in <module>
main()
File "./p3d2gmsh.py", line 577, in main
nmf = NeutralMapFile(mapfile)
File "./p3d2gmsh.py", line 90, in __init__
fp = open(filename, 'r')
TypeError: coercing to Unicode: need string or buffer, list found


even tried the files in the folder test, but I still get the same error message. How to fix this?
Thank you
makayasa is offline   Reply With Quote

Old   April 29, 2016, 12:33
Default
  #10
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,438
Rep Power: 25
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

There was a bug (guess I have never really tested -o and -m flags). I have pushed fix to repository, so you need to re-download p3d2gmsh.py script.
alexeym is offline   Reply With Quote

Old   April 30, 2016, 15:15
Default
  #11
New Member
 
adhi makayasa
Join Date: Apr 2015
Posts: 20
Rep Power: 3
makayasa is on a distinguished road
Its work
So, I went on the next stage of the run command gmshToFoam but I get the following message

#0 Foam::error:rintStack(Foam::Ostream&) in "/home/xxx/OpenFOAM/OpenFOAM-1.7.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::sigSegv::sigSegvHandler(int) in "/home/xxx/OpenFOAM/OpenFOAM-1.7.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Uninterpreted:
#3
in "/home/xxx/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linuxGccDPOpt/gmshToFoam"
#4 __libc_start_main in "/lib/i386-linux-gnu/libc.so.6"
#5
in "/home/xxx/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linuxGccDPOpt/gmshToFoam"
Segmentation fault (core dumped)

Thank you
makayasa is offline   Reply With Quote

Old   April 30, 2016, 17:01
Default
  #12
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,438
Rep Power: 25
alexeym will become famous soon enoughalexeym will become famous soon enough
This time I can not guess what went wrong, since I have never used version 1.7.1 (well, except certain portions of foam-extent 3.1, which turned your to be OpenFOAM 1.7.x) and you did not show the way to reproduce your error.
alexeym is offline   Reply With Quote

Old   May 1, 2016, 02:21
Default
  #13
New Member
 
adhi makayasa
Join Date: Apr 2015
Posts: 20
Rep Power: 3
makayasa is on a distinguished road
The way that I use :
1.from (http://turbmodels.larc.nasa.gov/naca0012_grids.html) i get file to convert msh file
2. I used a python script from ( https://github.com/mrklein/p3d2gmsh ) to convert msh file
3. I moved the msh file to folder $ FOAM_RUN
4. then use the command gmshToFoam . And I got a message as I have mentioned
whether there are less of these steps ? please correction

Last edited by makayasa; May 1, 2016 at 04:36.
makayasa is offline   Reply With Quote

Old   May 1, 2016, 05:51
Default
  #14
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,438
Rep Power: 25
alexeym will become famous soon enoughalexeym will become famous soon enough
I can not reproduce the error neither with OpenFOAM 2.4.x, nor with 3.0.x. So I guess, it is specific to 1.7.1 and I do not know how to fix it.
alexeym is offline   Reply With Quote

Old   May 1, 2016, 06:04
Default
  #15
New Member
 
adhi makayasa
Join Date: Apr 2015
Posts: 20
Rep Power: 3
makayasa is on a distinguished road
Thank you so much for your help. Maybe I 'll try openfoam 2.4.0
makayasa is offline   Reply With Quote

Old   July 22, 2016, 03:34
Default
  #16
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 107
Rep Power: 4
Flowkersma is on a distinguished road
Hi,

Just for record. I have successfully converted the meshes from NASA page with plot3dToFoam converter by adding -noBlank parameter. For example:

2D mesh
Code:
plot3dToFoam naca0012.p2dfmt -2D 1 -noBlank
3D mesh
Code:
plot3dToFoam naca0012.p3dfmt -noBlank
I had also problems on converting the p3d meshes created by Construct2D.
I solved it by adding a line with 1 in the beginning of the p3d file. For boundary conditions, I use autoPatch and createPatch utilities.

Regards,
Mikko
Flowkersma is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fluent converting 'wall' to 'interior' BC for hybrid mesh DarrenC FLUENT 7 November 15, 2016 11:01
[ICEM] Hexa mesh, curve mesh setup, bunching law Anorky ANSYS Meshing & Geometry 4 November 12, 2014 01:27
Converting Salome hybrid mesh to OpenFOAM Arnoldinho OpenFOAM 4 March 28, 2012 10:24
Importing gridgen mesh files into gambit/fluent Wee FLUENT 2 June 21, 2011 08:35
external flow with snappyHexMesh chelvistero OpenFOAM 11 January 15, 2010 20:43


All times are GMT -4. The time now is 20:10.