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
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 Center 및 File Exchange에서 Dialog Boxes에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!