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

[Commercial meshers] Comsol mesh to openFOAM

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 15, 2017, 02:02
Default
  #61
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 17
wouter is on a distinguished road
Hello sahm,
I think I fixed the problem, please check. It is a quick fix, so I will be improving on the performance.
Map1,map2 and map3 are still empty, I think that is ok.

Hope this helps
Wouter
Attached Files
File Type: zip comsolToFoam_20170615.C.zip (11.1 KB, 73 views)
wouter is offline   Reply With Quote

Old   June 15, 2017, 07:04
Default
  #62
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 16
sahm is on a distinguished road
Hello Wouter

I am getting an error that says Killed! don't know what's happening.

Code:
+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+--
in comsol version 5 no parameters 
 reading 4398 GeomEntityIndices
+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+--
finished reading type "edg"
===============================================================
reading type: "quad"
number of Nodes per Element 4
number of Elements 79432
+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
in comsol version 5 no parameters 
 reading 79432 GeomEntityIndices
+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
finished reading type "quad"
===============================================================
reading type: "hex"
number of Nodes per Element 8
number of Elements 465944
+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
in comsol version 5 no parameters 
 reading 465944 GeomEntityIndices
+---------+---------+---------+---------+---------+---------+-----Killed
Could you please try running the case with the coarse mesh file? Thanks.
__________________
SAHM
sahm is offline   Reply With Quote

Old   June 15, 2017, 14:08
Default
  #63
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 17
wouter is on a distinguished road
Hello Sahm,
attached the run of comsolToFoam on the coarse mesh. For me it gives a result.
I had to delete a number of lines because the file was too large.
comsolToFoam Tunnel_coarse.mphtxt report1.html
checkMesh is attached as well
Killed is not something from my program
Hope this helps
wouter
Attached Files
File Type: zip comsolToFoam_shortened.log.zip (4.0 KB, 46 views)
wouter is offline   Reply With Quote

Old   June 15, 2017, 14:43
Default
  #64
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 16
sahm is on a distinguished road
Hi Wouter,

Could you tell me how you ran the code? I mean you say you deleted some lines, which lines were deleted? I am trying to run the code again (after a restart to clean the memory)

Thanks,
SAHM.
__________________
SAHM
sahm is offline   Reply With Quote

Old   June 15, 2017, 14:54
Default
  #65
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 17
wouter is on a distinguished road
Hello Sahm,
the command is in the previous mail

comsolToFoam Tunnel_coarse.mphtxt report1.html >comsolToFoam.log
checkMesh >> comsolToFoam.log

The lines I deleted were in the log file, if you open it, it says:
:
: lines deleted
:

hope his helps
Wouter
wouter is offline   Reply With Quote

Old   June 15, 2017, 14:59
Default
  #66
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 16
sahm is on a distinguished road
OK, I noticed it now. I thought you deleted some lines from the comsol mesh file.
I will see what happens.

Thanks for your help. I hope your code helps others as well.
__________________
SAHM
sahm is offline   Reply With Quote

Old   June 15, 2017, 15:06
Default
  #67
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 17
wouter is on a distinguished road
Hello Sahm,
just run the simple version: attached a picture from parafoam

Best regards,
Wouter
Attached Images
File Type: jpg picture.jpg (34.8 KB, 67 views)
wouter is offline   Reply With Quote

Old   June 16, 2017, 17:15
Thumbs up It's working!
  #68
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 16
sahm is on a distinguished road
Hi Wouter,

Thanks a lot for your help, after some manual editing it seems like the case is working finally.

Here are the troubles I ran into while I was trying to make my case work:
  1. The internal faces that were defined as a boundary (inside the boundary file), I had to delete them.
  2. I had two periodic boundaries in the Comsol File. Inside Comsol I had to define them as one boundary condition which included both faces. But for OpenFOAM, I have to have them separate and define them as cyclic boundary conditions. I did that, but the program gave an error that the connected faces should have similar areas, which means the numbering order of the faces did not match, so I used cyclicAMI boundary condition.
  3. CyclicAMI also requires similar areas or bounding boxes for both boundaries. I noticed a problem that one of the boundaries were starting from a value like -9.98987e-15. This value basically should be zero. I opened up the points file and noticed that there are many points that had their coordinates as w.xyz e-15 and all these numbers should be zero. Don't know if comsol has generated such numbers or the conversion has created them (I guess it's comsol), but I had to manually set them all to zero.
After working on the U and P files seems like icofoam is working which means the case will work for other solvers as well. I might have to use parallel computing though since my mesh is too big.

Again, thanks for your help.
__________________
SAHM
sahm is offline   Reply With Quote

Old   June 16, 2017, 18:54
Default
  #69
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 17
wouter is on a distinguished road
Hello Sahm,
Thanks for the feedback, I will put this in my source file, so it won't get lost.
I do not think I can change anything in my program to improve on these points, they are all in comsol.
I can check the cyclic boundary condition in openFoam from a periodic boundary in comsol, I never used them so I do not know if I succeed.

Best regards,
Wouter
wouter is offline   Reply With Quote

Old   January 11, 2021, 02:08
Default Help!
  #70
New Member
 
Mario
Join Date: Apr 2020
Posts: 3
Rep Power: 6
mariofcordova is on a distinguished road
Hello foamers,

I have tried to convert my comsol file in OpenFoam mesh but I am not sure how to source the code. I tried to source it but a weird error appear.

Here it is:

"make: *** No rule to make target 'Make/linux64GccDPInt32Opt/comsolToFoam8.C.dep', needed by 'Make/linux64GccDPInt32Opt/comsolToFoam8.o'. Stop."

In addition, a folder called "linux64GccDPInt32Opt" is created. I will appreciate a lot if you can help me to solve this issue.

Regards
Mario
mariofcordova is offline   Reply With Quote

Old   January 12, 2021, 18:15
Default
  #71
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 17
wouter is on a distinguished road
hello Mari,
It is a long time ago. Did you download the make directory?

Did you run wmake?
maybe you have to edit the files to reflect the latest c file

look at the complete thread for more information.
Please note that this is for an old version of OF and Comsol



Hope this helps
Regards,
Wouter
wouter is offline   Reply With Quote

Old   May 22, 2022, 04:33
Thumbs up
  #72
New Member
 
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4
zyliao is on a distinguished road
Quote:
Originally Posted by wouter View Post
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
Hi Wouter,

I wonder if you have updated your program so that it can suitable for comsol 6.0 & OpenFOAM 6.0?
Thank you!
zyliao is offline   Reply With Quote

Old   May 23, 2022, 17:26
Default
  #73
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 17
wouter is on a distinguished road
hello zyliao,
As said in the post I do not have access to Comsol anymore, so no updates


best
Wouter
wouter is offline   Reply With Quote

Old   June 1, 2022, 12:47
Default
  #74
New Member
 
Ali Can
Join Date: Apr 2021
Posts: 28
Rep Power: 5
Ryuzaki is on a distinguished road
hello dear foamers,
Is there any way to convert comsol mesh to openfoam?
Ryuzaki is offline   Reply With Quote

Reply


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
Getting Started with OpenFOAM wyldckat OpenFOAM 25 August 14, 2022 13:55
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 06:09
OpenFOAM course for beginners Jibran OpenFOAM Announcements from Other Sources 2 November 4, 2019 08:51
[Commercial meshers] OpenFoam Mesh to Fluent Mesh in parallel case DominicTNC OpenFOAM Meshing & Mesh Conversion 3 November 22, 2017 09:19
OpenFOAM Foundation releases OpenFOAM 2.2.2 opencfd OpenFOAM Announcements from ESI-OpenCFD 0 October 14, 2013 07:18


All times are GMT -4. The time now is 19:41.