Trying to convert .h5 to .mphtxt file

295 views
Skip to first unread message

Neal Richardson

unread,
Jul 2, 2013, 11:57:34 AM7/2/13
to iso2mes...@googlegroups.com
I am trying to visualize a couple minimal surfaces in the program COMSOL, which requires .mphtxt files to import. After minimizing analytic approximations of my surfaces and reading them into MATLAB as a .h5 file, I have used the isosurface function to obtain isosurface node and element lists. If i try to surf2mesh these variables, I receive the intersecting subfaces error that is well documented on your website. I have tried to follow your example and use remeshsurf to obtain an intersection free mesh and then savemphtext to put it in the desired format. When I head to open the file in COMSOL, however, the surface looks nothing like our desired image. Depending on the variable opt(having tried everything from 0.1 to 100) in remeshsurf, I get some strange figures. I am curious if there is possibly an issue in that we are trying to create a tetrahedral mesh and remeshsurf is said to "remesh a triangular surface."

If that is not the source of my troubles, I was wondering if you maybe had any insight on what it may be. 

Thank you,

Neal Richardson

Qianqian Fang

unread,
Jul 2, 2013, 12:50:51 PM7/2/13
to iso2mes...@googlegroups.com, Neal Richardson
On 07/02/2013 11:57 AM, Neal Richardson wrote:
I am trying to visualize a couple minimal surfaces in the program COMSOL, which requires .mphtxt files to import. After minimizing analytic approximations of my surfaces and reading them into MATLAB as a .h5 file, I have used the isosurface function to obtain isosurface node and element lists. If i try to surf2mesh these variables, I receive the intersecting subfaces error that is well documented on your website. I have tried to follow your example and use remeshsurf to obtain an intersection free mesh and then savemphtext to put it in the desired format. When I head to open the file in COMSOL, however, the surface looks nothing like our desired image. Depending on the variable opt(having tried everything from 0.1 to 100) in remeshsurf, I get some strange figures. I am curious if there is possibly an issue in that we are trying to create a tetrahedral mesh and remeshsurf is said to "remesh a triangular surface."

If that is not the source of my troubles, I was wondering if you maybe had any insight on what it may be.

hi Neal

did you check out the output surface after running remeshsurf?
did you run s2m() with the remeshed surface? If you have the
latest iso2mesh release (1.4.9), there is another function,
meshcheckrepair(..,'meshfix'), can repair a single closed surface.
Please try that as well. Feel free to attach figures with your
unexpected meshes.

regarding savemphtext, there has been a few discussions
in the mailing list, and there are a couple of alternatives.

Please check out the following links and see if these are
helpful. I am sure some of the early posters can help you
more on subject. If you find something I can fix in the
savemphtxt code (written by Donghyeon Kim), please
also let us know.

https://groups.google.com/d/msg/iso2mesh-users/WIVkBpGAwro/lMrZMmB2nFkJ
https://groups.google.com/forum/#!searchin/iso2mesh-users/comsol/iso2mesh-users/n0JVTS0KqUA/rsBk3QT0bzsJ
https://groups.google.com/forum/#!searchin/iso2mesh-users/mphtxt/iso2mesh-users/MfObf_5cG0c/kyrjEnr-nooJ

Qianqian


Thank you,

Neal Richardson
--
You received this message because you are subscribed to the Google Groups "iso2mesh-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iso2mesh-user...@googlegroups.com.
To post to this group, send email to iso2mes...@googlegroups.com.
Visit this group at http://groups.google.com/group/iso2mesh-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

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.

Neal Richardson

unread,
Jul 5, 2013, 12:20:00 PM7/5/13
to iso2mes...@googlegroups.com
Dr. Fang,

Thank you for your help! I have tried analyzing the different face and node lists and notice that the remeshed surface contains far less values in each list. If I try to surf2mesh my data before remeshing, I receive the intersecting subfaces error that was mentioned earlier. I obtain my incorrect meshes after s2m()ing the remeshsurfed surface and importing that into comsol.

The image I receive is the first attachment. The desired image is the second.

I know that savemphtxt is working correctly because I am able to import simple structures (cubes, spheres) into comsol without issue. I did, however, have to make one change to savemphtxt, changing the tetrahedral domain labels from 0 to 1, but I understand this is a common and well documented issue.

My only clue as to the issue is that remeshsurf calls for a triangular mesh and savemphtxt asks for a tetrahedral mesh.

Any input and advice would be greatly appreciated. Thank you,

Neal Richardson
Screen Shot 2013-07-01 at 10.03.32 AM.png
Unknown.jpeg

Qianqian Fang

unread,
Jul 5, 2013, 12:34:20 PM7/5/13
to iso2mes...@googlegroups.com, Neal Richardson
On 07/05/2013 12:20 PM, Neal Richardson wrote:
Dr. Fang,

Thank you for your help! I have tried analyzing the different face and node lists and notice that the remeshed surface contains far less values in each list. If I try to surf2mesh my data before remeshing, I receive the intersecting subfaces error that was mentioned earlier. I obtain my incorrect meshes after s2m()ing the remeshsurfed surface and importing that into comsol.

hi Neal

I assume the cross-joint structure is what you want
to mesh. Unfortunately, both remeshsurf and s2m
can not handle open surfaces (noticed the hollow
regions in the joint structure). If your intent is to
generate tetrehedral meshes for the bounded domain,
you will have to close the surface by patching the openings
to make it water-tight.

there are two things you can try:

1) if your surface can be loaded in meshlab, an
opensource mesh editor, you can use the hole-filling
feature to close the surface, then you export your mesh
and process by iso2mesh.

2) iso2mesh (s2m) accepts cell-array-like face definition:
each element in the cell array define a closed 3D polygon
which is not necessarily a triangle. In your case, if you can
find a way to convert your original input mesh into a closed
polyhedral object, and then you can directly mesh it with
s2m and bypass the remesh step. An example of this feature
can be found  in iso2mesh/sample/demo_directplc_ex1.m




The image I receive is the first attachment. The desired image is the second.

I know that savemphtxt is working correctly because I am able to import simple structures (cubes, spheres) into comsol without issue. I did, however, have to make one change to savemphtxt, changing the tetrahedral domain labels from 0 to 1, but I understand this is a common and well documented issue.

can you send me a patch if you are certain this is a bug
in savemphtxt? any link for the prior discussions on this?


Qianqiab


My only clue as to the issue is that remeshsurf calls for a triangular mesh and savemphtxt asks for a tetrahedral mesh.

Any input and advice would be greatly appreciated. Thank you,

Neal Richardson

On Tuesday, July 2, 2013 11:57:34 AM UTC-4, Neal Richardson wrote:
I am trying to visualize a couple minimal surfaces in the program COMSOL, which requires .mphtxt files to import. After minimizing analytic approximations of my surfaces and reading them into MATLAB as a .h5 file, I have used the isosurface function to obtain isosurface node and element lists. If i try to surf2mesh these variables, I receive the intersecting subfaces error that is well documented on your website. I have tried to follow your example and use remeshsurf to obtain an intersection free mesh and then savemphtext to put it in the desired format. When I head to open the file in COMSOL, however, the surface looks nothing like our desired image. Depending on the variable opt(having tried everything from 0.1 to 100) in remeshsurf, I get some strange figures. I am curious if there is possibly an issue in that we are trying to create a tetrahedral mesh and remeshsurf is said to "remesh a triangular surface."

If that is not the source of my troubles, I was wondering if you maybe had any insight on what it may be. 

Thank you,

Neal Richardson
--
You received this message because you are subscribed to the Google Groups "iso2mesh-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iso2mesh-user...@googlegroups.com.
To post to this group, send email to iso2mes...@googlegroups.com.
Visit this group at http://groups.google.com/group/iso2mesh-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Neal Richardson

unread,
Jul 17, 2013, 12:37:31 PM7/17/13
to iso2mes...@googlegroups.com
Dr. Fang,

In order to fill in the holes in my structures, I have padded the surface with ones, and therefore been able to export meshes into comsol, however, the isosurface mesh only creates a volume mesh of what it encloses. Considering I am trying to model a two-phase material, in order to test the structures in comsol, I would like to give both the isosurface-contained phase and the external phase material properties. Would it be possible to mesh the areas both inside and outside the isosurface.

I also am unable to specify the geometry once imported into comsol. This makes it impossible to define boundaries and boundary conditions, as well as enact any physics on the surface. COMSOL support seems to think that the geometry must be completely defined in the imported STL or mphtxt file. Once you import a mesh into comsol, you are unable to use the comsol geometry and mesh generators to add to the geometry. I was wondering how to construct the "complete geometry" so that we can run physical tests on the surfaces.

Thank you,

Neal Richardson

On Tuesday, July 2, 2013 11:57:34 AM UTC-4, Neal Richardson wrote:

Qianqian Fang

unread,
Jul 17, 2013, 1:20:16 PM7/17/13
to iso2mes...@googlegroups.com, Neal Richardson
On 07/17/2013 12:37 PM, Neal Richardson wrote:
Dr. Fang,

In order to fill in the holes in my structures, I have padded the surface with ones, and therefore been able to export meshes into comsol, however, the isosurface mesh only creates a volume mesh of what it encloses. Considering I am trying to model a two-phase material, in order to test the structures in comsol, I would like to give both the isosurface-contained phase and the external phase material properties. Would it be possible to mesh the areas both inside and outside the isosurface.

if I understand your question, you were asking if there is a way
to produce a mesh of multiple materials and export it to COMSOL?

if so, yes, iso2mesh can produce meshes of multiple sub-regions.
If your input volume has different labels (label 1 for a region, and
label 2 for another), iso2mesh will tag the output elements which
region it comes from. If you use method='cgalmesh' in v2m/vol2mesh,
this is done automatically by CGAL mesher; if you use v2s and then
surf2mesh, you need to specify "seeding" points for each sub-region as
the "regions" input variable. The output elem list will have a 5th
column tagging each element with its region ID.

From reading Donghyeon's savemphtxt file, it looks like the
region ID is included in the export function.


I also am unable to specify the geometry once imported into comsol. This makes it impossible to define boundaries and boundary conditions, as well as enact any physics on the surface. COMSOL support seems to think that the geometry must be completely defined in the imported STL or mphtxt file. Once you import a mesh into comsol, you are unable to use the comsol geometry and mesh generators to add to the geometry. I was wondering how to construct the "complete geometry" so that we can run physical tests on the surfaces.

let me know if you are able to produce a multiple-region mesh.

Qianqian


Thank you,

Neal Richardson

On Tuesday, July 2, 2013 11:57:34 AM UTC-4, Neal Richardson wrote:
I am trying to visualize a couple minimal surfaces in the program COMSOL, which requires .mphtxt files to import. After minimizing analytic approximations of my surfaces and reading them into MATLAB as a .h5 file, I have used the isosurface function to obtain isosurface node and element lists. If i try to surf2mesh these variables, I receive the intersecting subfaces error that is well documented on your website. I have tried to follow your example and use remeshsurf to obtain an intersection free mesh and then savemphtext to put it in the desired format. When I head to open the file in COMSOL, however, the surface looks nothing like our desired image. Depending on the variable opt(having tried everything from 0.1 to 100) in remeshsurf, I get some strange figures. I am curious if there is possibly an issue in that we are trying to create a tetrahedral mesh and remeshsurf is said to "remesh a triangular surface."

If that is not the source of my troubles, I was wondering if you maybe had any insight on what it may be. 

Thank you,

Neal Richardson
--
You received this message because you are subscribed to the Google Groups "iso2mesh-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iso2mesh-user...@googlegroups.com.
To post to this group, send email to iso2mes...@googlegroups.com.
Visit this group at http://groups.google.com/group/iso2mesh-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Neal Richardson

unread,
Jul 26, 2013, 2:44:34 PM7/26/13
to iso2mes...@googlegroups.com, Neal Richardson
Dr. Fang,

Thank you for your help, I believe I forgot to submit my follow-up response correctly. I was hoping you had a bit more insight on some geometry issues I am having. I am able to import my meshes into comsol, but the program sees my structure as one shape. COMSOL support has explained that when you import a mesh file under the mesh node it provides the mesh as well as domains, boundaries etc which you need for simulation so there is not need to create a geometry under geometry node except to provide units. This means that boundaries and domains availablity will depend on how I assemble my mesh in iso2mesh. I was wondering how to construct my mesh such that it has defined boundaries and domains when I import.

Thank you,

Neal Richardson
Reply all
Reply to author
Forward
0 new messages