Exporting mesh generated by iso2mesh to COMSOL and simulating fluid flow

672 views
Skip to first unread message

SNorouzi

unread,
Jan 16, 2013, 12:08:07 AM1/16/13
to iso2mes...@googlegroups.com
Hello everyone,

First of all I need to thank Dr. Fang for developing magnificent iso2mesh toolbox. It helped me too much.
I was wondering if anyone has experience with COMSOL software (As I realized most of group members are
working with FLUENT for their simulations)?
For some reasons I am using COMSOL to simulate coupled free and porous medium flow. I have a segmented
image of a sphere pack (200*200*200), It was meshed by iso2mesh (one snapshot attached) and exported to COMSOL as .mphtxt (thanks to Donghyeon Kim for his script).
I encountered some difficulties in assigning boundary conditions in COMSOL and need help!

Sorry if it is off topic, but i was thinking here I could get some help.

Any input is highly appreciated.
Regards,
Saeid
mesh.png

Qianqian Fang

unread,
Feb 7, 2013, 1:46:05 PM2/7/13
to iso2mes...@googlegroups.com, SNorouzi
in the latest release, you can find a function, savemphtxt(),
contributed by Donghyeon Kim, with this function, you should
be able to export iso2mesh meshes to use in COMSOL.

You can find the related discussions in this thread:

https://groups.google.com/group/iso2mesh-users/browse_thread/thread/9f42554d2d0aa940/f54d08c6cf8cff60?hl=en&lnk=gst&q=comsol#f54d08c6cf8cff60

Qianqian


Any input is highly appreciated.
Regards,
Saeid
--
You received this message because you are subscribed to the Google Groups "iso2mesh-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/iso2mesh-users/-/6OJ_ZA-TmNIJ.
To post to this group, send email to iso2mes...@googlegroups.com.
To unsubscribe from this group, send email to iso2mesh-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/iso2mesh-users?hl=en.

The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

SNorouzi

unread,
Feb 7, 2013, 8:24:24 PM2/7/13
to iso2mes...@googlegroups.com, SNorouzi
Dear Dr. Fang,

Thanks for your reply,
I had seen this thread before. Since I didn't have Matlab Livelink I did not use the function "savemesh2comsol.m" written by Sanket Jain and instead i used another function written by Kim (called savemphtxt.m). Basically COMSOL tries to generate a geometry from imported mesh and let you select the boundaries or domains. However in my case when I export my mesh to COMSOL, COMSOL recognize it as a mesh but can not make  a geometry out of it and as a result I can not select any boundary to assign conditions on it.
I tried a commercial software called Simpleware and generated mesh and exported to COMSOL. In this case COMSOL was happy and I could select boundaries.
If you find a way to get around this problem in iso2mesh, please let me know.

Thanks and regards,

SNorouzi

unread,
May 24, 2013, 2:54:04 PM5/24/13
to iso2mes...@googlegroups.com, SNorouzi
Dear Yvonka,

Thanks for your reply. Of course it is not late and I really appreciate your help.

Best regards,
saeid

On Friday, May 24, 2013 5:03:51 PM UTC+2, j.h.v...@student.tue.nl wrote:
Dear SNorouzi,

Perhaps this reply is a bit late, but I was having the exact same problem you were having and I found a solution, whi
ch, in the end, was disappointingly simple, so I decided to give you the solution I found anyway.

The problem I was experiencing when using savemphtxt.m was that I could import the mesh into comsol nicely, and it would show it, but it would not recognise it in the geometry as a domain, so I could add no source
or material or anything to my object. I didn't want to use a commercial solution, so I took a look at the code of savemphtxt, and I found the error.

At some point in the code you will find these lines:


for i = 1:n_face
    fprintf(fp,'0 0\n');
end

Here the up/down information of the mesh is printed, but for comsol 4.3a at least this is not correct. Change this to the following:

for i = 1:n_face
    fprintf(fp,'0 1\n');
end


This resolved the problem for me, and I could add a source to the domain and a material and comsol was happy as a clam.


I hope this helps some other people with the same problems. Respect for iso2mesh, I really love the package!

Yvonka


Op vrijdag 8 februari 2013 02:24:24 UTC+1 schreef SNorouzi het volgende:
Reply all
Reply to author
Forward
Message has been deleted
0 new messages