- 积分
- 0
- 注册时间
- 2011-9-27
- 仿真币
-
- 最后登录
- 1970-1-1
|
在Comsol 4.2 with matlab运行下面这段代码。该问题是来自帮助文档中的稳态热传导问题。我想提取总体刚度阵。1*1的矩形我划的网格是2*2的,按理说应该有9个自由度。但是得到的总刚size(MA.K)的结果却是25*25。请高人指点下,谢谢了。- %% Create a new model object
- model = ModelUtil.create('Model');
- %% Create a square geometry
- geom1 = model.geom.create('geom1', 2);
- geom1.feature.create('sq1', 'Square');
- geom1.run;
- mphgeom(model,'geom1',...
- 'vertexlabels','off',...
- 'facelabels','on',...
- 'facemode','on',...
- 'facelabelscolor','r');
- %% Setup material properties
- mat1 = model.material.create('mat1');
- def = mat1.materialModel('def');
- def.set('thermalconductivity',{'4e2'});
- def.set('density',{'0'});
- def.set('heatcapacity',{'0'});
- %% Define the physics settings
- ht = model.physics.create('ht', 'HeatTransfer', 'geom1');
- hs1 = ht.feature.create('hs1','HeatSource',2);
- hs1.selection.set(1);
- hs1.set('Q',1,'1e5');
- temp1 = ht.feature.create('temp1','TemperatureBoundary',1);
- temp1.selection.set([1 2]);
- %% Create a mapped mesh
- mesh1 = model.mesh.create('mesh1','geom1');
- dis1 = mesh1.feature.create('dis1','Distribution');
- dis1.selection.set([1 2]);
- dis1.set('numelem',2);
- mesh1.feature.create('map1','Map');
- mesh1.run;
- mphmesh(model,'mesh1')%visualize the mesh
- %% Solve the problem
- std1 = model.study.create('std1');
- std1.feature.create('stat','Stationary');
- std1.run;
- %% Extract results
- U = mphgetu(model); %get the temperature
- model.sol('sol1').feature('v1').set('scalemethod','none');
- MA = mphmatrix(model,'sol1','Out',{'K','L'});
- size(MA.K)
复制代码 |
|