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   May 26, 2017, 22:22
Default
  #41
New Member
 
Elaheh
Join Date: May 2017
Posts: 8
Rep Power: 9
Eli_O is on a distinguished road
Quote:
Originally Posted by wouter View Post
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
Hello Wouter,
But the version of comsolToFoam (20170408) that I have, convert 2D-axi mesh of Comsol to 2D mesh of OpenFOAM. Could you please send me the version that you use? is it the command that you are using:
comsolToFoam FileName.mphtxt FileName.html
Regards,
Eli_O is offline   Reply With Quote

Old   May 27, 2017, 06:56
Default
  #42
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 18
wouter is on a distinguished road
Hello Eli_O,

Did you try with the latest version of the html file, because the comsoltofoam is the same version I used. The problem was with the lack of axial symmetry 1 chapter in the first html files.

Hope it works
Wouter
wouter is offline   Reply With Quote

Old   May 28, 2017, 11:58
Default
  #43
New Member
 
Elaheh
Join Date: May 2017
Posts: 8
Rep Power: 9
Eli_O is on a distinguished road
Quote:
Originally Posted by wouter View Post
Hello Eli_O,

Did you try with the latest version of the html file, because the comsoltofoam is the same version I used. The problem was with the lack of axial symmetry 1 chapter in the first html files.

Hope it works
Wouter
Hello Wouter,
yes, you are right it is working properly for the mesh I send you. actually, I work on more complicated geometry and as I told you comsolToFoam doesn't work porperly for that. So probably the problem with the complicated geometry is on Comsol mesh and I should improve it. Anyway, I really appreciate your help.
Besht regards,
Eli_O
Eli_O is offline   Reply With Quote

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

Can I have the latest version of the comsol converter you have made? I have made a mesh in comsol and need to run the case using OpenFOAM.

Thanks,
SAHM.
______________________________
Edit :
I used the file that you have posted above, and I got the following message (error?)

Using comsol version 5
noDim 2024582
not a 2024582 Mesh, cannot convert (yet?) !!!!!!

So I assume your program can't convert from Comsol 5 yet. Can you help us in getting it to work?

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

Old   June 9, 2017, 20:22
Default
  #45
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 18
wouter is on a distinguished road
Hello sahm,
If I can i will help you, but you have to send me the FileName.mphtxt FileName.html files, of the problem or a comparable one with a lot less cells. It will take less time to find the problem.

Best regards,
Wouter

noDim should be 2, or 3 so the order of values changed, did you read a binary file?

Last edited by wouter; June 9, 2017 at 20:26. Reason: extra question
wouter is offline   Reply With Quote

Old   June 9, 2017, 20:32
Default
  #46
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
Hi,

The mesh is very big (about 2-3M elements, and the file is more than 200MB). You should be able to download them from this link:
https://www.dropbox.com/sh/lwphffaux...fwNF6mRja?dl=0

I was thinking about writing a matlab program that does the conversion for openfoam.
Thank you very much.
__________________
SAHM
sahm is offline   Reply With Quote

Old   June 10, 2017, 20:59
Default
  #47
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 18
wouter is on a distinguished road
Hello sahm,
thank you for the file. It is a big one and I do not know if my program is suitable for such big files, but is is a nice testcase.
I found two strange things, first the name of the extention is .txt while it was origionaly mphtxt.
Looking in the file I noticed that the header lines are different from the files I used
Code:
# Created by COMSOL Multiphysics Mon Apr 10 16:03:04 2017 
 
 
# Major & minor version
while yours is missing the date and one line.
adding a blank line makes the program run past the first problem, but then there is a segmentation fault, so I have to dig a little deeper.

Best regards
Wouter
wouter is offline   Reply With Quote

Old   June 11, 2017, 07:53
Default
  #48
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
Hi Wouter, thanks for your help. I really like to dig your converter and work on it, maybe I will do it when I get a chance.
Based on your comments, I added the line, and now I get a segmentation fault:
Code:
"# --------- Object 0 ----------"
"
"0 0 1 "
"4 Mesh # class"
version: 4

Using comsol version 5
noDim 3
3D Mesh - OK
6 skipped 
9 skipped 
12 skipped 
15 skipped 
18 skipped 
21 skipped 
22 skipped 
20 patches found for 8 boundaries
1 = "Symmetry_1"
2 = "Wall_1"
3 = "Periodic_Flow_Condition_1"
4 = "Symmetry_1"
5 = "Wall_1"
6 = "Periodic_Flow_Condition_1"
7 = "Symmetry_1"
8 = "Wall_1"
9 = "Periodic_Flow_Condition_1"
10 = "Symmetry_1"
11 = "Wall_1"
12 = "Periodic_Flow_Condition_1"
13 = "Symmetry_1"
14 = "Wall_1"
15 = "Periodic_Flow_Condition_1"
16 = "Periodic_Flow_Condition_1"
17 = "Symmetry_1"
18 = "Periodic_Flow_Condition_1"
19 = "Periodic_Flow_Condition_1"
20 = "Symmetry_1"
Reading points
Number of points to be read: 2024582
Segmentation fault (core dumped)
__________________
SAHM
sahm is offline   Reply With Quote

Old   June 11, 2017, 08:09
Default
  #49
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
Also, I have made a coarse mesh (5 times less points, about 400K nodes) and I'm trying it. Seems like the code is working. But I don't understand why should the number of the points matter. I mean does it go out of memory?

Edit:
___________________________________________

I got this error after it read all the points: (another segmentation fault).

Code:
----+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+--

Read 487210 points.(OK)
number of element Types  4
===============================================================
reading type: "vtx"
number of Nodes per Element 1
number of Elements 80
+---------+---------+---------+---------+---------+---------+---------+---------
in comsol version 5 no parameters 
 reading 80 GeomEntityIndices
+---------+---------+---------+---------+---------+---------+---------+---------
finished reading type "vtx"
===============================================================
reading type: "edg"
number of Nodes per Element 2
number of Elements 4398
+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+--
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
+#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigSegv::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  ? at ??:?
#4  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#5  ? at ??:?
Segmentation fault (core dumped)
You can find the coarse mesh file at the same location.
__________________
SAHM
sahm is offline   Reply With Quote

Old   June 11, 2017, 19:46
Default
  #50
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 18
wouter is on a distinguished road
Hello sahm,
I changed some variables from int to long. And now it takes forever to finish, so it is working as far as I can see now, but tomorrow I know more, in the mean time I send the new file.

Best regards
Wouter

After about 5 hours the conversion finished. checkMesh gave 1 error on highaspectratio but the conversion was successfull.

hope this helps
Attached Files
File Type: gz comsolToFoam_20170611.C.tar.gz (11.0 KB, 18 views)

Last edited by wouter; June 12, 2017 at 03:02. Reason: concersion ready
wouter is offline   Reply With Quote

Old   June 11, 2017, 19:55
Default
  #51
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
Hi Wouter,

Thanks again, I am tring it on the coarse mesh first, then I will try it with the big one. You can find the coarse mesh in the same place.
__________________
SAHM
sahm is offline   Reply With Quote

Old   June 12, 2017, 07:45
Default
  #52
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
Hi Wouter,

Thanks for your help again. I just checked the finished mesh, and seems like there's a problem with the boundary conditions:

Some of the boundaries don't have any faces. For example the inlet or outles don't have any faces (number of faces is zero). Any idea why that happens?

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

Old   June 12, 2017, 16:53
Default
  #53
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 18
wouter is on a distinguished road
Hello Sahm,
I have no idea what I changed that could cause this, I am testing now without the boundary file. Because that file was already there before you sent the coarse mesh, the html file is maybe not the one that has the right boundary patches. Could you make sure the mphtxt and the html are for the same mesh.

best regards,
Wouter
There are a lot more patches and a few are empty, but the geometry looks good to me.
Attached is the checkMesh.
Attached Files
File Type: gz nobound.txt.tar.gz (2.2 KB, 5 views)

Last edited by wouter; June 12, 2017 at 19:40. Reason: The run finished
wouter is offline   Reply With Quote

Old   June 14, 2017, 03:42
Default
  #54
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
Hi Wouter,
I saved the mesh file and the report file again so that they belong to the same case, but I still get boundaries with zero faces.
This is the boundaries file:
[CODE]
10
(
Wall_1
{
type patch;
physicalType patch;
nFaces 35092;
startFace 1376848;
}
Periodic_Flow_Condition_1
{
type patch;
physicalType patch;
nFaces 960;
startFace 1411940;
}
Outlet_1
{
type patch;
physicalType patch;
nFaces 0;
startFace 1412900;
}
Inlet_1
{
type patch;
physicalType patch;
nFaces 0;
startFace 1412900;
}
Symmetry_1
{
type patch;
physicalType patch;
nFaces 4476;
startFace 1412900;
}
Periodic_Flow_Condition_2
{
type patch;
physicalType patch;
nFaces 1440;
startFace 1417376;
}
Mapped_1_(Map1)
{
type patch;
physicalType patch;
nFaces 0;
startFace 1418816;
}
Mapped_2_(Map2)
{
type patch;
physicalType patch;
nFaces 0;
startFace 1418816;
}
Mapped_3_(Map3)
{
type patch;
physicalType patch;
nFaces 0;
startFace 1418816;
}
defaultFaces
{
type patch;
nFaces 0;
startFace 1418816;
}
)
[\CODE]

You can get the files for the coarse mesh here to check your code again.
https://www.dropbox.com/sh/qkbg3zw41x13dan/AAB_5jIi_swFtop8QWtE2t4Qa?dl=0

I really appreciate your help. I am trying to understand your code so that I can help in developing it. Do you have any thing to start with?
__________________
SAHM
sahm is offline   Reply With Quote

Old   June 14, 2017, 04:00
Default
  #55
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 18
wouter is on a distinguished road
Hello sahm,
I hope my code is self-explanatory, there are comments. It consist of two parts the parsing of the html file and the parsing of the comsol mesh data,
OF structures for meshes are filled and at the end OF routines called for making the boundaries. I checked with my old files, but I could not find any errors in making the patches. Your file is too big to walk trough it, so if you could make a mesh with just a few cells with the patches. (so maybe the same geometry, but with just 100 cells). Then it is easier to check where the error occurs and why.
Could it be that the patches are seen as internal faces and therefor skipped?

best regards,
Wouter
wouter is offline   Reply With Quote

Old   June 14, 2017, 04:08
Default
  #56
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
Ok. let me try making that file and I will post a link.
Sincerely
SAHM
__________________
SAHM
sahm is offline   Reply With Quote

Old   June 14, 2017, 06:15
Default
  #57
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
You can find the simple files in the same location.

Thanks.
__________________
SAHM
sahm is offline   Reply With Quote

Old   June 14, 2017, 15:54
Default
  #58
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 18
wouter is on a distinguished road
hello sahm,
the dropbox link is not valid anymore.

Please refresh,
Best regards,
Wouter
wouter is offline   Reply With Quote

Old   June 14, 2017, 18:46
Default
  #59
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
Try this link:

https://www.dropbox.com/sh/qkbg3zw41...QWtE2t4Qa?dl=0

Thanks,
__________________
SAHM
sahm is offline   Reply With Quote

Old   June 14, 2017, 18:55
Default
  #60
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 18
wouter is on a distinguished road
Hello sahm,
I think I found the error, trying to fix it.
Downloaded the files, will work with them, thanks

Best regards,
Wouter
wouter 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 26 June 21, 2024 07:54
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 07:09
OpenFOAM course for beginners Jibran OpenFOAM Announcements from Other Sources 2 November 4, 2019 09:51
[Commercial meshers] OpenFoam Mesh to Fluent Mesh in parallel case DominicTNC OpenFOAM Meshing & Mesh Conversion 3 November 22, 2017 10:19
OpenFOAM Foundation releases OpenFOAM 2.2.2 opencfd OpenFOAM Announcements from ESI-OpenCFD 0 October 14, 2013 08:18


All times are GMT -4. The time now is 22:16.