Discussion Forum

How to export mesh with material properties to MATLAB?

Topics: 4.0, 4.0a, LiveLinks, 4.1, 4.2

Thread index  |  Previous thread  |  Next thread  |  Start a new discussion

RSS FeedRSS feed   |   Email notificationsTurn on email notifications   |   2 Replies   Last post: January 12, 2012 7:16am UTC
Zach

Zach

January 12, 2012 5:58am UTC

How to export mesh with material properties to MATLAB?

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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

January 12, 2012 6:55am UTC in response to Zach

Re: How to export mesh with material properties to MATLAB?

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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Zach

Zach

January 12, 2012 7:16am UTC in response to Ivar Kjelberg

Re: How to export mesh with material properties to MATLAB?

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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse


Rules and guidelines