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

结果如图所示:

相关推荐
2401_8578652316 小时前
Python日志记录(Logging)最佳实践
jvm·数据库·python
小李子呢021116 小时前
JS中的Set 核心认知
前端·javascript·es6
程序员阿耶16 小时前
【前端面试知识点】CSS contain 属性如何用于性能优化?它有哪些可选值及作用?
前端·面试
阳火锅16 小时前
34岁前端倒计时:老板用AI手搓系统那天,我知道我的“体面退休”是个笑话
前端·后端·程序员
姓王者16 小时前
# 解决 Nautilus 自定义终端插件安装依赖问题
前端·后端·全栈
爱可生开源社区16 小时前
SCALE 二月榜单发布:新增三款国内外大模型,新增模型测评实验室!
数据库
宸翰16 小时前
在VS code中如何舒适的开发Python
前端·python
奋斗的小鱼干16 小时前
windows龙虾的安装
前端
程序员阿峰16 小时前
【JavaScript面试题-this 绑定】请说明 `this` 在不同场景下的指向(默认、隐式、显式、new、箭头函数)。
前端·javascript·面试
用户3187308286516 小时前
Python 短信接口高效集成指南:Django/Flask 框架最佳实践
前端