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.

Extracting element-level sensitivities for Topology Optimization in LiveLink

Hendrik Mechanical Engineering

Please login with a confirmed email address before reporting spam

Hi all,

For our optimization problem we want to use MATLAB to run MMA and compute the objective function , constraints and sensitivities ( for an objective that is not supported by COMSOL ).

Extracting the global stiffness matrix, load vector and element volumes (for objective function and constraint values) is working fine.

However, computing the sensitivity of any objective function requires the element-level stiffness matrices , because the density variables act on those individual matrices.

Would anyone know how to extract these element matrices ? or a workaround for computing objective function sensitivity in MATLAB? (first we implement a compliance minimization problem to see if the method works).

Thanks in advance!


9 Replies Last Post Jul 27, 2023, 3:46 a.m. EDT
Kristian Ejlebjærg Jensen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 months ago Jul 18, 2023, 2:47 a.m. EDT

Hi Kaap H.

It might be possible to solve it directly in the GUI without any coding. Can you explain the problem you are trying to solve?

Best regards,

Kristian E. Jensen

Technical Product Manager, Optimization

Hi Kaap H. It might be possible to solve it directly in the GUI without any coding. Can you explain the problem you are trying to solve? Best regards, Kristian E. Jensen Technical Product Manager, Optimization

Hendrik Mechanical Engineering

Please login with a confirmed email address before reporting spam

Posted: 9 months ago Jul 18, 2023, 5:06 a.m. EDT
Updated: 9 months ago Jul 18, 2023, 8:13 a.m. EDT

We are trying to optimize the tensile energy present in a prestressed structure. (using plate elements and topology optimization).

The objective function is the ratio of the geometric stiffness matrix (G) and the "standard" stiffness matrix (K), pre and post multiplied by the eigenmodes (x), so x'Gx/x'Kx

As far as I am aware, COMSOL does not support topology optimization for frequency-related problems, nor custom objective functions such as these.

For the sensitivity analysis, the element-wise matrices would be required

We are trying to optimize the tensile energy present in a prestressed structure. (using plate elements and topology optimization). The objective function is the ratio of the geometric stiffness matrix (G) and the "standard" stiffness matrix (K), pre and post multiplied by the eigenmodes (x), so x'Gx/x'Kx As far as I am aware, COMSOL does not support topology optimization for frequency-related problems, nor custom objective functions such as these. For the sensitivity analysis, the element-wise matrices would be required

Hendrik Mechanical Engineering

Please login with a confirmed email address before reporting spam

Posted: 9 months ago Jul 19, 2023, 4:19 a.m. EDT

I believe this problem is definitely manageable if one is able to extract the element level matrices for sensitivity analysis, or implement a custom function for the sensitivity in COMSOL itself.

As far as I understand it right now, it is not possible?

Looking forward to your reply,

I believe this problem is definitely manageable if one is able to extract the element level matrices for sensitivity analysis, or implement a custom function for the sensitivity in COMSOL itself. As far as I understand it right now, it is not possible? Looking forward to your reply,

Hendrik Mechanical Engineering

Please login with a confirmed email address before reporting spam

Posted: 9 months ago Jul 24, 2023, 9:50 a.m. EDT

Hi,

I was wondering if extracting element-level matrices is supported.

Please also let me know if this is indeed not possible in COMSOL.

Kind Regards

Hi, I was wondering if extracting element-level matrices is supported. Please also let me know if this is indeed not possible in COMSOL. Kind Regards

Kristian Ejlebjærg Jensen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 months ago Jul 25, 2023, 4:23 a.m. EDT

COMSOL has full support for gradient based optimization over frequency domain problems. Gradient based optimization with the eigenvalue solver is also supported, but only for objectives expressed in terms of the eigenvalues (not the eigenmodes).

You can, however, formulate your eigenvalue problem as non-linear stationary problem. If you are able to make that work (robustly), you might be able to use gradient based optmization with the stationary solver to achieve your goal.

COMSOL has full support for gradient based optimization over frequency domain problems. Gradient based optimization with the eigenvalue solver is also supported, but only for objectives expressed in terms of the eigenvalues (not the eigenmodes). You can, however, formulate your eigenvalue problem as non-linear stationary problem. If you are able to make that work (robustly), you might be able to use gradient based optmization with the stationary solver to achieve your goal.

Hendrik Mechanical Engineering

Please login with a confirmed email address before reporting spam

Posted: 9 months ago Jul 25, 2023, 5:45 a.m. EDT

COMSOL has full support for gradient based optimization over frequency domain problems. Gradient based optimization with the eigenvalue solver is also supported, but only for objectives expressed in terms of the eigenvalues (not the eigenmodes).

You can, however, formulate your eigenvalue problem as non-linear stationary problem. If you are able to make that work (robustly), you might be able to use gradient based optmization with the stationary solver to achieve your goal.

Thanks for your reply. Is support for gradient-based optimization using a Density Model in Topology Optimization also included?

>COMSOL has full support for gradient based optimization over frequency domain problems. Gradient based optimization with the eigenvalue solver is also supported, but only for objectives expressed in terms of the eigenvalues (not the eigenmodes). > >You can, however, formulate your eigenvalue problem as non-linear stationary problem. If you are able to make that work (robustly), you might be able to use gradient based optmization with the stationary solver to achieve your goal. Thanks for your reply. Is support for gradient-based optimization using a Density Model in Topology Optimization also included?

Kristian Ejlebjærg Jensen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 months ago Jul 25, 2023, 7:35 a.m. EDT
Updated: 9 months ago Jul 25, 2023, 8:52 a.m. EDT

Thanks for your reply. Is support for gradient-based optimization using a Density Model in Topology Optimization also included?

Yes, we have many models demonstrating this. You can search the application library and/or gallery to see them. This is a simple example.

>Thanks for your reply. Is support for gradient-based optimization using a Density Model in Topology Optimization also included? Yes, we have many models demonstrating this. You can search the application library and/or gallery to see them. [This](https://www.comsol.com/model/7428) is a simple example.

Hendrik Mechanical Engineering

Please login with a confirmed email address before reporting spam

Posted: 9 months ago Jul 26, 2023, 5:11 a.m. EDT
Updated: 9 months ago Jul 26, 2023, 5:18 a.m. EDT

You can, however, formulate your eigenvalue problem as non-linear stationary problem. If you are able to make that work (robustly), you might be able to use gradient based optmization with the stationary solver to achieve your goal.

Hi Kristian,

Could you elaborate on the formulation you mentioned? How can the static+eigenfrequency analysis be formulated as a nonlinear stationary problem ?

And how would this be implemented in COMSOL?

>You can, however, formulate your eigenvalue problem as non-linear stationary problem. If you are able to make that work (robustly), you might be able to use gradient based optmization with the stationary solver to achieve your goal. Hi Kristian, Could you elaborate on the formulation you mentioned? How can the static+eigenfrequency analysis be formulated as a nonlinear stationary problem ? And how would this be implemented in COMSOL?

Kristian Ejlebjærg Jensen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 months ago Jul 27, 2023, 3:46 a.m. EDT

Could you elaborate on the formulation you mentioned?

You will need to create a global dependent variable for the eigenvalue. You will also need to add an equation for normalizing the eigenvector (this is where you use the test function of the eigenvalue).

>Could you elaborate on the formulation you mentioned? You will need to create a global dependent variable for the eigenvalue. You will also need to add an equation for normalizing the eigenvector (this is where you use the test function of the eigenvalue).

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.