Quantcast
Channel: COMSOL Forums: How to determine domain number from a given block name.
Viewing all articles
Browse latest Browse all 16

How to determine domain number from a given block name.

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

Viewing all articles
Browse latest Browse all 16

Trending Articles