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 does comsol calculate element stiffness matrice and assemble them?

Please login with a confirmed email address before reporting spam

I build a model within structured mesh, using structure mechanics module. And I have retrieved the global stiffness matrix, as well as node and mesh information, by mphxmeshinfo() and mphmeshstats() in livelink for matlab. Here is my problem. I want to attribute different elastic modulus and poisson ratio values to different elements, and it occurs to me that re-editing the global stiffness matrix (by the way, could element stiffness matrix be retrieved directly?) maybe a possible way. So I need to know how does comsol calculate element stiffness matrice and assemble them, and then programming it in livelink for matlab. I didn't find methods in COMSOL Multiphysics Reference Manual. Could anybody tell me or any suggestions? To be more specific, let's say, the second-ordered hexahedral Lagrange element.


4 Replies Last Post 29 giu 2022, 09:56 CEST
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 2 years ago 28 giu 2022, 15:30 CEST

Hello Chui,

See Henrik's answer here and mine here.

Best,

Jeff

-------------------
Jeff Hiller
Hello Chui, See Henrik's answer [here](https://www.comsol.com/forum/thread/307921/can-i-change-material-property-for-each-element-if-yes-then-how?last=2022-05-17T13:50:18Z) and mine [here](https://www.comsol.com/forum/thread/145781/gradually-change-material-parameter-s-as-a-function-of-the-domain-position?last=2017-06-12T12:38:29Z). Best, Jeff

Please login with a confirmed email address before reporting spam

Posted: 2 years ago 29 giu 2022, 03:26 CEST

Hello Chui,

See Henrik's answer here and mine here.

Best,

Jeff

Thanks for your answering. Unfortunately, values of elastic modulus and poisson ratio can not be expressed by a specific function. They are statistically related to the element location. I need to assign element mechanical properties after meshing. For better understanding and simplicity, assuming that I want to change the elastic modulus of a specific element, and now I have retrieved the global stiffness matrix, as well as node and mesh information, in livelink for matlab. What should I do next? Thanks, looking forward to your reply.

>Hello Chui, > >See Henrik's answer [here](https://www.comsol.com/forum/thread/307921/can-i-change-material-property-for-each-element-if-yes-then-how?last=2022-05-17T13:50:18Z) and mine [here](https://www.comsol.com/forum/thread/145781/gradually-change-material-parameter-s-as-a-function-of-the-domain-position?last=2017-06-12T12:38:29Z). > >Best, > >Jeff Thanks for your answering. Unfortunately, values of elastic modulus and poisson ratio can not be expressed by a specific function. They are statistically related to the element location. I need to assign element mechanical properties after meshing. For better understanding and simplicity, assuming that I want to change the elastic modulus of a specific element, and now I have retrieved the global stiffness matrix, as well as node and mesh information, in livelink for matlab. What should I do next? Thanks, looking forward to your reply.

Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 2 years ago 29 giu 2022, 08:13 CEST
Updated: 2 years ago 29 giu 2022, 08:14 CEST

Even if the material data are statistically dependent on the location, it seems easier to do it inside COMSOL multiphysics than trying to work outside.

Here are two blog posts about generating random material data:

https://www.comsol.com/blogs/how-to-generate-randomized-inhomogeneous-material-data/

https://www.comsol.com/blogs/paper-mechanics-and-the-benefits-of-modeling-paperboard-formation/

-------------------
Henrik Sönnerlind
COMSOL
Even if the material data are statistically dependent on the location, it seems easier to do it inside COMSOL multiphysics than trying to work outside. Here are two blog posts about generating random material data:

Please login with a confirmed email address before reporting spam

Posted: 2 years ago 29 giu 2022, 09:56 CEST

Henrik

Hi Henrik, thanks for your reply. The model I want to build looks like as the following picture . The gray part is material A, and the black part is material B. For all elements belong to material A, elastic moduli are spatially random distributed in the domain of material A, but their values follow some kind of statistical distribution. The same with material B. I don't think it can be fullfilled without programming, and the links you give me may not suitable for my problem. I prefer to calculate and assemble element stiffness matrice in matlab, and then replace the original matrice given by comsol. Could you give me any suggestions?

>Henrik Hi Henrik, thanks for your reply. The model I want to build looks like as the following picture ![](https://ars.els-cdn.com/content/image/1-s2.0-S0892687516300395-gr4.jpg). The gray part is material A, and the black part is material B. For all elements belong to material A, elastic moduli are spatially random distributed in the domain of material A, but their values follow some kind of statistical distribution. The same with material B. I don't think it can be fullfilled without programming, and the links you give me may not suitable for my problem. I prefer to calculate and assemble element stiffness matrice in matlab, and then replace the original matrice given by comsol. Could you give me any suggestions?

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.