Bootstrap

TPMS曲面的matlab生成及可视化-导出stl文件-导出abaqus的inp文件-周期性边界条件施加

自编写函数包含的功能:
tpms曲面生成
tpms可视化
tpms曲面采用拉普拉斯方法进行平滑(为了可以在abaqus中通过单元质量检测),函数为SmoothIsosurface
tpms导出stl文件,函数为WriteSTL
tpms导出inp文件(施加周期性边界条件)函数为WriteINP

clc
clear
Numberofgridpoints=[20,20,20];
Numberofunitcells=[1,1,1];
[x, y, z]=meshgrid(linspace(0, Numberofunitcells(1),Numberofgridpoints(1)), ...
                linspace(0, Numberofunitcells(2),Numberofgridpoints(2)), ...
                linspace(0, Numberofunitcells(3),Numberofgridpoints(3)));

cx = cos(2*pi*x); cy = cos(2*pi*y); cz = cos(2*pi*z); 
sx = sin(2*pi*x); sy = sin(2*pi*y); sz = sin(2*pi*z);
c2x = cos(2*2*pi*x); c2y = cos(2*2*pi*y); c2z = cos(2*2*pi*z); 
s2x = sin(2*2*pi*x); s2y = sin(2*2*pi*y); s2z = sin(2*2*pi*z);
c3x = cos(3*2*pi*x); c3y = cos(3*2*pi*y); c3z = cos(3*2*pi*z); 
s3x = sin(3*2*pi*x); s3y = sin(3*2*pi*y); s3z = sin(3*2*pi*z);

f= (sx.*sy).*sz+(sx.*cy).*cz+(cx.*sy).*cz+(cx.*cy).*sz;
%f = cx+cy+cz;

FV=isosurface(x,y,z,f,0); 
%FV3=reducepatch(FV3,30^3);%缩减FV3的补片的面数,同时尝试保留原始的整体形状
% FV=reducepatch(FV,0.9);

newFV=ClearIsosurface(FV,1e-3);
newFV = SmoothIsosurface(newFV,1e-3);
WriteINP(newFV, 'main.inp')

在这里插入图片描述

;