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.

Set the coordinates of nodes via matlab

Please login with a confirmed email address before reporting spam

Hi,

I'm using Livelink with matlab and I'm trying to define my model using matlab software. Everything for me seems quite clear, except one thing. Firstly I create the geometry using following comands:

geom=model.geom.create('geom',2);
sq=geom.feature.create('sq','Rectangle');
sq.set('size',[80 10]);
geom.run;

Its a 2D model, geometry is a simple rectangle with 80 width and 10 height. Secondly I need to mesh the created geometry. In this case I want to define my own mesh. I calculated the coordinates of the nodes in the mesh:

XYZ =

0 10 20 30 40 50 60 70 80 0 10 20 30 40 50 60 70 80
0 0 0 0 0 0 0 0 0 10 10 10 10 10 10 10 10 10

The structure of this matrix is the same as the structure of vertex for 2D triangular element. Also I calculated a element matrix, with number of nodes:

ELEM =

1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18
11 12 13 14 15 16 17 18 10 11 12 13 14 15 16 17

Then I'm trying to create a mesh with these values:

model.mesh().create('mesh', 'geom');
model.mesh('mesh').data().setElem('tri', ELEM-1);
model.mesh('mesh').data().setVertex(XYZ);
model.mesh('mesh').data().createMesh();

But i get an error message:
Geometry and mesh not compatible

Where could be the problem?

0 Replies Last Post 15 nov 2012, 05:06 GMT-5
COMSOL Moderator

Hello Vykintas S

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

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.