Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 26323

Set the coordinates of nodes via matlab

$
0
0
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?

Viewing all articles
Browse latest Browse all 26323

Trending Articles