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

[Other] vtk to OpenFoam (or something else that can reach after OpenFoam)

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

Like Tree2Likes
  • 1 Post By elvis
  • 1 Post By elvis

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 22, 2011, 09:42
Default vtk to OpenFoam (or something else that can reach after OpenFoam)
  #1
New Member
 
Join Date: Mar 2011
Posts: 13
Rep Power: 11
cristina87 is on a distinguished road
Hi,

I have a vtk file - unstructered grid type (with points and cells - I don't no exactly if it is mesh or only geometry and I should to obtain the mesh firstly - I'm beginer). However I want to do a simulation with OpenFoam - but no idea how to change the .vtk file in .OpenFoam file - I tryed many ways, but is to complicated. Last time I tried to obtain .stl from .vtk with vtkSTLWriter and after that I would change .stl in gambit to OpenFoam. But it seems to me that I can't write the unstructured grid to a .stl file (it requires vtkPolyData and I see I can't obtain this - it pass the compilation step but it has problems at running).

If I generate the mesh with blockMesh then I need a blockMeshDict and i don't know how to obtain it from the vtk file...

Cristina
cristina87 is offline   Reply With Quote

Old   March 23, 2011, 02:20
Default
  #2
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 611
Blog Entries: 5
Rep Power: 20
elvis will become famous soon enough
Hi,

i wrote a pythonvtk script to convert unstructuredgrid vtk-files into STL-files.
If you send me your VTK-file in an email elvis-the-pelvis (at) hotmail dot de i will try to convert your vtk-file into an STL-file. I will also post my script here when i come back from work.

From the STL-file you can take several ways to get a mesh for CFD-simulations with Openfoam.
=>SnappyHexMesh (SHM) http://www.openfoam.com/docs/user/sn...#x26-1490005.4
=>Engrid
http://engits.eu/en/documentation
=>discretizer (Discretizer-Setup)
http://www.discretizer.org/node/21 (a screencast)

and lots of other ways (salome , blender, calculix)
there used to be some descriptions on the http://www.openfoamworkshop.org
but the milano workshop`s page is broken!
maybe you look through http://www.tfd.chalmers.se/~hani/kurser/OS_CFD/
seuchsy likes this.
elvis is offline   Reply With Quote

Old   March 23, 2011, 12:35
Default
  #3
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 611
Blog Entries: 5
Rep Power: 20
elvis will become famous soon enough
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import vtk

reader = vtk.vtkUnstructuredGridReader()
reader.SetFileName("/home/elvis/VTK_unstr.vtk")

filter = vtk.vtkDataSetSurfaceFilter()
filter.SetInput(reader.GetOutput())

clean = vtk.vtkCleanPolyData()
clean.SetInputConnection(filter.GetOutputPort())

triangles = vtk.vtkTriangleFilter()
triangles.SetInputConnection(clean.GetOutputPort() )

write = vtk.vtkSTLWriter()
write.SetInputConnection(triangles.GetOutputPort() )
#write.SetFileTypeToASCII()
write.SetFileTypeToBinary()
write.SetFileName("/home/elvis/STL_bin.stl")
write.Write()
mgdenno likes this.
elvis is offline   Reply With Quote

Old   March 23, 2011, 13:04
Default what mesh generator to use for huge .stl file?
  #4
New Member
 
Join Date: Mar 2011
Posts: 13
Rep Power: 11
cristina87 is on a distinguished road
Hi,

Thank you for help. I resolved with vtkGeometryFilter and it's works :P Now I have a .stl file but I don't know how to generate the mesh. I tried with Discretizer but it seems that the file is to large(I have a complex geometry there) and sometimes it blocks - even when it works I didn't find exactly the comand to generate the mesh.

I tried to install Harpoon (I read it is for complex geometries) but I don't find a version for linux x86... It is only for linux 64 bit and for windows (and in windows I don't have installed any solver and I receive an error when I try to open it).

Do you know where can I find harpoon for linux x86 or a solver for it to install on windows? Or what other mesh generator for complex geometry do you know? I tried also with engrid but it's horrible to install it on ubuntu ...

Cristina
cristina87 is offline   Reply With Quote

Old   March 24, 2011, 08:22
Default parser for vtk file to obtain blockMeshDict or vtkDealuny3D it's enough to obtain mes
  #5
New Member
 
Join Date: Mar 2011
Posts: 13
Rep Power: 11
cristina87 is on a distinguished road
Hi,

It doesn't seem to useful to have the .stl format... To obtain the mesh I still need to construct the blockMeshDict for the blockMesh utility and I really don't know how to do because I have a huge geometry with 4 buildings (and I don't know how to identify exactly the corners and the edges of the buildings only from the vtk file - there is a large list of points). If someone has already write a parser for vtk files(ubstructured grid) in order to obtain the dictionary for block mesh can please give me some clues?

Now I'm trying with Delauny3D algorithm - as I understood it generates somehow a mesh... It's good for my future simulation? (I will aply after that a solver on my mesh)

Cristina
cristina87 is offline   Reply With Quote

Old   March 25, 2011, 02:39
Default
  #6
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 611
Blog Entries: 5
Rep Power: 20
elvis will become famous soon enough
Dear Cristina,
there are some publications and discusions related to terrain meshing

http://hig.diva-portal.org/smash/get...936/FULLTEXT01
=>Modelling of wind flow over complex terrain
using OpenFoam , Xabier Pedruelo Tapia June 2009 Master’s Thesis in Energy Systems
===>Take a look at page 81 to understand what SHM makes for meshing
you have two volumes (Volume Blockmesh=Rectangle) - (Volume STL=Terrain surface)
this is your CFD-simulation-Mesh

http://www.aij.or.jp/jpn/publish/cfdguide/index_e.htm Guidebook for Practical Applications of CFD to Pedestrian Wind Environment around Buildings
http://oshima.eng.niigata-u.ac.jp/Op...ingDivided.pdf

A blockMeshDict for a rectangle (8 points) is not a big challange!

there is even a tutorial with terrain meshing

http://www.cfd-online.com/Forums/ope...-openfoam.html

elvis

Last edited by elvis; March 25, 2011 at 03:00.
elvis is offline   Reply With Quote

Old   July 26, 2014, 20:43
Default
  #7
Member
 
Kan
Join Date: Feb 2014
Location: Australia
Posts: 54
Rep Power: 8
nwpukaka is on a distinguished road
Quote:
Originally Posted by elvis View Post
Hi,

i wrote a pythonvtk script to convert unstructuredgrid vtk-files into STL-files.
If you send me your VTK-file in an email elvis-the-pelvis (at) hotmail dot de i will try to convert your vtk-file into an STL-file. I will also post my script here when i come back from work.

From the STL-file you can take several ways to get a mesh for CFD-simulations with Openfoam.
=>SnappyHexMesh (SHM) http://www.openfoam.com/docs/user/sn...#x26-1490005.4
=>Engrid
http://engits.eu/en/documentation
=>discretizer (Discretizer-Setup)
http://www.discretizer.org/node/21 (a screencast)

and lots of other ways (salome , blender, calculix)
there used to be some descriptions on the http://www.openfoamworkshop.org
but the milano workshop`s page is broken!
maybe you look through http://www.tfd.chalmers.se/~hani/kurser/OS_CFD/
Hi Elvis,

I currently have the same problem with the conversion my vtk mesh to OpenFoam, but my vtk format is xml, does your script accept this kind of format?

Cheers,
Kan
nwpukaka is offline   Reply With Quote

Old   July 28, 2014, 09:06
Default
  #8
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 611
Blog Entries: 5
Rep Power: 20
elvis will become famous soon enough
Hi,

if paraview can load/visualize your file, you should be able to write STL-file from Paraview http://www.paraview.org/Wiki/The_ParaView_Tutorial
http://www.paraview.org/Wiki/ParaView

http://www.paraview.org/Wiki/Convert...rom_PLY_to_VTP just a starter

http://www.vtk.org/doc/release/6.0/html/classes.html => http://www.vtk.org/doc/release/6.0/h...ataReader.html or what kind of Data
http://www.vtk.org/doc/release/6.0/h...STLWriter.html
elvis is offline   Reply With Quote

Old   July 19, 2019, 08:28
Default Paraview to Fluent?
  #9
Senior Member
 
vidyadhar
Join Date: Jul 2016
Posts: 133
Rep Power: 6
vidyadhar is on a distinguished road

Hello Elvis,
I have done some operations in Paraview. Now I am left with the remaining domain after these operations.
I want to take this domain back to Fluent for further analysis. I request your suggestion on which of the following is better and HOW TO ACHIEVE THEM!!!?

1) If I want to export the mesh of the remaining domain to Fluent

2) If I have to export only outer surfaces and filling the interior and then meshing before exporting to Fluent.


Thanks & Regards,
Vidyadhar

Last edited by vidyadhar; July 19, 2019 at 08:29. Reason: Adding Title
vidyadhar is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM course for beginners Jibran OpenFOAM Announcements from Other Sources 3 July 1, 2020 09:58
OpenFOAM 4.0 Released CFDFoundation OpenFOAM Announcements from OpenFOAM Foundation 2 October 6, 2017 05:40
OpenFOAM Training, London, Chicago, Munich, Houston 2016-2017 cfd.direct OpenFOAM Announcements from Other Sources 0 September 14, 2016 03:19
OpenFOAM crash at runtime when writing vtk surfaces McFly OpenFOAM Running, Solving & CFD 3 September 19, 2013 06:39
New OpenFOAM Forum Structure jola OpenFOAM 2 October 19, 2011 06:55


All times are GMT -4. The time now is 04:32.