Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extrudesurf and s2m #35

Closed
praveenvenky opened this issue Sep 15, 2019 · 4 comments
Closed

extrudesurf and s2m #35

praveenvenky opened this issue Sep 15, 2019 · 4 comments

Comments

@praveenvenky
Copy link

praveenvenky commented Sep 15, 2019

Hello,
1.I wanted to generate a counterpart(bottom part) for a toppart.
2. So i used volface() and extracted all triangular faces.
3. I extracted only the bottom surface of the top part with triangular mesh.
4. I extruded it and used meshrepair(meshfix) and generated a solid using s2m with tetrahedral mesh.

My problem here is the number of nodes on the bottom surface of top part and top surface of bottom part are not same even though they are same.
Please help me how to solve this.

best regards
Praveen

@fangq
Copy link
Owner

fangq commented Oct 4, 2019

hi @praveenvenky, it would be a lot easier for me to understand the problem if you can attach some sample images or script/data.

generally speaking, after meshcheckrepair, you will unlikely to get the same number of nodes/element because the repairing is performed independently on both the top/bottom surfaces.

@praveenvenky
Copy link
Author

praveenvenky commented Oct 4, 2019

hi @fangq , please see the below script
My problem is to get the bottom part with same number of nodes and elements as Top part.
But without using meshcheckrepair i cannot get the result to s2m.
Also, if I use meshcheckrepair, it gives different number of elements as you said.
Is there a possibility for me to get same number of elements?

%%
load('elements_TP.mat'); % elements of top part

load('nodes_TP.mat') % nodes of TP

%% Extract all the triangular faces of top part.
[openface,elemid]=volface(elements_TP(:,2:5));
openface(:,4) = elemid;
node=nodes_TP(:,2:4)
% surfExt_Top(openface, node)
%% Extracting the neg-Z surface of the top part
% here I have used normals to take only the bottom elements and nodes of TP.
% then I have to extrude it dowwnwards to get the bottom part.
t=4.5;
extrude_vector=[0 0 -t];
keepratio= 1;
maxvol=15;
ISO2MESH_TETGENOPT='-A -q1.1a'
[Neg_zface,node,Neg_z_node_numbers,Neg_z_node_coords] = negZ_top(openface, nodes_TP(:,2:4));% node_coords=nodes_TP(:,2:4)

difference= Neg_z_node_numbers-find(Neg_z_node_numbers)
triangularelements=Neg_zface;
% these below 5 lines are just to get uniform numbering of node and not to bother much abt it
for i=1:length(Neg_zface)
triangularelements(i,1)=Neg_zface(i,1) - difference(Neg_z_node_numbers(:,1)==Neg_zface(i,1));
triangularelements(i,2)=Neg_zface(i,2) - difference(Neg_z_node_numbers(:,1)==Neg_zface(i,2));
triangularelements(i,3)=Neg_zface(i,3) - difference(Neg_z_node_numbers(:,1)==Neg_zface(i,3));
end
plotmesh(Neg_z_node_coords,triangularelements)
%% Giving offset value as a parametric value(for cohesive layer)
offset= 0.3;
Neg_z_node_coords(:,3)=Neg_z_node_coords(:,3)-offset;

%%
[extrude_node,extrude_face] = extrudesurf(Neg_z_node_coords,triangularelements,extrude_vector);
[extrude_node,extrude_elem]=meshcheckrepair(extrude_node,extrude_face,'meshfix');
plotmesh(extrude_node,extrude_elem)
[bottom_part_nodes,bottom_part_elem,bottom_part_faces] = s2m(extrude_node,extrude_elem,keepratio,maxvol);
plotmesh(bottom_part_nodes,bottom_part_elem)

node=bottom_part_nodes;
elem=bottom_part_elem;

@fangq
Copy link
Owner

fangq commented Oct 4, 2019

@praveenvenky, unfortunately meshcheckrepair (more specifically, meshfix) does not have the capability to correlate two surface patches.

the only way to do this is perhaps recreating the bottom (or top part) from the other part by projecting one to another (or projecting to a plane). It is going to be complicated.

@praveenvenky
Copy link
Author

praveenvenky commented Oct 30, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants