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.
How to determine domain number from a given block name.
Posted 2014年5月2日 GMT-4 10:26 RF & Microwave Engineering, LiveLink for MATLAB Version 4.4 5 Replies
Please login with a confirmed email address before reporting spam
Hi
I'm currently working with a project where I have to prepare a model to be illuminated in the RF module by microwawes and ultimately being able to determine the location of tumors in human tissue.
This model requires, among many other things, that the model of the illuminated medium can be altered between to different types of materials, essentially flesh and something other than flesh, water is used so far for convenience. All of this model is intended to be controllede via the LiveLink interface to COMSOL and the illuminated medium is created using matlab commands, given a 10x10x10 grid of squares where it was my intend that the changes in medium could be done simply by selecting between to materials, using the command:
>> model.material('mat2').selection(*insert numbers here*);
but in order to do so, I need the domain numbers of a given block, and clicking them manually is not an option, as the full solution should be capable of handling in excess of 10000 block.
Each block has been created with code below, in order to ease identification:
%Array creation
for x=1:10;
for y = 1:1;
for z = 1:1;
CellSize = 5;
s = strcat('blk_x',num2str(x),'_y',num2str(y),'_z',num2str(z));
model.geom('geom1').feature.create(s, 'Block');
model.geom('geom1').feature(s).setIndex('size', num2str(CellSize), 0);
model.geom('geom1').feature(s).setIndex('size', num2str(CellSize), 1);
model.geom('geom1').feature(s).setIndex('size', num2str(CellSize), 2);
model.geom('geom1').feature(s).setIndex('pos', num2str(CellSize*x), 0);
model.geom('geom1').feature(s).setIndex('pos', num2str(CellSize*y), 1);
model.geom('geom1').feature(s).setIndex('pos', num2str(CellSize*z), 2);
end
end
end
The name string is for example 'blk_x10_y1_z1'
Have a nice weekend. -Thomas
I'm currently working with a project where I have to prepare a model to be illuminated in the RF module by microwawes and ultimately being able to determine the location of tumors in human tissue.
This model requires, among many other things, that the model of the illuminated medium can be altered between to different types of materials, essentially flesh and something other than flesh, water is used so far for convenience. All of this model is intended to be controllede via the LiveLink interface to COMSOL and the illuminated medium is created using matlab commands, given a 10x10x10 grid of squares where it was my intend that the changes in medium could be done simply by selecting between to materials, using the command:
>> model.material('mat2').selection(*insert numbers here*);
but in order to do so, I need the domain numbers of a given block, and clicking them manually is not an option, as the full solution should be capable of handling in excess of 10000 block.
Each block has been created with code below, in order to ease identification:
%Array creation
for x=1:10;
for y = 1:1;
for z = 1:1;
CellSize = 5;
s = strcat('blk_x',num2str(x),'_y',num2str(y),'_z',num2str(z));
model.geom('geom1').feature.create(s, 'Block');
model.geom('geom1').feature(s).setIndex('size', num2str(CellSize), 0);
model.geom('geom1').feature(s).setIndex('size', num2str(CellSize), 1);
model.geom('geom1').feature(s).setIndex('size', num2str(CellSize), 2);
model.geom('geom1').feature(s).setIndex('pos', num2str(CellSize*x), 0);
model.geom('geom1').feature(s).setIndex('pos', num2str(CellSize*y), 1);
model.geom('geom1').feature(s).setIndex('pos', num2str(CellSize*z), 2);
end
end
end
The name string is for example 'blk_x10_y1_z1'
Have a nice weekend. -Thomas
5 Replies Last Post 2017年7月12日 GMT-4 11:38