Creating Concentric spheres

33 views
Skip to first unread message

Jagir Hussan

unread,
Sep 10, 2014, 12:16:47 AM9/10/14
to iso2mes...@googlegroups.com
Hi,
     I wanted to created a volume mesh of three concentric spheres, since they intersect my naive attempt (below) did not work. Could you let me know how I could create such a mesh?

Thanks
Jagir

[no1,fc1]=meshasphere([0 0 0], 10, 1);
[no2,fc2]=meshasphere([0 0 0], 7, 1);
[no3,fc3]=meshasphere([0 0 0], 5, 1);

% combine 3 spheres and clean the surface
[no,fc]=surfboolean(no1,fc1,'union',no2,fc2,'union',no3,fc3);
[no_f,fc_f]=meshcheckrepair(no,fc(:,1:3),'meshfix');
plotmesh(no_f,fc_f,'y>0');
 

Qianqian Fang

unread,
Sep 10, 2014, 11:26:21 PM9/10/14
to iso2mes...@googlegroups.com
On 09/10/2014 12:16 AM, Jagir Hussan wrote:
Hi,
     I wanted to created a volume mesh of three concentric spheres, since they intersect my naive attempt (below) did not work. Could you let me know how I could create such a mesh?

Thanks
Jagir

[no1,fc1]=meshasphere([0 0 0], 10, 1);
[no2,fc2]=meshasphere([0 0 0], 7, 1);
[no3,fc3]=meshasphere([0 0 0], 5, 1);

% combine 3 spheres and clean the surface
[no,fc]=surfboolean(no1,fc1,'union',no2,fc2,'union',no3,fc3);

hi Jagir

your spherical shells are not intersecting to each other.
the message from the surfboolean function (using libgts
in the backend) was erroneous.

the surfboolean feature is still experimental. apparently,
it (i.e. libgts) has problems even handling your simple
spherical meshes. In this case, I would roll back to the
simple mesh concatenation function, i.e. mergemesh(), by

[no,fc]=mergemesh(no1,fc1,no2,fc2,no3,fc3);

with the following command, I was able to get a good
3D multi-layered mesh from your example:

[node,elem]=surf2mesh(no,fc,[],[],1,2,[0 0 0;0 6 0;0 8 0]);
plotmesh(node,elem,'y>0')

mergemesh does not check for surface intersection,
so it is only safe to use when you know this is true.

Qianqian

[no_f,fc_f]=meshcheckrepair(no,fc(:,1:3),'meshfix');
plotmesh(no_f,fc_f,'y>0');
 
--
You received this message because you are subscribed to the Google Groups "iso2mesh-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iso2mesh-user...@googlegroups.com.
To post to this group, send email to iso2mes...@googlegroups.com.
Visit this group at http://groups.google.com/group/iso2mesh-users.
For more options, visit https://groups.google.com/d/optout.

The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

Jagir Hussan

unread,
Sep 11, 2014, 10:29:15 PM9/11/14
to iso2mes...@googlegroups.com
Hi Qianqian,
    Many thanks for the prompt response. The snippet you provided does what I need. 

Regards
Jagir
Reply all
Reply to author
Forward
0 new messages