Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

postprocessing in Matlab, multiple geometries

Please login with a confirmed email address before reporting spam

Hi,

I made MPH file in Comsol GUI with multiple geometries, saved it and now want to use it in Matlab Interface.
So I load the file with flload and then try to select one geometry with

fem=xfem.fem{3};

and use it with

u = postinterp(fem,'u',pos,'solnum','end');

I get error:

"Extended mesh found in the FEM structure. You need to call meshextend first."

Then, I try to put before postinterp:

fem.xmesh=meshextend(fem);

but I get another msg:

fem.elemcpl{1}.g{1} is not a valid geometry number

Anyone can help?

thanks

2 Replies Last Post Jul 22, 2009, 10:13 a.m. EDT
David Wenger Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 2 decades ago Jul 14, 2009, 3:40 a.m. EDT
Hi,

I usually do the following:

COMSOL:
1) Setup of model in Comsol GUI
2) Solve it with one set of parameters, check the results
3) Reset model
4) Create mesh
5) Save
6) Export as "fem"

MATLAB:
1) Save fem

M-FILE:
1) clear fem
load fem

fem.xmesh=meshextend(fem);
fem.sol=femstatic(fem, ...
'solcomp',{' ............

[if you save your Comsol GUI (incl. solving and postprocessing) as .m-File and open it with Matlab, you see the necessary comands]

Regards

David
www.comsol.de/company/consultants/wenger/
Hi, I usually do the following: COMSOL: 1) Setup of model in Comsol GUI 2) Solve it with one set of parameters, check the results 3) Reset model 4) Create mesh 5) Save 6) Export as "fem" MATLAB: 1) Save fem M-FILE: 1) clear fem load fem fem.xmesh=meshextend(fem); fem.sol=femstatic(fem, ... 'solcomp',{' ............ [if you save your Comsol GUI (incl. solving and postprocessing) as .m-File and open it with Matlab, you see the necessary comands] Regards David www.comsol.de/company/consultants/wenger/

Please login with a confirmed email address before reporting spam

Posted: 2 decades ago Jul 22, 2009, 10:13 a.m. EDT
Unfortunately, by saving Comsol GUI as M-file, you don't get how to use 'postinterp' function, because normally GUI uses postplot and similar functions...

But here's what they wrote me from Comsol Support:


You should use xfem as input to postinterp, and use the property
'geomnum' to control on which geometry interpolation should take
place. Thus, something like

u = postinterp(xfem,'u',pos,'solnum','end','geomnum',3);

where number 3 is replaced with the appropriate number in your
specific model.

Sincerely,

Markus Jonsson
Comsol Support
Unfortunately, by saving Comsol GUI as M-file, you don't get how to use 'postinterp' function, because normally GUI uses postplot and similar functions... But here's what they wrote me from Comsol Support: You should use xfem as input to postinterp, and use the property 'geomnum' to control on which geometry interpolation should take place. Thus, something like u = postinterp(xfem,'u',pos,'solnum','end','geomnum',3); where number 3 is replaced with the appropriate number in your specific model. Sincerely, Markus Jonsson Comsol Support

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.