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

结果如图所示:

相关推荐
wefg18 分钟前
【Redis】C++ 自定义客户端
数据库·redis·缓存
Chrischaan15 分钟前
做 AI 塔罗小程序时,我为什么不让大模型自己抽牌:一次上线复盘
前端
这个DBA有点耶18 分钟前
为什么UPDATE比SELECT危险得多?锁范围等于扫描行数
数据库·架构·代码规范
天国梦43 分钟前
国密门禁品牌怎么选?2026年最新3个避坑要点
运维·服务器·数据库·python
骑着蜗牛撵大象32744 分钟前
LangChain 工具调用从声明到闭环:给智能体接上真实的手脚
前端
DB哥讲数据库1 小时前
【达梦数据库安装教程】超详细图文讲解-附达梦安装包
数据库·oracle
数据掘金1 小时前
百度统计后台页面数据异常?从手动调用时机开始排查
前端
hunteritself1 小时前
10 层 4K 实时剪辑,国产工作站进入广电制作核心
大数据·前端·人工智能·深度学习·transformer
踩着两条虫1 小时前
我在浏览器里“盖”了一个村:Vue + Three.js 大屏开发踩坑记
前端·vue.js·three.js
mbshqqb1 小时前
TypeScript基础教程之同步生成器
前端·javascript·typescript