Creating a different mesh within a mesh
1 次查看(过去 30 天)
显示 更早的评论
Hello, I need to create a 2D mesh to perform finite element analysis on it. My current status for the mesh is:
function [coordinates,nodes] = MeshCircularPlate(Radius,theta,NR,NT)
innerRadius = 25;
Radius = 50;
theta = 90;
NR = 29;
NT = 30;
nel = NR*(NT-1) ; % Total Number of Elements in the Mesh
nnel = 4 ; % Number of nodes per Element
% Number of points on the Radius and Angluar discretization
npR = NR+1 ;
npT = NT ;
% Discretizing the Length and Breadth of the plate
nR = linspace(innerRadius,Radius,npR) ;
nT = linspace(0,theta,npT)*pi/180 ;
%nT = pi/180*(0:NT:theta) ;
[R T] = meshgrid(nR,nT) ;
% Convert grid to cartesian coordintes
XX = R.*cos(T);
YY = R.*sin(T);
% To get the Nodal Connectivity Matrix
coordinates = [XX(:) YY(:)] ;
nnode = npR*npT ; % Total Number of Nodes in the Mesh
NodeNo = 1:nnode ;
nodes = zeros(nel,nnel) ;
% If elements along the X-axes and Y-axes are equal
if npR==npT
NodeNo = reshape(NodeNo,npT,npR);
nodes(:,1) = reshape(NodeNo(1:npR-1,1:npT-1),nel,1);
nodes(:,2) = reshape(NodeNo(2:npR,1:npT-1),nel,1);
nodes(:,3) = reshape(NodeNo(2:npR,2:npT),nel,1);
nodes(:,4) = reshape(NodeNo(1:npR-1,2:npT),nel,1);
% If the elements along the axes are different
else %if npR>npT
NodeNo = reshape(NodeNo,npT,npR);
nodes(:,1) = reshape(NodeNo(1:npT-1,1:npR-1),nel,1);
nodes(:,2) = reshape(NodeNo(2:npT,1:npR-1),nel,1);
nodes(:,3) = reshape(NodeNo(2:npT,2:npR),nel,1);
nodes(:,4) = reshape(NodeNo(1:npT-1,2:npR),nel,1);
end
% Plotting the Finite Element Mesh
% Initialization of the required matrices
X = zeros(nnel,nel) ;
Y = zeros(nnel,nel) ;
% Extract X,Y coordinates for the (iel)-th element
for iel = 1:nel
X(:,iel) = coordinates(nodes(iel,:),1) ;
Y(:,iel) = coordinates(nodes(iel,:),2) ;
end
% Figure
fh = figure ;
set(fh,'name','Mesh','numbertitle','off','color','w') ;
patch(X,Y,'w')
title('FEA Mesh') ;
axis on ;
axis equal ;
And the mesh is like this
Q: How can I add additional mesh to this existing mesh to create discontinuties? For example a circular mesh at the center of this existing mesh.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!