Output Comsol result from Matlab
23 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Shengjiang QUAN
le 19 Août 2022
Modifié(e) : Shengjiang QUAN
le 19 Août 2022
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.
Réponses (0)
Voir également
Catégories
En savoir plus sur Dialog Boxes dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!