Creating intersected meshes

69 views
Skip to first unread message

gian...@gmail.com

unread,
Dec 14, 2018, 8:29:01 AM12/14/18
to iso2mesh-users
Dear iso2mesh users,

I am trying to create a mesh which is composed of a slab with two beams inside of it. The slab and the two beams would ideally share the same top and bottom surfaces.
I attached a MATLAB figure showing this, which I obtained by simply plotting the three volumes separately.

I tried to create this mesh as following:

%% Creation of the initial meshed domain:
% Create two meshed longitudinal surfaces for both the 0.5-mm thick beams:
[n_beam_1,f_beam_1]=meshabox([-11 3 -2.6],[11 2 2.6],0.01,1); % Create meshed volume for the first beam;
[n_beam_1,el_beam_1,fa_beam_1]=surf2mesh(n_beam_1,f_beam_1,[],[],1,0.01); % Extract longitudinal surface from the meshed beam;
[no_beam_1,fa_beam_1]=removeisolatednode(n_beam_1,fa_beam_1(:,1:3)); % Remove isolated nodes in the beam surface;
[n_beam_2,f_beam_2]=meshabox([-11 -2 -2.6],[11 -3 2.6],0.01,1); % Create meshed volume for the second beam;
[n_beam_2,el_beam_2,fa_beam_2]=surf2mesh(n_beam_2,f_beam_2,[],[],1,0.01); % Extract longitudinal surface from the meshed beam;
[no_beam_2,fa_beam_2]=removeisolatednode(n_beam_2,fa_beam_2(:,1:3)); % Remove isolated nodes in the beam surface;

% Create the meshed surface of the bounding 20x20x5 mm slab:
[no_slab,fa_slab]=meshabox([-10 -10 -2.5],[10 10 2.5],0.01,1); % Create the meshed slab surface;

% Combine the meshed surfaces of the two beams:
[no_beams,fa_beams]=mergemesh(no_beam_1,fa_beam_1,no_beam_2,fa_beam_2);

% Create the final meshed volume of the bounding 20x20x5 mm box around the inner meshed volumes of the two cylinders:
[no_mesh,fa_mesh]=surfboolean(no_slab,fa_slab(:,[1 3 2]),'first',no_beams,fa_beams); % Combine the surfaces of the beams with the slab;
no_mesh=round(no_mesh,4); % Refine merged surfaces;
[node,elem]=s2m(no_mesh,fa_mesh,1,0.01,'tetgen',[0 0 0; 0 2.5 0; 0 -2.5 0]); % Convert the merged surfaces into the final meshed domain volume;
[node,elem]=sortmesh([],node,elem,1:4); % Sort nodes and elements in the final meshed domain;
elem(:,1:4)=meshreorient(node,elem(:,1:4)); % Re-orient elements of the final meshed domain;

However, this seems not to work. 

Anyone has any idea how to make it work?

Thanks,
Luca
Tissue+Venules_1.fig

Shijie Yan

unread,
Dec 14, 2018, 11:16:30 AM12/14/18
to iso2mes...@googlegroups.com
Hi Luca,

The figure you posted looks like a multi-layered slab. You could try latticegrid.m and s2m in iso2mesh to generate it. Please see the attached script.
image.png

Best,
Shijie

--
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 https://groups.google.com/group/iso2mesh-users.
For more options, visit https://groups.google.com/d/optout.
slab.m

gian...@gmail.com

unread,
Dec 14, 2018, 11:31:57 AM12/14/18
to iso2mesh-users
Hi Shijie,

Thanks for the help.
The only issue with your solution is that in my case I only want three media, so the grey parts in my image all belong to the same medium.

Best,
Luca

Shijie Yan

unread,
Dec 14, 2018, 12:07:35 PM12/14/18
to iso2mes...@googlegroups.com
Hi Luca,

I do not know if there are better ways to solve this issue but I would simply do a relabeling of the media type (5th column of the mesh element output). Please see attached.
image.png
Best,
Shijie
slab.m
Reply all
Reply to author
Forward
0 new messages