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

结果如图所示:

相关推荐
宋浮檀s15 小时前
SQL注入基础+DVWA搭建
数据库·sql·安全·网络安全
dunky15 小时前
Spring AI 深度解析:把 LLM 抽象成 Spring Bean 的底层逻辑
前端
星栈15 小时前
Rust WASM 文件上传全链路:从浏览器到 S3,一个字节都不能少
前端·前端框架·开源
濮水大叔15 小时前
告别 Django Admin!这个 NodeJS 全栈框架让你在 DTO 中直接配置 Table/Form 渲染
前端·typescript·node.js
JarvanMo15 小时前
Flutter 3.44 & Dart 3.12重磅发布!这些新特性太香了
前端
竹林81815 小时前
用Viem替换ethers.js:一次合约交互的"减负"实战,我总算把TypeScript类型搞明白了
前端·javascript
To_OC15 小时前
一个让我懵了半小时的时钟 Bug,注重前端三权分立落地
前端·代码规范
归故里15 小时前
harmony-next.skills 为 AI 而生!
前端·后端·github
Amarantine、沐风倩✨15 小时前
Oracle 性能排查:通过 V$LONG_EXEC_SQLS 快速定位慢 SQL
数据库·sql·oracle
threelab15 小时前
Three.js 3D 热力图效果 | 三维可视化 / AI 提示词
开发语言·前端·javascript·人工智能·3d·着色器