CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Other] vtk mesh or Abaqus mesh to OpenFOAM (https://www.cfd-online.com/Forums/openfoam-meshing/65965-vtk-mesh-abaqus-mesh-openfoam.html)

bigphil July 2, 2009 05:20

vtk mesh or Abaqus mesh to OpenFOAM
 
Hi,

Does anybody know how to get a vtk mesh or an Abaqus mesh into OpenFOAM?


The reason I ask is that I was trying out the freely available meshing software IA-FEMesh:
http://www.ccad.uiowa.edu/mimx/IA-FEMesh/

IA-FEMesh lets you hex mesh complex geometries like bones. But you can only export the mesh as a '.inp' file (Abaqus) or save it as a '.vtk' mesh.

So does anybody know how I might convert these to OpenFOAM?


Thanks in advance,
Philip

Some info:
I am wanting to entirely hex mesh a bone in OpenFOAM.
snappyHexMesh works fine to produce a hex dominated mesh, with a few polyhedra, and I will probably use these meshes for my simulations.

Also, if you entirely tet mesh the bone (in Gambit for example), then you can use the 'polyDualMesh' utility to create an entirely polyhedral mesh. I will have to do some mesh analysis to see if these meshes are suitable for my simulations.

bigphil September 29, 2009 11:58

Eureka
 
Just in case someone else is trying to do the same thing, I achieved it in the following (long way around) way:
  • From IA-FEMesh, I exported the mesh in the Abaqus format
  • In Fluent 6.3.26, go File->Import->Abaqus->Input file then, once the mesh is loaded, File->write->case
  • In Gambit, this case file can be imported via File->Import->Mesh->Fluent5/6 and pick mesh type to be 3D.
  • The mesh can then be exported in the gambit neutral format '.neu'. Set solver to generic, then File->export->mesh.
  • This mesh file can then be converted in OpenFOAM using the 'gambitToFoam' command.

And there you go,
the next step is figuring out how to define patches...

Philip

makaveli_lcf September 30, 2009 05:36

Thank you, Philip, very much for your guide line!

bigphil September 30, 2009 05:47

You're welcome,

I trying out the OF-1.4 utility 'patchTool' to define patches on this imported geometry, if you come up with a better way, I'd love to know.

Best Regards,
Philip Cardiff

makaveli_lcf September 30, 2009 06:07

Philip,
do you have any ideas how to produce either STL or VTK files from FLUENT cas data or gambit mesh? I haven't check yet, if there is such export function in GAMBIT.

bigphil September 30, 2009 06:16

Dr. VAKHRUSHEV,

I am not very familiar with Fluent, in fact I only installed it for this conversion!

But as far as I know, I don't think Gambit can export STL files, although I could be wrong.

The STL files I use were generated from CT scans using Mimics, which is a program for reconstructing 3D models from CT/MRI scans.

Possibly Rhino (http://www.rhino3d.com/) might be able to create STL files from your data, but once again I am not certain.

You could check the forum for how other people do it.

Philip Cardiff

lfbarcelo October 3, 2009 03:12

Abaqus to Foam software
 
Hello, I have worked several weeks on a software that converts abaqus meshes into a gmsh mesh, which can then be converted with the command gmshToFoam that comes with the openFoam package.

After making the mesh, when you create a job in abaqus you can write the input for that job, the mesh is then written as a .inp file like 'job-1.inp' in the abaqus temp folder . This software runs in windows and takes a '.inp' file and gives a '.msh' file.

I can't upload it because it exceeds te max filesize but if anyone is interested send an E-mail to lfbarcelo@gmail.com and I will sen it to you as a .zip with all the necessary libraries to install it.

lfbarcelo October 3, 2009 03:19

This software defines patches, you only havo to asign a different bondary condition to each patch in abaqus and then you foam mesh will have different patches, you only have to name them by editing the boundary file.

noussa May 16, 2010 10:51

gambit-fortran
 
hi,
does any ones know how to export mesh from gambit into fortran.
thank a lot for your help.

bigphil May 17, 2010 04:19

Hi,

What do you mean by fortran?

Fortran is just a language, not a mesh format.

Philip

noussa May 17, 2010 15:55

hi,
I schould prepare my code with FORTRAN, I want to use a nonregular grid

, this is why it is easier to export the grid from Gambit. I want to know how

to export the grid?
thanks..

makaveli_lcf May 18, 2010 02:49

There is no general export tools from Gambit to FORTRAN:-)
I wonder is today the 1st of April???

elvis May 18, 2010 03:27

Quote:

Originally Posted by makaveli_lcf (Post 230964)
Philip,
do you have any ideas how to produce either STL or VTK files from FLUENT cas data or gambit mesh? I haven't check yet, if there is such export function in GAMBIT.

What about CGNS = "CFD General Notation System"?
This should be supported by FLUENT or GAMBIT for sure!

And OF has http://openfoamwiki.net/index.php/Si...GNS_Converters
CGNS Converters as well. Thanks to Martin Beaudoin

Then you could use foamToVtk if that is still nescessary

elvis

mobin July 11, 2010 11:09

rapid help
 
Quote:

Originally Posted by lfbarcelo (Post 231351)
Hello, I have worked several weeks on a software that converts abaqus meshes into a gmsh mesh, which can then be converted with the command gmshToFoam that comes with the openFoam package.

After making the mesh, when you create a job in abaqus you can write the input for that job, the mesh is then written as a .inp file like 'job-1.inp' in the abaqus temp folder . This software runs in windows and takes a '.inp' file and gives a '.msh' file.

I can't upload it because it exceeds te max filesize but if anyone is interested send an E-mail to lfbarcelo@gmail.com and I will sen it to you as a .zip with all the necessary libraries to install it.

hi ifbarcelo
thank you for your trying and works
i need your software and i will send my email to you please send it
thanks

Bertrand September 14, 2010 11:27

From IA-FEMesh 1.0 to FOAM without any commercial code?
 
Hello,

I am a new user of OpenFOAM, using it for my PhD. I manipulate human body structures from MRI data, mesh them, but I would like to use it in OpenFOAM to run some case. Do you know wether there is an alternative to the Fluent - Gambit commercial code of use?

Best regards,

Bertrand

bigphil September 14, 2010 12:36

Quote:

Originally Posted by Bertrand (Post 275187)
Hello,

I am a new user of OpenFOAM, using it for my PhD. I manipulate human body structures from MRI data, mesh them, but I would like to use it in OpenFOAM to run some case. Do you know wether there is an alternative to the Fluent - Gambit commercial code of use?

Best regards,

Bertrand

Hi Bertrand,

Unfortunately I have not come across any other software to convert vtk/abaqus to OpenFOAM.
You could write a program to convert them but this may be a lot of effort.

Another possible option is to use a free meshing program that tet meshes your geometry, then import to OpenFOAM and then convert this geometry into polyhedral using polyDualMesh.

Philip

Bertrand September 14, 2010 16:06

Hi Philip,

Thank you very much for your very quick answer! So I actually use ItkSnap to get a segmentation of some part of the human body, out of MRI images : I can save this mesh as .stl or .vtk format. But which free software would you advise to transfer one of those two formats to OpenFOAM? Knowing that I don't think I can use SnappyHexMesh, since I want to have a mesh inside the .stl and not outside... Or can I?

Bertrand

wyldckat September 14, 2010 19:01

Greetings to all!

Bertrand: you can use snappyHexMesh to generate a mesh inside a closed 3D STL surface... as long as that surface isn't simply flat (2D in 3D)!

Additionally, you could take a look to the surfaceMesh* utilities that provide ways to convert surface meshes between (both ways) OpenFOAM format and various others (which I'm not sure who they are :( ).

Best regards,
Bruno

elvis September 15, 2010 05:08

Hello Bertrand,

perhaps you should take a look at Mevislab http://www.mevislab.de/ to get an STL-file from your MRI Data. Of course ITK Snap does the job as well (all based on Kitware´s VTK).
After that you can use SnappyHexMesh as bruno said before, just make sure that your locationInMesh looks really on the inside of your STL. Therefore a visual aid to assure this, like it is tried in http://www.discretizer.org/files/boxdialog.jpg discretizer Setup


Of course you can take IA-FEMesh as well and convert VTK-Files into STL-Files with a short VTK-Program, I can post my python Program that converts VTK-Data to STL-files if you prefer IA-FEMesh.

elvis

calebamiles August 16, 2011 04:14

Hi Bertrand,

I don't know if this reply will still be of use to you, but the open source program enGrid can import vtk meshes and it has the ability to export directly to OpenFoam, however, I don't have any direct experience importing vtk meshes using enGrid. You can find the software at http://engits.eu/en/engrid.

Cheers,

Caleb

STutexas November 16, 2015 02:03

Quote:

Originally Posted by bigphil (Post 275202)
Hi Bertrand,

Unfortunately I have not come across any other software to convert vtk/abaqus to OpenFOAM.
You could write a program to convert them but this may be a lot of effort.

Another possible option is to use a free meshing program that tet meshes your geometry, then import to OpenFOAM and then convert this geometry into polyhedral using polyDualMesh.

Philip

Hi Philip

I was reading this post and I have a similar problem of converting CT images to OpenFoam meshes. I can generate a gmsh file but I cannot define patches for the boundaries. Please let me know if you finally found any solution to this problem.

Thank you.

Saurabh

bigphil November 16, 2015 04:39

Quote:

Originally Posted by STutexas (Post 573475)
Hi Philip

I was reading this post and I have a similar problem of converting CT images to OpenFoam meshes. I can generate a gmsh file but I cannot define patches for the boundaries. Please let me know if you finally found any solution to this problem.

Thank you.

Saurabh

Hi Saurabh,

Currently the solution we use is:
  • generate castellated surface STL from CT images using 3Dslicer;
  • smooth STL using volume preserving smoothing in meshlab;
  • open smoothed STL in ANSYS ICEM CFD meshing program: cut surface geometry into desired boundary patches;
  • create volume mesh using the STL and cfMesh OR ANSYS ICEM CFD.

As you can see we are trying to use open-source software but we still need ANSYS ICEM CFD to cut the STL into patches.

Philip

STutexas November 16, 2015 13:42

Information about meshing.
 
Hi Philip

Thank you for replying so quickly and for your advice. Could you let me know how big is the mesh file that you use or if you have ever had an issue with memory for any of the mesh files.

Thanks again for the help.

Saurabh

bigphil November 16, 2015 15:44

Quote:

Originally Posted by STutexas (Post 573588)
Hi Philip

Thank you for replying so quickly and for your advice. Could you let me know how big is the mesh file that you use or if you have ever had an issue with memory for any of the mesh files.

Thanks again for the help.

Saurabh

Hi Saurabh,

We have generated final "OpenFOAM" meshes of about 5 million cells with no problem, where the STL would be less than 100 MB; so I suppose we have not tried very big problems yet.
Depending on the final mesh density you desire, it can also be convenient to "decimate" (i.e. reduce the number of triangles) of the STL using meshlab too, after smoothing; but you should make sure that the STL resolution is still greater than the volume mesh resolution that you want.

Philip

STutexas November 16, 2015 21:59

Hi Philip

Thanks again for replying so quickly and for all your advice. It was very insightful. I was wondering if you ever looked into the use of Iso2mesh toolbox in Matlab and if you used it for meshing of 3d CT images. Thanks again for the advice.

Saurabh

bigphil November 17, 2015 09:14

Quote:

Originally Posted by STutexas (Post 573620)
Hi Philip

Thanks again for replying so quickly and for all your advice. It was very insightful. I was wondering if you ever looked into the use of Iso2mesh toolbox in Matlab and if you used it for meshing of 3d CT images. Thanks again for the advice.

Saurabh

Hi Saurabh,

No I have not tried the Iso2mesh toolbox, though it looks interesting from a quick look at the website.

As much as we would like it to be, our current procedure still requires quite a bit of manual effort and is potentially subjective. I might have a look at Iso2mesh in the future.

Best,
Philip

STutexas November 20, 2015 22:35

Improving mesh quality.
 
Hi Philip

I have been able to create a pore scale mesh using gmsh and Iso2mesh software. The mesh quality is not very good and I still can't run simulations but the process is still very simple and repeatable if you have CT image slices. Can you advice me on how to improve the mesh. Can OpenFOAM do it for me or do I have to go back to the originial image and improve my mesh. This is the error that I get when I run simulation.

Thanks again for the help.

#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3 Foam::fv::gaussGrad<double>::gradf(Foam::Geometric Field<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::word const&) at ??:?
#4 Foam::fv::gaussGrad<double>::calcGrad(Foam::Geomet ricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::word const&) const at ??:?
#5 Foam::fv::gradScheme<double>::grad(Foam::Geometric Field<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::word const&) const at ??:?

bigphil November 23, 2015 17:31

Quote:

Originally Posted by STutexas (Post 574265)
Hi Philip

I have been able to create a pore scale mesh using gmsh and Iso2mesh software. The mesh quality is not very good and I still can't run simulations but the process is still very simple and repeatable if you have CT image slices. Can you advice me on how to improve the mesh. Can OpenFOAM do it for me or do I have to go back to the originial image and improve my mesh. This is the error that I get when I run simulation.

Thanks again for the help.

#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3 Foam::fv::gaussGrad<double>::gradf(Foam::Geometric Field<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::word const&) at ??:?
#4 Foam::fv::gaussGrad<double>::calcGrad(Foam::Geomet ricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::word const&) const at ??:?
#5 Foam::fv::gradScheme<double>::grad(Foam::Geometric Field<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::word const&) const at ??:?

Hi Saurabh,

In my experience, OpenFOAM does not have tools to improve a mesh (though I think one of the foam extend dynamic tet meshers can be used to smooth a tetrahedral mesh).
The best option is probably to create a better mesh in the software that created it.

Alternatively, depending on the solver you are using, a more appropriate choice of schemes and boundary conditions might give you a result (search around the forum for similar problems).

Philip


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