FEM : plotting stress field in each T3 element

23 Ansichten (letzte 30 Tage)
Damien Sommer
Damien Sommer am 4 Mai 2017
Kommentiert: darova am 26 Jul. 2021
Good afternoon, I have written a FEM in matlab. My code find the displacement fiel of a plate with a hole submitted to an internal pressure. My mesh is composed of 53 nodes. The coordinates (xi,yi) of all nodes are contained in a 53x2 matrix called " coordonnees ". Those 53 nodes form 80 T3 triangle elements, which connectivity is contained in a 80x3 matrix called " connectivite ". For every on the 80 elements I have find, with my FE model, the stresses to which are submitted those 80 elements. The stresses are kept in two 80x1 vector called " sigma_x " and " sigma_y ". Now, I would like to plot the mesh, and to color every triangle elements according to their value of sigma, but I don't know how to do this ? Do one of you have an idea on how to do this ? (I have found other FEM code that users have shared, that do something similar, but in their code they plot for exemple the displacement field, which is given for every single nodes of the mesh, so the atributed a color to the node. My problem is different in the way that my vector sigma_x gives the stress for every single elements and not every single nodes).
Thank you very much for your time and help!
Damien Sommer

Antworten (2)

Argenis Bonilla
Argenis Bonilla am 26 Jul. 2021
Did you find a solution? I'm facing the same problem :(

darova
darova am 26 Jul. 2021
Here is an example:
[x,y] = meshgrid(-2:0.2:2); % x,y range
z = x.^2+y.^2-4; % z value
h0 = surf(x,y,z,'visible','off'); % create surf (don't show)
h1 = surf2patch(h0,'triangles'); % convert to the surface to patch (triangles)
h1.facevertexCData = h1.vertices(:,3); % assign color of each node as Z value
patch(h1,'facecolor','flat') % visualize
  1 Kommentar
darova
darova am 26 Jul. 2021
Better model
% create model
[x1,y1] = pol2cart((0:90:270)*pi/180,3); % square/plate (unclosed contour)
[x2,y2] = pol2cart(linspace(0,2*pi-0.1,20),1); % circle (unclosed contour)
gd2 = [2;length(x2);x2(:);y2(:)]; % circle geometry description
gd1 = gd2*0;
gd1(1:2+2*length(x1)) = [2;length(x1);x1(:);y1(:)]; % plate geometry description
sf = 'C1-C2'; % solid fomrula (substract circle from plate)
ns = char('C2','C1')'; % name space (circle,plate)
dl = decsg([gd2 gd1],sf,ns); % decomposition
[p,e,t] = initmesh(dl); % create mesh
% create patch data
z = p(1,:).^2+p(2,:).^2-4; % calcualte z coordinate
h1.faces = t(1:3,:)'; % create face from triangles
h1.vertices = [p; z]'; % vertices
h1.faceVertexCData = z(:); % color according to z coord
patch(h1,'facecolor','flat')
view(15,60)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Stress and Strain finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by