Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

How to export mesh with material properties to MATLAB?

Please login with a confirmed email address before reporting spam

Hello all, I am trying to export my mesh to MATLAB.

With "mphmeshstats" or "mphxmeshinfo", I can only get the vertex of each node in the mesh, and the nodes in each element. But I can't relate the material properties to each element in the mesh.

Does anybody know how to relate material properties to each element in the mesh?

Thanks a lot!

Best,
Kan

2 Replies Last Post 2012年1月12日 GMT-5 02:16
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年1月12日 GMT-5 01:55
Hi

I suppose that is because in COMSOL the mesh as the physics are related to the geometry Entities, , but in-between the mesh and the physics you still have the shape functions, so you do not have the direct link physics <-> mesh

Probably you need to do some mapping, coming from "classical FEM" it took me some time to understand, and accept, this difference, it's a cleaner math <-> physics separation than the old way, but when you want to exchange data with other programmes it makes life tougher. Since then I have given up trying to work with classical way

--
Good luck
Ivar
Hi I suppose that is because in COMSOL the mesh as the physics are related to the geometry Entities, , but in-between the mesh and the physics you still have the shape functions, so you do not have the direct link physics mesh Probably you need to do some mapping, coming from "classical FEM" it took me some time to understand, and accept, this difference, it's a cleaner math physics separation than the old way, but when you want to exchange data with other programmes it makes life tougher. Since then I have given up trying to work with classical way -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年1月12日 GMT-5 02:16
Thank you Ivar!

What do you mean by "in-between the mesh and the physics you still have the shape functions"? I don't get it. I need to know the material related to each element. I don't understand why you involved shape function. The material property (e.g. thermal conductivity) relates to the assembly process, specifically speaking, element-level local stiffness matrix. You time the thermal conductivity with the derivatives of shape function and do the integral. Right?

After digging the COMSOL Java API, I found that I can use

[stats,data]=mphmeshstats(model, 'mesh1');
entity=data.elementity{2}; % elementity{2} is triangular element

Then "entity" contains the "Domain" each element belongs to.

Then I can relate material properties to each domain by using information from
model.material.selection.dom

Problem solved anyway, maybe in a stupid way.

Thanks again.

Best,
Kan
Thank you Ivar! What do you mean by "in-between the mesh and the physics you still have the shape functions"? I don't get it. I need to know the material related to each element. I don't understand why you involved shape function. The material property (e.g. thermal conductivity) relates to the assembly process, specifically speaking, element-level local stiffness matrix. You time the thermal conductivity with the derivatives of shape function and do the integral. Right? After digging the COMSOL Java API, I found that I can use [stats,data]=mphmeshstats(model, 'mesh1'); entity=data.elementity{2}; % elementity{2} is triangular element Then "entity" contains the "Domain" each element belongs to. Then I can relate material properties to each domain by using information from model.material.selection.dom Problem solved anyway, maybe in a stupid way. Thanks again. Best, Kan

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.