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

[Salome] Script for converting a mesh from Salome-Platform to OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Like Tree33Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 14, 2016, 16:02
Default
  #61
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi Bill,

Sorry for not getting back to you sooner but I have been busy with other things.
I'm glad to hear that you found the script useful.
I must confess that I don't really understand the problem. As you marked there where 0 cells, did you miss to add 3D algorithm and only meshed the surfaces?

Best Regards
Nicolas
6863523 likes this.
nsf is offline   Reply With Quote

Old   December 15, 2016, 02:15
Smile 3d algorithm in Salome
  #62
Senior Member
 
Bill Wang
Join Date: Aug 2014
Posts: 109
Rep Power: 11
6863523 is on a distinguished road
Quote:
Originally Posted by nsf View Post
Hi Bill,

Sorry for not getting back to you sooner but I have been busy with other things.
I'm glad to hear that you found the script useful.
I must confess that I don't really understand the problem. As you marked there where 0 cells, did you miss to add 3D algorithm and only meshed the surfaces?

Best Regards
Nicolas
Hi Nicolas,
Sorry for the confusion.
Exactly! I missed to add 3D algorithm, as I thought I wanted to draw 2D geometry and there was no need.
BTW: Even though there is no problem of internal faces, but I do not understand why they disappear, if I add the 3D algorithm.
Sorry if the question is too simple, but I do not even know Salome one week ago. All I used before were Gambit, ICEM, etc. As in Gambit, I could draw the 2D geometry directly.
Thank you again for the script, it really really saves me a lot of time!!!
Cheers,
Bill
6863523 is offline   Reply With Quote

Old   December 15, 2016, 04:34
Default
  #63
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi,

Only faces which are in groups are kept as openfoam patches. If you need baffles then you need to create a group of faces on the mesh.

I've included several sample scripts. At least one of them defines internal baffles. Either read the code or run them and study the layout and I think you'll understand how to set up baffles.

Best regards
Nicolas
6863523 likes this.
nsf is offline   Reply With Quote

Old   December 15, 2016, 05:02
Smile
  #64
Senior Member
 
Bill Wang
Join Date: Aug 2014
Posts: 109
Rep Power: 11
6863523 is on a distinguished road
Quote:
Originally Posted by nsf View Post
Hi,

Only faces which are in groups are kept as openfoam patches. If you need baffles then you need to create a group of faces on the mesh.

I've included several sample scripts. At least one of them defines internal baffles. Either read the code or run them and study the layout and I think you'll understand how to set up baffles.

Best regards
Nicolas
Dear Nicolas,
Thank you for your kind reply. I will try and if I found something new, I will post here.
Have a good day.
Best Regards,
Bill
6863523 is offline   Reply With Quote

Old   December 24, 2016, 12:45
Default
  #65
New Member
 
Thodoris
Join Date: Apr 2016
Location: Greece
Posts: 26
Rep Power: 10
teodm is on a distinguished road
Hi Nicholas,
I succesfully export the mesh in OpenFOAM by using your script but when i checkMesh i have the following error-
-> FOAM FATAL ERROR:
"/home/thodoris/OpenFOAM/thodoris-4.1/run/wings3/system/blockMeshDict"


From function int main(int, char**)
in file blockMesh.C at line 149.

FOAM exiting
teodm is offline   Reply With Quote

Old   December 25, 2016, 11:33
Default
  #66
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi Thodoris,

From the error it looks like you ran blockMesh rather than checkMesh blockMesh is another mesh generator which you don't need to run after you've exported a mesh from Salome.

If you are new to OpenFoam be sure to go through the basics tutorials at OpenFoam.org and then follow some found on Google.

Good luck and merry Christmas!

Nicolas
nsf is offline   Reply With Quote

Old   December 25, 2016, 12:28
Default
  #67
New Member
 
Thodoris
Join Date: Apr 2016
Location: Greece
Posts: 26
Rep Power: 10
teodm is on a distinguished road
Excuse me, i pasted the wrong error.Here is the error when i checkMesh.Thank you very much in advance.Merry Christmas!!
--> FOAM FATAL IO ERROR:
Expected a ')' or a '}' while reading List, found on line 6847 the label 3

file: /home/thodoris/OpenFOAM/thodoris-4.1/run/wings3/constant/polyMesh/faces at line 6847.

From function char Foam::Istream::readEndList(const char*)
in file db/IOstreams/IOstreams/Istream.C at line 155.

FOAM exiting
teodm is offline   Reply With Quote

Old   December 25, 2016, 13:33
Default
  #68
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
I really can't say just from the error message. Was there any problems while creating the mesh in Salome? Have you made sure you have a valid 3D mesh in Salome. If so please post your hdf file and I might have time to have a look.

But keep in mind that you only need my script if you have pyramids in the mesh. Otherwise you can export using ideas in format.

Best regards
Nicolas
nsf is offline   Reply With Quote

Old   February 2, 2017, 03:34
Default
  #69
Senior Member
 
Bill Wang
Join Date: Aug 2014
Posts: 109
Rep Power: 11
6863523 is on a distinguished road
Quote:
Originally Posted by nsf View Post
I really can't say just from the error message. Was there any problems while creating the mesh in Salome? Have you made sure you have a valid 3D mesh in Salome. If so please post your hdf file and I might have time to have a look.

But keep in mind that you only need my script if you have pyramids in the mesh. Otherwise you can export using ideas in format.

Best regards
Nicolas
Dear Nicolas,
When you mentioned the 'pyramids in the mesh', could you please specify the algorithms in Salome.
Attached is the algorithms that I have used and there is no problem of exporting the mesh with your script.

In addition, I am trying to export about 2 million meshes, it seems that it will cost a huge memory (around 200G), and it costs me more than three days without finishing. I have read previous posts, but I am still not so sure if it is normal.

Thank in advance.
Best Regards,
Bill
Attached Images
File Type: png algorithm.png (3.5 KB, 25 views)
6863523 is offline   Reply With Quote

Old   February 6, 2017, 17:03
Default
  #70
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Hi Bill,

Sorry for the late reply. One way to generate pyramids would be to mesh (3D) with quads on the surface and tetras in the bulk.

In your case I would try to export the mesh to UNV then run ideasUNVToFoam. It should be faster.
Best regards
Nicolas
6863523 likes this.
nsf is offline   Reply With Quote

Old   February 7, 2017, 02:43
Smile
  #71
Senior Member
 
Bill Wang
Join Date: Aug 2014
Posts: 109
Rep Power: 11
6863523 is on a distinguished road
Quote:
Originally Posted by nsf View Post
Hi Bill,

Sorry for the late reply. One way to generate pyramids would be to mesh (3D) with quads on the surface and tetras in the bulk.

In your case I would try to export the mesh to UNV then run ideasUNVToFoam. It should be faster.
Best regards
Nicolas
Dear Nicolas,
Thank you very much for your kind reply and suggestions.
I will try it.
Thanks again for your great work, the script help me a lot while exporting the mesh in my previous test.
Have a good day.
Best Regards,
Bill
6863523 is offline   Reply With Quote

Old   June 5, 2019, 03:18
Default fork for Salome 9.3
  #72
New Member
 
Enrico Segre
Join Date: Nov 2018
Posts: 8
Rep Power: 8
Enrico Segre is on a distinguished road
Pinging in, just to report that I have forked Nicolas' project, to bring it up and running in Salome 9.3.0. That includes the latest salomeToOpenFoam.py by github user meritzio, and a revamp of salomeToOpenFoam_GUI.py by psicofil.

The fork is at https://github.com/EastEriq/salomeToOpenFOAM.

I would also have posted on the Salome forum thread, but I don't understand how to sign up there.

Hope this saves time to someone, like it does to me after patching. In my workflow this is becoming a necessary tool, as I have a wedge case whose meshing invariably produces some pyramids.

Enrico Segre is offline   Reply With Quote

Old   June 24, 2019, 19:11
Default
  #73
Senior Member
 
Bernhard Linseisen
Join Date: May 2010
Location: Heilbronn
Posts: 183
Blog Entries: 1
Rep Power: 15
Linse is on a distinguished road
Thank you very much, Enrico! Indeed at the moment I am firing up my simulation (and therefore also my meshing) activities again and was unhappily surprised that Nicolas' script did not work for Salome 9.3.


I will put that information into the salome forum for you.


Nevertheless I wonder how Nicolas is doing, so a small shoutout from that side would be nice! ;-)
Linse is offline   Reply With Quote

Old   June 25, 2019, 15:44
Default
  #74
nsf
Senior Member
 
Nicolas Edh
Join Date: Mar 2010
Location: Uppsala, Sweden
Posts: 123
Rep Power: 18
nsf is on a distinguished road
Quote:
Originally Posted by Linse View Post
Thank you very much, Enrico! Indeed at the moment I am firing up my simulation (and therefore also my meshing) activities again and was unhappily surprised that Nicolas' script did not work for Salome 9.3.


I will put that information into the salome forum for you.


Nevertheless I wonder how Nicolas is doing, so a small shoutout from that side would be nice! ;-)
Hi all!

I'm really glad to see that salomeToOpenFoam is still used and being developed!

I was on vacation when Enrico gave the merge request and then I completely forgot. Personally I've changed my work flow. I much prefer to use Salome for geometry and surface mesh but then I use snappyHexMesh for the 3D mesh. I haven't used my script in quite a while. Mostly because it is (was?) quite slow for medium to large sized meshes. As I recall more than 1milion cells takes longer time to convert than to generate.

I will merge Enrico's changes but won't have time to test everything properly.

Best regards
Nicolas
nsf is offline   Reply With Quote

Old   April 19, 2020, 00:17
Default Help needed to convert
  #75
New Member
 
Prabal
Join Date: Oct 2010
Posts: 3
Rep Power: 15
c_prabal is on a distinguished road
salomeToOpenFOAM_GUI

Help needed to convert this excellent code to python 3. It is not running for Salome 9.4.

could you please send this to me at c_prabal@yahoo.com

Regards,
c_prabal is offline   Reply With Quote

Old   April 19, 2020, 13:42
Default
  #76
Member
 
pici's Avatar
 
Pierluigi Cirrottola
Join Date: Jun 2013
Posts: 52
Rep Power: 12
pici is on a distinguished road
hi Prabal,
I think your question should have already resolved.
Please, have a look at Enrico Segre post, "fork for Salome 9.3", dated June 5, 2019, 09:18
pici is offline   Reply With Quote

Old   August 18, 2020, 05:36
Default
  #77
New Member
 
Frédéric MR
Join Date: Jun 2019
Posts: 18
Rep Power: 6
FM_Stiral is on a distinguished road
Hello everybody,


I am using the SalomeToFoam script (very useful). However, I am facing a problem with some parts of my mesh (especially the two tubes) (see the python script in attached for the salome case generation), it seems there is an index problem but I don't know how to solve it (except for the tube_amont, I have merged nodes, and it fixed the problem (I don't really know why there is nodes to be merged) but for the tube, merge nodes or element does not solve the problem).


Just for information, the mesh Maillage is the concatenation of the different meshes (the only one I want to export).



See below a message I have from the salome console after trying to export tube mesh with SalomeToFoam script

______________________________________________

Number of nodes: 1577189


Number of cells: 1125653


Counting number of faces:


total number of faces: 2282465, internal: 2236767, external 45698


Converting mesh to OpenFOAM


Warning, some elements don't have a group (BC). Adding to a new group called defaultPatches


Finished processing boundary faces


Traceback (most recent call last):
File "<input>", line 1, in <module>
File "<string>", line 666, in <module>
File "<string>", line 661, in main
File "<string>", line 286, in exportToFoam
IndexError: list assignment index out of range


____________________________________________


Thank you for your time and consideration.


FM

p, li { white-space: pre-wrap; }
Attached Files
File Type: zip script.zip (2.3 KB, 9 views)
FM_Stiral is offline   Reply With Quote

Old   August 21, 2020, 09:56
Default
  #78
New Member
 
Gerhard
Join Date: Mar 2017
Posts: 26
Rep Power: 9
Gerhard is on a distinguished road
Thank you for sharing your script, Nicolas.
It is really going to make my life easier.


Just sharing my experience if someone else have similar issues:
I found that the salomeToOpenFOAM.py script did not work for me in Salome V.9.4.
After reverting to Salome V.8.4, it worked like a charm.


All the best.
Gerhard is offline   Reply With Quote

Old   August 24, 2020, 09:47
Default
  #79
New Member
 
Frédéric MR
Join Date: Jun 2019
Posts: 18
Rep Power: 6
FM_Stiral is on a distinguished road
Quote:
Originally Posted by Gerhard View Post
Thank you for sharing your script, Nicolas.
It is really going to make my life easier.


Just sharing my experience if someone else have similar issues:
I found that the salomeToOpenFOAM.py script did not work for me in Salome V.9.4.
After reverting to Salome V.8.4, it worked like a charm.


All the best.

Hello Gerhard,



I tested to run the SalomeToFoam.py script in V8.4 of Salome, but I experienced the same issue. It seems to be a problem due to the add of a submesh to a netgen_3D algorithm, but not able to determine it.
If anyone with some Salome/Python skill could help, it would be very nice !
FM_Stiral is offline   Reply With Quote

Old   August 25, 2020, 04:41
Default
  #80
New Member
 
Gerhard
Join Date: Mar 2017
Posts: 26
Rep Power: 9
Gerhard is on a distinguished road
Hi Frédéric,


I also used a Netgen 3D algorithm with some sub-meshes applied to it. However, in my case it exported the mesh successfully.
Maybe your specific Netgen-submesh combination is giving the script a touch time.


Perhaps I should mention that I am running Ubuntu 18.04 LTS and I used the "Universal binaries for Linux" Salome version 8.4.0 installation files. Anaconda is responsible for handling python stuff on my computer.


Sorry I cannot help further than that at this stage.
Good luck.
Gerhard is offline   Reply With Quote

Reply

Tags
mesh conversion, openfoam, salome meca


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
[Salome] how to setFields in openFOAM when you have imported mesh from salome or other package 13msmemusman OpenFOAM Meshing & Mesh Conversion 11 May 18, 2022 07:30
[Salome] import mesh from salome to openfoam dome90 OpenFOAM Meshing & Mesh Conversion 2 April 20, 2016 23:58
[Salome] Step to export mesh from SALOME to OpenFoam for 3D MRF geometry aminem OpenFOAM Meshing & Mesh Conversion 0 September 16, 2014 10:18
[Salome] Mesh Salome 7.3.0 to OpenFoam Ahadi OpenFOAM Meshing & Mesh Conversion 5 July 1, 2014 10:11
Mesh conversion problem from Salome to openfoam jishnusoni OpenFOAM 15 March 3, 2010 01:53


All times are GMT -4. The time now is 21:08.