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.

Obtaining displacement on nodes of mesh

José Mauricio Urbano Caguasango

Please login with a confirmed email address before reporting spam

Hello everyone!

I am using the Structural Mechanics library with LiveLInk in Matlab. I am simulating the human cornea. I need to obtain the deformed mesh of the cornea after the applied loads, and calculate the displacements based on the initial mesh. I want then to substract these displacements to the original mesh and run the simulation again, until my final mesh converges to the very first initial mesh.

I have problems trying to obtain the displacements in Matlab, and/or to set the coordinates of the initial mesh to my new coordinates. I am using the following commands:

- model.mesh('mesh2').data.setVertex(meshCoordinates);
- verticesOut = struct2cell(mpheval(model, {'x' 'y' 'z'}));

The initial mesh in the simulation is changing with the iterations, but i get always the same results. It seems that Matlab is not recognizing my new mesh. Could someone helpme please?

Thanks in advance!

Jose


5 Replies Last Post Sep 30, 2012, 8:33 a.m. EDT
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 Sep 25, 2012, 10:54 a.m. EDT
Hi

I do not really understand your question, if you have a mapped function for your surface and you want to get a regular shape to fit to this "measured" surface, you have an optimisation problem, that can be easily solved with the optimisation module, and with some math and equation writing, for a simple case in standard COMSOL

--
Good luck
Ivar
Hi I do not really understand your question, if you have a mapped function for your surface and you want to get a regular shape to fit to this "measured" surface, you have an optimisation problem, that can be easily solved with the optimisation module, and with some math and equation writing, for a simple case in standard COMSOL -- Good luck Ivar

José Mauricio Urbano Caguasango

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Sep 25, 2012, 12:34 p.m. EDT
Hi! Maybe i wasn't clear with my problem ;)

I am using the structural mechanics library and Livelink in Matlab. I am simulating the human cornea as an empty semisphere. The only load acting is a distributed force (pressure) from the inside. This load results in a deformation of the entire semisphere. I want to know a geometry such that, when the loads are applied, the deformed cornea coincides with a geometry that i know (Lets call it "Def_geom"). For this I am following the next procedure:

1. I start with the geometry that i know "Def_geom".
2. I apply the loads and get the displacement on each node with the command verticesOut = struct2cell(mpheval(model, {'x' 'y' 'z'}))
3. I run the simulation again, but I define a new mesh, which is my original mesh "Def_geom" -- the displacements.
4. I define the new mesh with the command model.mesh('mesh2').data.setVertex(meshCoordinates), where "meshCoordinates" correspond to the corrected mesh.
5. I iterate this condition.

I have realized that the corrected mesh changes on each iteration, which is expected, but i found that the displacement after the loads was always the same. I want to know the following:

1. Am I using the right commands to get the displacement on each node?.
2. Am I somehow defining a new mesh but Matlab is only recognizing the original mesh?

Yesterday I changed the command verticesOut = struct2cell(mpheval(model, {'x' 'y' 'z'})) with the capital X,Y,Z:
verticesOut = struct2cell(mpheval(model, {'X' 'Y' 'Z'})) and it seemed to work, but i don't know why.

I appreciate any help :D:D

José
Hi! Maybe i wasn't clear with my problem ;) I am using the structural mechanics library and Livelink in Matlab. I am simulating the human cornea as an empty semisphere. The only load acting is a distributed force (pressure) from the inside. This load results in a deformation of the entire semisphere. I want to know a geometry such that, when the loads are applied, the deformed cornea coincides with a geometry that i know (Lets call it "Def_geom"). For this I am following the next procedure: 1. I start with the geometry that i know "Def_geom". 2. I apply the loads and get the displacement on each node with the command verticesOut = struct2cell(mpheval(model, {'x' 'y' 'z'})) 3. I run the simulation again, but I define a new mesh, which is my original mesh "Def_geom" -- the displacements. 4. I define the new mesh with the command model.mesh('mesh2').data.setVertex(meshCoordinates), where "meshCoordinates" correspond to the corrected mesh. 5. I iterate this condition. I have realized that the corrected mesh changes on each iteration, which is expected, but i found that the displacement after the loads was always the same. I want to know the following: 1. Am I using the right commands to get the displacement on each node?. 2. Am I somehow defining a new mesh but Matlab is only recognizing the original mesh? Yesterday I changed the command verticesOut = struct2cell(mpheval(model, {'x' 'y' 'z'})) with the capital X,Y,Z: verticesOut = struct2cell(mpheval(model, {'X' 'Y' 'Z'})) and it seemed to work, but i don't know why. I appreciate any help :D:D José

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 Sep 26, 2012, 1:43 a.m. EDT
Hi

since V4 I have given up using Matlab with COMSOl, even if I still have the the livelink active ;) I manage to stey fully in the COMSOL GUI, so far

My way would be to define an interpolation function My_Z(x,y) from your measured data where My_Z is the height and X-Y is the extent of your cornea area, provided the correct coordinate transform to map the X,Y,Z to your geometry.

Then I apply a scalar pressure P to the approariate cornea beoandary and define P as a "global equation" with the equation

"intop1((w-My_Z)^2)" = 0

where w is the Z deformation field of your cornea model (assuming Z is the natural direction of deformation, this depends on your geomerty orientation as mentioned above) and intop1() is the integration over the full Cornea area (boundary integration)

COMSOL will minimise the global equation and leave you with the P requried to fit your cornea to the measured deformation in a least square minimisation way

I hope I'm clear.

--
Good luck
Ivar
Hi since V4 I have given up using Matlab with COMSOl, even if I still have the the livelink active ;) I manage to stey fully in the COMSOL GUI, so far My way would be to define an interpolation function My_Z(x,y) from your measured data where My_Z is the height and X-Y is the extent of your cornea area, provided the correct coordinate transform to map the X,Y,Z to your geometry. Then I apply a scalar pressure P to the approariate cornea beoandary and define P as a "global equation" with the equation "intop1((w-My_Z)^2)" = 0 where w is the Z deformation field of your cornea model (assuming Z is the natural direction of deformation, this depends on your geomerty orientation as mentioned above) and intop1() is the integration over the full Cornea area (boundary integration) COMSOL will minimise the global equation and leave you with the P requried to fit your cornea to the measured deformation in a least square minimisation way I hope I'm clear. -- Good luck Ivar

José Mauricio Urbano Caguasango

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Sep 28, 2012, 4:45 p.m. EDT
Hi Ivar! Thanks for your quick response! :D

I found your approach very interesting, i.e. defining the simulation as an optimization problem. In my case I am not trying to find the pressure field (which is constant), but the displacement field. I began working with Comsol a month ago, and I have not much experience. Could you illustrate me please how could I set up this interpolation function and the minimization problem? I would really appreciate that....

Thanks again!
José
Hi Ivar! Thanks for your quick response! :D I found your approach very interesting, i.e. defining the simulation as an optimization problem. In my case I am not trying to find the pressure field (which is constant), but the displacement field. I began working with Comsol a month ago, and I have not much experience. Could you illustrate me please how could I set up this interpolation function and the minimization problem? I would really appreciate that.... Thanks again! José

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 Sep 30, 2012, 8:33 a.m. EDT
Hi

there are a few exaples in the model library, among one on a global Heat "T" control example

else you have things like

www.comsol.com/showroom/gallery/9999/
www.comsol.com/showroom/gallery/4356/
www.comsol.com/showroom/gallery/407/

--
Good luck
Ivar
Hi there are a few exaples in the model library, among one on a global Heat "T" control example else you have things like http://www.comsol.com/showroom/gallery/9999/ http://www.comsol.com/showroom/gallery/4356/ http://www.comsol.com/showroom/gallery/407/ -- Good luck Ivar

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.