Matlab 有限元分析三维悬臂梁变形

流程和之前的一样,代码如下所示:

Matlab 复制代码
clc
clear

tic 
% 创建 PDE model
model = createpde('structural', 'static-solid');
% 创建需要计算的几何区域
x = [0; 0;5; 5;0; 0;5; 5;]*1e-3;
y = [0;30;0;30;0;30;0;30;]*1e-3;
z = [0; 0;0; 0;3; 3;3; 3;]*1e-3;
K = convhull(x,y,z);
nodes = [x';y';z'];
elements = K';
% 应用几何到模型
geometryFromMesh(model,nodes,elements);
figure(1)
pdegplot(model,"FaceLabels","on","FaceAlpha",0.5)
% Vertex
hold on
plot3(x(1),y(1),z(1),'o')
% 生成网格
generateMesh(model, 'GeometricOrder', 'quadratic', 'Hmax', 0.5e-3);
pdeplot3D(model);
% 定义材料属性
structuralProperties(model, 'YoungsModulus', 210e9, 'PoissonsRatio', 0.28);
% 定义固定的约束边界条件
structuralBC(model,'Face',3,'Constraint','fixed') ; % 固定位移约束
% 定义载荷
structuralBoundaryLoad(model,'Face',6,'Pressure',@myfunPressure);
% 模型求解
results = solve(model);

% 选数据出来
nodecoor = (model.Mesh.Nodes)';
Disa = results.Displacement.Magnitude;
Disy = Disa(nodecoor(:,1)==5e-3&nodecoor(:,3)==0e-3);
ycoor = nodecoor(nodecoor(:,1)==5e-3&nodecoor(:,3)==0e-3,2);

%
figure(1);
pdeplot3D(model,'ColorMapData',results.Displacement.Magnitude,...
                'Deformation',results.Displacement,'DeformationScaleFactor',10);
axis equal

figure(2)
plot(ycoor,Disy,'o')
hold on

其中载荷函数通过自定义函数的方式施加:

Matlab 复制代码
% 自定义施加压力的函数
function structuralVal = myfunPressure(location,~)

a = 1;
structuralVal = 0; 

    if(location.y<=17e-3&&location.y>=14e-3&&location.x<=3e-3&&location.x>=2e-3)
        structuralVal = 20; 
    end
    
end

结果如图所示:

相关推荐
搜佛说2 分钟前
比SQLite更快,比InfluxDB更轻:sfsDb的降维打击
jvm·数据库·物联网·架构·sqlite·边缘计算·iot
LilySesy4 分钟前
【与AI+】英语day4——数据库与性能优化
数据库·oracle·性能优化·sap·abap·自动翻译
0vvv05 分钟前
2026-NCTF-web-N-RustPICA
前端·ctf
前进的李工6 分钟前
MySQL角色管理:权限控制全攻略
前端·javascript·数据库·mysql
芯智工坊6 分钟前
第13章 Mosquitto监控与日志管理
前端·网络·人工智能·mqtt·开源
爱丽_8 分钟前
MySQL `EXPLAIN`:看懂执行计划、判断索引是否生效与排错套路
android·数据库·mysql
小红的布丁8 分钟前
Redis 持久化详解:AOF、RDB 与混合持久化如何平衡性能和可靠性
数据库·redis·缓存
洒满阳光的庄园21 分钟前
Electron 桌面端打包流程说明
前端·javascript·electron
qqxhb26 分钟前
23|工具生态全景:本地文件、网络、数据库、浏览器自动化
网络·数据库·自动化·ai编程·最小权限·人工确认