% Create two meshed volumes for both the 0.5-mm thick beams and extract only the longitudinal surfaces:[n_beam_1,f_beam_1]=meshabox([-10 3 1.5],[10 2 2.5],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(fa_beam_1(:,end)==1,1:3)); % Remove isolated nodes in the beam surface;[n_beam_2,f_beam_2]=meshabox([-10 -2 1.5],[10 -3 2.5],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(fa_beam_2(:,end)==1,1:3)); % Remove isolated nodes in the beam surface;
% Combine the meshed surfaces of the two beams:[no,fa]=mergemesh(no_beam_1,fa_beam_1,no_beam_2,fa_beam_2);
% Create the meshed volume of the bounding 20x20x5 mm box around the merged inner volumes:[node,elem]=surf2mesh(no,fa,[-10 -10 -2.5],[10 10 2.5],1,0.01,[0 2.5 2; 0 -2.5 2]);elem(:,5)=elem(:,5)+1; % Adjust region identifiers of the initial meshed domain
[n_beam_1,f_beam_1]=meshabox([-11 3 1.5],[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 1.5],[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;
[nbox,fbox]=meshabox([-10 -10 -2.5],[10 10 2.5],1);
% Combine the meshed surfaces of the two beams:
[no,fa]=mergemesh(no_beam_1,fa_beam_1,no_beam_2,fa_beam_2);
[n3obj, f3obj]=surfboolean(nbox, fbox(:,[1 3 2]), 'first', no,fa);
% Create the meshed volume of the bounding 20x20x5 mm box around the merged inner volumes:
[node,elem]=s2m(n3obj,f3obj,1,10,'tetgen',[0 0 0; 0 2.5 2; 0 -2.5 2]); plotmesh(node,elem)
--
Thanks,Luca
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.
% Add wide-field planar source to refined mesh domain:source=struct('srctype','planar','srcpos',[-2 -2 7],'srcdir',[0 0 -1 -3],'srcparam1',[4 0 0 0],'srcparam2',[0 4 0 0]);[newnode,newelem]=mmcaddsrc(node,elem,source,'KeepShape',1);newelem(:,1:4)=meshreorient(newnode,newelem(:,1:4));% Plot the final mesh + source domain:figure; plotmesh(newnode,newelem,'facealpha',0.5), hold on, plotmesh(node,elem) % Plot final mesh + source domain;