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.

Meshing in matlab

Please login with a confirmed email address before reporting spam

Hi,

I am having real difficulty to control my mesh in matlab. Basically I don't have any control over it. Its quite a simple model but im finding that if I change the numbers in the code, I get the same mesh size. Here is the code:

model.mesh('mesh1').feature.create('ftri1', 'FreeTri');
model.mesh('mesh1').feature('ftri1').selection.set([4]);
model.mesh('mesh1').feature('ftri1').feature.create('size1', 'Size');
model.mesh('mesh1').feature('ftri1').feature('size1').set('hmax', '0.000156');
model.mesh('mesh1').feature('ftri1').feature('size1').set('hmin', '.113E-4');
model.mesh('mesh1').feature('ftri1').feature('size1').set('hcurve', '0.4');
model.mesh('mesh1').feature('ftri1').feature('size1').set('hnarrow', '0.7');
model.mesh('mesh1').feature('ftri1').feature('size1').set('hgrad', '1.4');
model.mesh('mesh1').feature('ftri1').feature('size1').set('hauto', '3');
model.mesh('mesh1').feature.create('swe1', 'Sweep');
model.mesh('mesh1').feature('swe1').feature.create('size1', 'Size');
model.mesh('mesh1').feature('swe1').feature('size1').set('hmax', '5.65E-4');
model.mesh('mesh1').feature('swe1').feature('size1').set('hmin', '5.65E-6');
model.mesh('mesh1').feature('swe1').feature('size1').set('hcurve', '0.2');
model.mesh('mesh1').feature('swe1').feature('size1').set('hnarrow', '1');
model.mesh('mesh1').feature('swe1').feature('size1').set('hgrad', '1.3');
model.mesh('mesh1').feature('swe1').feature('size1').set('hauto', '1');
model.mesh('mesh1').run;

Its a triangular mesh that is swept throught the object. The mesh doesnt ever seem to change, meaning that I get a poor mesh on larger models. The reason it matters is because I want to have the same size mesh elements reagrdless of the size of my model. Has anyone else had the same problem? Can anyone help here?

Thanks

2 Replies Last Post 2012年12月13日 GMT-5 21:40

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年7月13日 GMT-4 09:17
If anyone is interested or experiences this problem, the answer is really simple. The lines with 'hauto':

model.mesh('mesh1').feature('ftri1').feature('size1').set('hauto', '3');
model.mesh('mesh1').feature('swe1').feature('size1').set('hauto', '1');

define a default (or atuo) mesh which was overriding the size specifications.
If anyone is interested or experiences this problem, the answer is really simple. The lines with 'hauto': model.mesh('mesh1').feature('ftri1').feature('size1').set('hauto', '3'); model.mesh('mesh1').feature('swe1').feature('size1').set('hauto', '1'); define a default (or atuo) mesh which was overriding the size specifications.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年12月13日 GMT-5 21:40
Hi there, can anyone tell me exactly what 'hauto' means? I generated the model in the GUI, so I don't really know how to interpret the text. My mesh is:

fem.mesh=meshinit(fem, ...
'hauto',10, ...
'hmaxedg',[1,0.005,9,0.005,12,0.005], ...
'methodsub','tri');

I inferred the boundaries along edge 1, 9, and 12 are refined to 0.005m node spacing. I know the node spacing grows with distance from these boundaries, but how fast and to what maximum value?

Thanks for any input, I could not find any explanation of 'hauto'
Hi there, can anyone tell me exactly what 'hauto' means? I generated the model in the GUI, so I don't really know how to interpret the text. My mesh is: fem.mesh=meshinit(fem, ... 'hauto',10, ... 'hmaxedg',[1,0.005,9,0.005,12,0.005], ... 'methodsub','tri'); I inferred the boundaries along edge 1, 9, and 12 are refined to 0.005m node spacing. I know the node spacing grows with distance from these boundaries, but how fast and to what maximum value? Thanks for any input, I could not find any explanation of 'hauto'

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.