Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 428

beg for a quick way to add material to each domain

$
0
0
Hello everyone,

I am using AC/DC module. The geometry has a lot of domains, which is shown in the attached file. Now, I want to add different materials with different relative permittivity to each domain. But it really takes a long time (my code in comsol with matlab is shown below). Is there a quick way to achieve this?

Thanks

parfor n2=1:4096 %no of grids
model.material.duplicate(strcat('mat', num2str(n2+3)), 'mat1');
model.material(strcat('mat', num2str(n2+3))).selection.set(n2+2);
model.material(strcat('mat', num2str(n2+3))).propertyGroup('def').set('relpermittivity', grid_permittivity(n2));
end

Viewing all articles
Browse latest Browse all 428

Trending Articles