📄 lshape1.m
字号:
kappa=[0.2 0; 0 0.2]; % conductivity matrix
Q=0.01100; % uniform heat source
num_integ_pts=1; % 1-point quadrature
[fens,gcells] = targe2_mesher({...
['curve 1 line 20 0 48 0'],...
['curve 2 line 48 0 48 48'],...
['curve 3 line 48 48 0 48'],...
['curve 4 line 0 48 0 13'],...
['curve 5 line 0 13 20 13'],...
['curve 6 line 20 13 20 0'],...
'subregion 1 property 1 boundary 1 2 3 4 5 6',...
['m-ctl-point constant 5.5']
}, 1.0);
prop=property_diffusion(struct('conductivity',kappa,'source',Q));
mater=mater_diffusion (struct('property',prop));
feb = feblock_diffusion (struct ('mater',mater,...
'gcells',gcells,...
'integration_rule',tri_rule(num_integ_pts)));
geom = field(struct('name',['geom'], 'dim', 2, 'fens',fens));
theta=field(struct('name',['theta'], 'dim', 1, 'nfens',...
get(geom,'nfens')));
fenids=[fenode_select(fens,struct('box',[48 48 0 48],...
'inflate', 0.01)),...
fenode_select(fens,struct('box',[0 48 48 48],...
'inflate', 0.01))];
prescribed=ones(length(fenids),1);
comp=[];
val=zeros(length(fenids),1);
theta = set_ebc(theta, fenids, prescribed, comp, val);
theta = apply_ebc (theta);
theta = numbereqns (theta);
K = start (sparse_sysmat, get(theta, 'neqns'));
K = assemble (K, conductivity(feb, geom, theta));
F = start (sysvec, get(theta, 'neqns'));
F = assemble (F, source_loads(feb, geom, theta));
theta = scatter_sysvec(theta, get(K,'mat')\get(F,'vec'));
% Plot
gv=graphic_viewer;
gv=reset (gv,[]);
T=get(theta,'values');
dcm=data_colormap(struct('range',[min(T),max(T)],'colormap',jet));
colorfield=field(struct ('name', ['colorfield'], 'data',...
map_data(dcm, T)));
geomT=field(struct ('name', ['geomT'], ...
'data',[get(geom,'values'), get(theta,'values')]));
for i=1:length (gcells)
draw(gcells(i), gv, struct ('x',geomT, 'u',0*geomT,...
'colorfield',colorfield, 'shrink',0.9));
draw(gcells(i), gv, struct ('x',geom, 'u',0*geom, ...
'facecolor','none'));
end
view(2)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -