Comsol mesh to openFOAM
Hello everybody!
I wanna export the meshes from Comsol multiphysics to the openfoam! Is there any straight solution for me? Thanks :o |
Quote:
COMSOL can export the mesh to text (*.mphtxt) or binary (*.mphbin) files. If you look at these files you will see they contain all mesh points and further informations concerning the elements. Maybe the element informations are usefull to tell OpenFOAM how to make cells out of them (OpenFOAM is a finite-volume-code and COMOLS is a finite-element-code). You will have to do the link between all COMSOL mesh points and the OpenFOAM mesh. Don't think of something blockMesh-stylish - look at the mesh files you will get after the mesh is created from the blockMesh. Keep in mind that OpenFOAM only supports 3D-cartesien meshes and COMSOL supports far more! |
Quote:
foam can handle any type of mesh. |
Quote:
COMSOL supports other solvers than 3D cartesian and the meshes are adapted to the solver. |
Any new information on converting from Comsol to OpenFoam?
Hello,
the reply didn't really help me so I hoped that maybe somebody can give me any good hints if it is possible to convert meshes from Comsol to OpenFoam??? Is it even possible to convert from FEM to FVM mesh? I would be really glad about any kind of hint or experiences on that topic!!!! Thanks a lot in advance! Cheers, Franzi PS: I tried to mesh also with Salome but the program isn't really stable. Any hints for a better mesher would be helpful, too :) |
Hi,
http://www.uk.comsol.com/products/formats shows that sections Mesh & MCAD is poor for export File Format Read Write NASTRAN Bulk Data (.nas, .bdf, .nastran, .dat) Yes No VRML, v1 (.vrml, .vrl) Yes No STL (.stl) Yes No STEP (.step)2 Yes No IGES (.iges)2 Yes No CATIA® V5 (.CATPart, .CATProduct)5 Yes No VRML, v1 (.vrml, .vrl) Yes No STL (.stl) Yes No It depends on what you are looking for! Opensource: engrid or http://www.discretizer.org/ |
Hey Foamers,
Have anyone of you guys succedded in importing geometry files from Comsol to OpenFOAM..... I will be doing that stuff very soon. Looking for hint and thanks in advance. Thanks Jamal |
1 Attachment(s)
Hello aujamal20,
Last year I have written a program loosly based on cfx4toFoam that can read a comsol 4.2a mphtxt or mphbin file and convert it into an Openfoam mesh. To get the boundary names you need to make a reportfile (.html) in comsol, minimum is geometry, mesh units I think ( a full report is the best thing). It can read 3D and 2D and axial meshes. There is a warning that the boundaries are all going to the default, this is not true but I did not know how to prevent this warning. The program is not finished, domains are all merged to one domain. The boundary information for the 0 directory is not yet collected. This project of mine is stopped because I do not have access to Comsol anymore, so I do not know if it works with newer Comsol versions. http://www.filedropper.com/comsoltofoamtar just unpack files in a source directory (eg OpenFOAM/user-xxx/run/applications/utilities/mesh/conversion/comsolToFoam ) run wmake. (NB. Because I did not plan to publish this I did not use the OpenFoam conventions for programming. I am very old school so part of it is c not c++ ). Hope you can use this, let me know if you can improve the program. Best regards Wouter |
Quote:
|
import COMSOL geometeries into openfoam
Quote:
Have you succeeded in importing the comsol files into openfoam? I am trying, but without any progress. Would you please give me some help? Thank you in advance. Best Regards, Bill |
Hello Bill,
As I told you it is for version 4.2b of comsol, I do not remember what version of OF (I think OF2.2.0). I still have no access to comsol anymore so I cannot update the software, but the C file will give you a start to find where it goes wrong. Best regards Wouter |
Quote:
Thank you for the reply. I will have a try on COMSOL 5.2a and OpenFOAM 3.0.1 and then I will let you know. Thank you for your hard work. Best Regards, Bill |
Bill any luck?
|
Sorry, not yet.
I am using Salome to mesh for OpenFOAM simulation. |
Well then, do you think it is possible to import a mesh from comsol to salome ?
|
hello Minisasi,
Did you try to run my program? It compiles under OF-dev. It also runs under OF-dev with a file from Comsol 4.2a. Can you send me a Comsol file .mphtxt and a report .html (preferably a simple geometry for testing). Maybe I can find out why it does not work. Hope this helps Wouter |
1 Attachment(s)
Hi Wouter, thank you for your reply,
I am actually using Comsol 5.2 and OF-2.3.1 (this might be the problem). The error I am getting is: Code:
--> FOAM FATAL IO ERROR: Thanks for your help |
Hello Minisasi,
I have reproduced the problem. Comsol has changed the structure of the meshfile. I will try to solve this. Thanks for this simple mesh. It is not so simple for OpenFoam, because it is a 2D or 2DAxi mesh, is it possible you send me a 3D mesh? Best regards Wouter |
Hi,
Yes, you are right about OF. Plus, I don't know Comsol very much, but it doesn't look to be very friendly in terms of importing/exporting mesh. I don't have a 3D test case at the moment. Let me know if you end up with a possible solution. Alternatively I can export the mesh from Comsol in .txt or .nas or .bin, but I cannot find a way to let OF reading those format. Any help is much appreciated, Thank you again for your time. |
Hello Minisasi,
The program can read the .mphtxt and the .mphbin. But there are some changes and I had some apointments so little time, work also consumes a lot of spare time:(. But I do my best. A 3D mesh would help to check the program. Maybe someone can send me a 3D mesh of a cube with 64 cells. Best regards, Wouter |
1 Attachment(s)
Hi,
Here there's a cube. Keep me posted! Thx |
1 Attachment(s)
hello Minisasi,
I am still struggling with the 2D mesh. The 3D mesh you sent me does not seem to have an internal grid so no mesh. Can you convert the attached 4.2 mesh to 5.x mesh? Thanks Wouter |
1 Attachment(s)
Hello Minisasi,
I think I made at least the 2D part work, please test the 3D part and send me an update. Or send me the 3D mesh. Hope this helps, Wouter |
Hi Wouter,
I've just seen your message. Sorry about the cube I didn't check before sending it. I'll ask my colleague (I don't have the licence) to remesh it, and I'll be back to you. Meanwhile your 2D prototype looks fine, but let me double check it with my colleague and the original mesh in comsol 5.2. Thank you so much for sharing your code |
1 Attachment(s)
Hi Wouter,
There is another cube here in Comsol 5.2. Hope it can work this time |
hello Minisasi,
Did you manage to import the old mesh I included last time? If this is a complete mesh in version 5 I need to work a lot more, because there are no prism, hex, tet or pyr defined like in version 4. And I have to create them from the faces in the program. I do not know if there is enough information to do that. Best regards, Wouter |
1 Attachment(s)
Hi,
In the attachment your cube in comsol 5.2 Hope it helps |
2 Attachment(s)
hello Minisasi,
This file works for me, it has 8 hexes. attached log and paraFoam picture. There are warnings, I do not know how to get rid of them, but the conversion works. Hope this help, Wouter |
Nice job!
Have you tried with any other 3D geometry? Do you want to share your code? |
Hello Minisasi,
I did not change anything so the code I send before should work. I cannot try any other 5.2 mesh because I do not have access to Comsol. Best regards, Wouter |
Hello Wouter,
I tried your code: comsolToFoam for the 2D geometry and it perfectly converted the Comsol mesh to OpenFOAM but when I tried to convert the 2D-axisymmetry mesh from Comsol to OpenFOAM, it converts the mesh to 2D not 2D axisymmetry. Is there any way to convert the 2D-axisymmetry from COMSOL to OpenFOAM? I will appreciate if you can help me. Regards, |
hello Eli_O,
Sorry for the late response, I was on holiday abroad. Could you send me a sample of an axi-symmetric comsol mesh, so I can see what goes wrong. Best regards, Wouter |
1 Attachment(s)
Quote:
Thanks for your attention. a sample of an axisymmetric comsol mesh is attached. In fact, I know how to convert the 2D to 2D-axi-symmetric in OpenFOAM but it will be much easier if there would be a way to convert the mesh from comsol 2D axisymmetry directly to OpenFOAM 2d-axisymmetric mesh. I am looking forward to your response. Regards, |
Hello Eli_O,
comsolToFoam expects to find a boundary called "Axial_Symmetry_1" in the html file to make it a 2D-axi mesh, if it is not there then 2D mesh. Please check if in the html file all the boundaries are reported. could you tell me what the name is of the axis, maybe phi? best regards, Wouter |
1 Attachment(s)
Quote:
Yes you are right I forgot to define axis. now, I define all the boundaries in these new files, the name of axis is axis in this html file. :) Regards, |
1 Attachment(s)
Hello Eli_O,
I am still missing some information, see the attached screen shot of the HTML file of version 4.2 I used as a long time ago. I do not know if this still is generated in the report and I do not remember what to include in the report. Please try to find out and send me the new html file. I will try to change the program that you can tell it what the symmetry axis is without the HTML file. best regards, Wouter |
1 Attachment(s)
Quote:
Sorry for the delay. Finally, I managed to have what you want. to have axis symmetry chapter a physic and a study should be added in COMSOL Please see the attached file. Regards, |
Hello Eli_O,
Are you sure you sent me the right file, because I cannot find chapter Axial Symmetry 1 best regards Wouter |
1 Attachment(s)
Quote:
Regards |
Hello Eli_O,
This file works for me with the latest comsolToFoam, in ParaFoam I can see a wedge, so what is the problem you had? Best regards, Wouter |
All times are GMT -4. The time now is 01:44. |