조회 수: 34(최근 30일)

표시 이전 댓글 수

Dear Matlab community,

I would like to generate a 3D graph of a vibrational mode shape using 2D data of a solid of revolution (the cross-section of which lies in the r-z plane of a cylindrical coordinate system), by revolving the 2D data around the z-axis in the circumferential direction θ by 2π radians. I have a point cloud of data points of the meshed geometry where each corresponds to a node in a finite element model. From that model I also have the the three displacement components at each node, u (in radial direction r), v (in circumferential direction θ) and w(in axial direction z).

The undeformed geometry can be seen in the following graph (which is a simplification of the actual geometry I am solving for, but essentially includes similar geometric features, but us not as symmetric)

The red dots correspond to the nodes in the finite element model and the blue line corresponds to the extreme edge(s).

The displaced geometry (,,) of a mode at the plane where θ=0 looks as follows (after scaling it):

where the cyan line shows the edges of the undeformed geoemetry. I neglected the circumferential displacement here but it needs to be included in the 3D figure.

The displacements vary sinusoidally around the circumference, which needs to be included in the final 3D plot as:

Ideally, I would like to plot the 3D mode shape as shown in the figure below. It is taken directly from a finite element software, but I can't use it, since I apply further processing outside the software. But after finishing my calculations, I again end up with 3 displacement components at the same nodes and could plot the new ones. The colourmap c represents the magnitude of the overall displacement at each point as .

In the appendix I provide the data of the wheel in the data.mat file. The file is required to run the code below. It includes the nodal coordinates r and z of the above-shown undeformed 2D geometry and the three displacement components for the single mode. It would be sufficient to revolve the outer edges (blue lines in the first/second figure), instead of revolving all points. A good starting point is probably to try and plot the undeformed shape first, before going any further. Afterwards, the displacements could be added to each point and maybe it is possible to add a colourmap. I add a small piece of code below, which only includes my start. I have, however, already had problems coming up with something to plot the undeformed geoemtry, other than creating a 3D point cloud. I am very sorry, I can't provide you more. I'm not very experienced in plotting something in 3D in MATLAB and I am not sure how to tackle this problem, to be honest.

I am really hoping anyone could provide me some adivce on how to plot a 3D shape from the 2D data, as shown above. I am grateful for anything, I hope my description makes sense. This is the first time I am using the forum, I hope I was precise enough for you, to understand my problem. If not, please don't hesitate to tell me and I will do my best providing all neccesary information. Thank you very much in advance.

Best wishes,

Christopher

%Variables from data.mat are:

%r: radial coordinate of each node

%z: axial coordinate of each node

%u: displacement in radial direction of each node

%v: displacement in circumferential direction of each node

%w: displacement in axial direction of each node

%Connect: Connectivity matrix (links nodes to individual finite elements)

clc;clear variables

%load data from data.mat

load('data.mat')

%angle theta around circumference in steps of pi/N

N = 30;

theta = 0:pi/N:2*pi;

%number of nodal diameters

n = 2;

%displacement magnitude or colourmap

c = sqrt(u.^2+v.^2+w.^2);

%re-scale displacements to max displacement

u = u./max(abs([u', v', w']));

v = v./max(abs([u', v', w']));

w = w./max(abs([u', v', w']));

%r,z,u,v,w on boundary or extreme edge nodes

rEdg = r(pEdge);

zEdg = z(pEdge);

uEdg = u(pEdge);

vEdg = v(pEdge);

wEdg = w(pEdge);

%rescale mode shape in plotby scale factor to look proper

scale = 0.1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%% plots %%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% create 3D point cloud of undeformed geometry for each node/value of theta

figure(1)

clf

%create arrays for each value of theta

%all nodes

R0 = r.*ones(1,length(theta));

Z0 = z.*ones(1,length(theta));

%edge nodes (comment out if all nodes shall be used)

% R0 = rEdg.*ones(1,length(theta))

% Z0 = zEdg.*ones(1,length(theta))

Th0 = theta.*ones(length(R0),1);

%transform cyl polar to cartesian coords

[X0,Y0,Z0] = pol2cart(Th0,R0,Z0);

plot3(X0,Y0,Z0,'k.')

axis equal

axis padded

%% create 3D point cloud of deformed geometry for each node/value of theta

figure(2)

clf

%create arrays for each value of theta

%all nodes

% R = r+u*scale.*ones(1,length(theta)).*cos(n*theta);

% Z = z+w*scale.*ones(1,length(theta)).*cos(n*theta);

% Th = theta+v*scale.*sin(n*theta);

%edge nodes (comment out if all nodes shall used)

R = rEdg+uEdg*scale.*ones(1,length(theta)).*cos(n*theta);

Z = zEdg+wEdg*scale.*ones(1,length(theta)).*cos(n*theta);

Th = theta+vEdg*scale.*sin(n*theta);

%transform cyl polar to cartesian coords

[X,Y,Z] = pol2cart(Th,R,Z);

plot3(X,Y,Z,'k.')

axis equal

axis padded

%% plot 3D as slices at angle theta increment

figure(3)

clf

for ith = 1:length(theta)

u_theta = u*scale.*cos(n*theta(ith));

v_theta = v*scale.*sin(n*theta(ith));

w_theta = w*scale.*cos(n*theta(ith));

for i = 1:size(Connect,1)

Conn = (Connect(i,:));

re = r(Conn)+u_theta(Conn);

ze = z(Conn)+w_theta(Conn);

the = theta(ith)+v_theta(Conn);

[Xe,Ye,Ze] = pol2cart(the,re,ze);

patch(Xe,Ze,Ye,[0.5 0.5 0.5])

hold on

end

view(-45,45)

axis equal

axis([-0.6 0.6 -0.1 0.1 -0.6 0.6])

end

Matt J
18 Apr 2021 23:53

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

Start Hunting!