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.

Model of multiple spheres in a cube

Please login with a confirmed email address before reporting spam

Hey!
I want to place multiple spheres (100 - 400) in a cube. I have an array of co-ordinates ( x, y, z) defining the center of sphere and a vector of all the radius ( r) of spheres. Is there anyway by which i can make such a model in Comsol geometry?

3 Replies Last Post 5 juin 2017, 11:31 UTC−4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 29 août 2014, 10:19 UTC−4
I think you can do it using Matlab code, but I do not know how. Maybe you can try contacting the person who started this thread: www.comsol.co.in/community/forums/general/thread/46371/.
I think you can do it using Matlab code, but I do not know how. Maybe you can try contacting the person who started this thread: http://www.comsol.co.in/community/forums/general/thread/46371/.

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 7 déc. 2014, 21:50 UTC−5
% Create geometry in 3D
geom1 = model.geom.create('geom1', 3);

% Create spheres
for i = 1:N
name = strcat('sph',int2str(i));
model.geom('geom1').feature.create(name, 'Sphere');
model.geom('geom1').feature(name).set('r' , r(i) );
model.geom('geom1').feature(name).set('pos', [X(i) Y(i) Z(i)]);
end
% Create geometry in 3D geom1 = model.geom.create('geom1', 3); % Create spheres for i = 1:N name = strcat('sph',int2str(i)); model.geom('geom1').feature.create(name, 'Sphere'); model.geom('geom1').feature(name).set('r' , r(i) ); model.geom('geom1').feature(name).set('pos', [X(i) Y(i) Z(i)]); end

Walter Frei COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 5 juin 2017, 11:31 UTC−4
Hello,

You may also find this approach (new to version 5.3) helpful:
www.comsol.com/blogs/how-to-create-a-randomized-geometry-using-model-methods/

Best Regards,
Hello, You may also find this approach (new to version 5.3) helpful: https://www.comsol.com/blogs/how-to-create-a-randomized-geometry-using-model-methods/ Best Regards,

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.