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.

Select mesh-elements and refine mesh there (via Matlab)

Please login with a confirmed email address before reporting spam

Hi,
i want to select certain mesh-elements and refine the mesh there. It works for domains, but i can not manage to select e.g. certain triangles in a 2d-geometry mesh and refine there.

Here is my code for the domain selection and refinement:

model.mesh('mesh1').feature().create('ref1', 'Refine');
model.mesh('mesh1').feature('ref1').selection().geom('geom_2d', 2).set([1]); % should be a selection of triangles here instead of domains
model.mesh('mesh1').run;

1 Reply Last Post May 11, 2011, 8:19 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 11, 2011, 8:19 a.m. EDT
For those who are interested: i finally found out how to do meshing at specific triangles/tetrahedrons.

model.mesh('mesh1').feature().create('ref1', 'Refine');
model.mesh('mesh1').feature('ref1').set('element',[1,3]); % mesh 1st and 3rd triangle
model.mesh('mesh1').run;

In the second line the elements are specified, depending on the underlying geometry these are the array-indices of the triangles or tetrahedrons you would get with e.g.

mesh1.getElem('tri');
For those who are interested: i finally found out how to do meshing at specific triangles/tetrahedrons. model.mesh('mesh1').feature().create('ref1', 'Refine'); model.mesh('mesh1').feature('ref1').set('element',[1,3]); % mesh 1st and 3rd triangle model.mesh('mesh1').run; In the second line the elements are specified, depending on the underlying geometry these are the array-indices of the triangles or tetrahedrons you would get with e.g. mesh1.getElem('tri');

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.