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

结果如图所示:

相关推荐
徐小夕37 分钟前
jitword 协同文档3.2发布:打造浏览器中最强word编辑器
前端·架构·github
纯爱掌门人2 小时前
干了这么多年前端,聊聊 2026 年我们到底还值不值钱
前端·程序员
houhou2 小时前
Monaco Editor 集成指南:从配置到优化
前端
hunterandroid2 小时前
[Android 从零到一] Custom View 自定义绘制:从 onDraw 到完整交互
前端
李明卫杭州2 小时前
Vue3 v-memo 指令详解:让你的列表渲染性能翻倍 🚀
前端
梨子同志2 小时前
Monorepo
前端
lihaozecq2 小时前
继 Web Coding Agent 后,我做了一个本地优先的桌面 AI Agent
前端·agent
用户298698530143 小时前
在 React 中使用 JavaScript 将 Excel 转换为 SVG
前端·javascript·react.js
CodingSpace3 小时前
ESLint
前端
Csvn3 小时前
异步错误捕获的六大陷阱:await 裹着 try-catch 就一定稳了吗?
前端