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.

Define the Linearized Weak form for Comsol LiveLink Matlab

Please login with a confirmed email address before reporting spam

Dear all,

I am facing the following problem: solving a structural nonlinear mechanics problem using Comsol Livelink Matlab. My idea is to have the Newton method inside Matlab and let Comsol compute the Jacobian matrix of the first Piola-Kirchhoff tensor and the residual vector and then extract the matrix and vector and solve the system in Matlab.

For this, my stiffness matrix that is assembled in Comsol is the jacobian, that is defined by the linearized weak formulation of the problem. The issue is that in the linearized weak form the displacement field (that is the dependent variable of the problem) at the previous iteration of the Newton method appears as a "parameter". This "parameter" is unknown a priori.

Is there a way to tell Comsol that the general weak form I am inserting is a linearized weak form and therefore specifying what Comsol has to consider the unknow, and the known displacement?

many thanks,

Paolo Tricerri

3 Replies Last Post Sep 6, 2012, 11:12 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Sep 6, 2012, 5:39 a.m. EDT
Moreover, I would like to know the following:

- given the displacement u^k that is known and computed in Matlab (therefore it is the displacement field in the DOFs) , when it is brought to Comsol, is there a way to transform it into a FEM function (which means just that comsol understands that the values are at the DOFs)?

This would be super good since in the linearized weak form the gradient of the displacement field u^k appears, therefore I need the derivative of the basis functions.

Many thanks again,

Paolo Tricerri
Moreover, I would like to know the following: - given the displacement u^k that is known and computed in Matlab (therefore it is the displacement field in the DOFs) , when it is brought to Comsol, is there a way to transform it into a FEM function (which means just that comsol understands that the values are at the DOFs)? This would be super good since in the linearized weak form the gradient of the displacement field u^k appears, therefore I need the derivative of the basis functions. Many thanks again, Paolo Tricerri

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Sep 6, 2012, 9:26 a.m. EDT

- given the displacement u^k that is known and computed in Matlab (therefore it is the displacement field in the DOFs) , when it is brought to Comsol, is there a way to transform it into a FEM function (which means just that comsol understands that the values are at the DOFs)?


I have a very similar problem and try it the same way as you (use Comsol for obtaining the Jacobian for structural mechanics problems). I tried to solve it as described in www.comsol.com/community/forums/general/thread/31406/ but it does not work yet. But if I understand you correctly you also want to call setU on a solution (at least if the meshs are the same), afterward you can use all the other Comsol function such as interpolation, ...


Jens
[QUOTE] - given the displacement u^k that is known and computed in Matlab (therefore it is the displacement field in the DOFs) , when it is brought to Comsol, is there a way to transform it into a FEM function (which means just that comsol understands that the values are at the DOFs)? [/QUOTE] I have a very similar problem and try it the same way as you (use Comsol for obtaining the Jacobian for structural mechanics problems). I tried to solve it as described in http://www.comsol.com/community/forums/general/thread/31406/ but it does not work yet. But if I understand you correctly you also want to call setU on a solution (at least if the meshs are the same), afterward you can use all the other Comsol function such as interpolation, ... Jens

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Sep 6, 2012, 11:12 a.m. EDT
Hi,

yes. you are right. At the moment, I am facing the following problem:

I have been able, from Matlab to read a model, create inside Matbal a interpolation function over the mesh of a set of data (which could be the displacement at the nodes at a certain iteration) but if I use the model.func(tag).importData() command (as suggested in the guide) when I open the model (that has been modified in Matlab) in Comsol I am not able to plot the interpolating function. If I just define the filename and then, just import the file using Comsol (therefore I remove the importData command from Matlab) then, I can plot the interpolating function.

I have not found any guide about importData. Do you know how to use it?

Thanks.

Paolo
Hi, yes. you are right. At the moment, I am facing the following problem: I have been able, from Matlab to read a model, create inside Matbal a interpolation function over the mesh of a set of data (which could be the displacement at the nodes at a certain iteration) but if I use the model.func(tag).importData() command (as suggested in the guide) when I open the model (that has been modified in Matlab) in Comsol I am not able to plot the interpolating function. If I just define the filename and then, just import the file using Comsol (therefore I remove the importData command from Matlab) then, I can plot the interpolating function. I have not found any guide about importData. Do you know how to use it? Thanks. Paolo

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.