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.

Passing Parameters into geometry features via MATLAB LiveLink

Please login with a confirmed email address before reporting spam

I'm using MATLAB to create geometry that I will want to be able to vary in the future. I created global parameters for each needed dimension and then passed the parameters in as strings while creating features. This worked fine until I tried to create an extrusion. For some reason COMSOL evaluated the parameter ("ridge.r") and placed the value (1) into the model...this means that if I change the parameter in the future the extrusion distance will not change.

I've attached the .m file, and here are the lines in question...

model.param.set('ridge.r', 1);
...
%creating a square and other geometry works fine
model.geom('geom1').feature('wp1').geom.feature.create('s1', 'Square');
model.geom('geom1').feature('wp1').geom.feature('s1').set('base', 'center');
model.geom('geom1').feature('wp1').geom.feature('s1').set('size', 'ridge.r');
%'ridge.r' is passed into the model.
model.geom('geom1').feature('wp1').geom.feature('s1').set('pos', {'ridge.t/2-ridge.r/2' 'ridge.w/2-ridge.r/2'});

%creating an extrusion does not work the same way
model.geom('geom1').feature.create('ext1', 'Extrude');
model.geom('geom1').feature('ext1').selection('input').set({'wp1.r1'});
model.geom('geom1').feature('ext1').set('crossfaces', 'off');
model.geom('geom1').feature('ext1').set('distance', 'ridge.r');
%'ridge.r' is not passed into the model. The value 1 is passed into the model.

Any thoughts?




0 Replies Last Post 21 janv. 2011, 14:43 UTC−5
COMSOL Moderator

Hello David Hodgson

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.