Output Comsol result from Matlab

23 次查看(过去 30 天)
Please help: I have a model in Comsol. I want to output y displacement result at some points [73 74 113 114 151 154 191 194 229 234 269] in the model. But the code is outputing the displacement in the entire domain.
model.result.create('pg5', 'PlotGroup1D');
model.result('pg5').run;
model.result('pg5').create('ptgr1', 'PointGraph');
model.result('pg5').feature('ptgr1').selection.set([73 74 113 114 151 154 191 194 229 234 269]);
model.result('pg5').feature('ptgr1').set('expr', 'v');
model.result('pg5').feature('ptgr1').set('descr', 'Displacement field, Y component');
model.result('pg5').run;
model.result.export.create('data1', 'Data');
model.result.export('data1').set('expr', {'v'});
model.result.export('data1').set('descr', {'descr', 'Displacement field, Y component'});
model.result.export('data1').set('filename', 'xl_disp.txt');
model.result.export('data1').run;
pause(2)
load xl_disp.txt
save('xl_disp','xl_disp')
load('xl_disp','-mat','xl_disp')
Also, I tried this:
mpheval(model, 'expr', 'v', '[73 74 113 114 151 154 191 194 229 234 269]')
But it did not work.
Thank you.
  1 个评论
Shengjiang QUAN
Shengjiang QUAN 2022-8-19
编辑:Shengjiang QUAN 2022-8-19
This is a 5-year late reply. Just record here for newcomers.
TL;DR
Use command `mphinterp`.
u=mphinterp(model,'u','dataset','cpt1');
Details
I encountered the same problem at the day of writing. In my case, I need the displacement components (u and v) at pre-defined 3D cut points with tag "cpt1". As shown in this figure.
Please pay attention to the first entry of `Properties`. This means that the results of `cpt1` dataset would be calculated based on `dset2`. And the results of `dset2` is calculated by keypoints generated by meshgrid. Please check this video to see more details.
And the method to calculate `cpt1` based on `dset2` is -- interpolation.
Thank you.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dialog Boxes 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by