Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

mphglobal does not work when model has more than one solution/study?

Please login with a confirmed email address before reporting spam

When I do a Mode Analysis (emw) in COMSOL with matlab I can extract the effective refractive index with

mphglobal(model, 'emw.neff'')


However, if I add another study like thermal stress (ts) to calculate the refractive index profile and then use that to find the modes, I can no longer extract emw.neff.

One would think that something like this should work:

mphglobal(model,'solname','sol2', 'emw.neff')


however mphglobal does not want to take 'solname' as an argument. But, as I was writing this I found that this helps:

[sz,ndofs,list,name,type]=mphgetp(model,'solname','sol2')


and then use "list" to calculate neff with

neff=real(1j*list/(2*pi/lambda0));

Done!

2 Replies Last Post Apr 1, 2012, 2:32 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 20, 2011, 6:19 p.m. EST
Thanks a lot for this very helpful advice!
I am now doing it exactly like this.
I do not know why it is not possible to extract the global variable. And unfortunately the Comsol interface always adds a real around the neff, although it shows the complete complex neff in the selection dropdown menu for the modes.
All this is a bit discouraging and seems arbitrary. But at least with the way via Matlab and mphgetp it works. :-)

Best regards

Arian
Thanks a lot for this very helpful advice! I am now doing it exactly like this. I do not know why it is not possible to extract the global variable. And unfortunately the Comsol interface always adds a real around the neff, although it shows the complete complex neff in the selection dropdown menu for the modes. All this is a bit discouraging and seems arbitrary. But at least with the way via Matlab and mphgetp it works. :-) Best regards Arian

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 1, 2012, 2:32 a.m. EDT

When I do a Mode Analysis (emw) in COMSOL with matlab I can extract the effective refractive index with

mphglobal(model, 'emw.neff'')


However, if I add another study like thermal stress (ts) to calculate the refractive index profile and then use that to find the modes, I can no longer extract emw.neff.

One would think that something like this should work:

mphglobal(model,'solname','sol2', 'emw.neff')


however mphglobal does not want to take 'solname' as an argument. But, as I was writing this I found that this helps:

[sz,ndofs,list,name,type]=mphgetp(model,'solname','sol2')

neff=real(1j*list/(2*pi/lambda0));

Done!







I try
mphglobal(model, 'emw.neff'')
and
[sz,ndofs,list,name,type]=mphgetp(model,'solname','sol2')
and then use "list" to calculate neff with neff=real(1j*list/(2*pi/Lambda)),

but, i wonder why the answer is different by using that two methods.
the Neff is not the same...
do you faced this?
by the way, im using comsol 4.2.
thank
[QUOTE] When I do a Mode Analysis (emw) in COMSOL with matlab I can extract the effective refractive index with mphglobal(model, 'emw.neff'') However, if I add another study like thermal stress (ts) to calculate the refractive index profile and then use that to find the modes, I can no longer extract emw.neff. One would think that something like this should work: mphglobal(model,'solname','sol2', 'emw.neff') however mphglobal does not want to take 'solname' as an argument. But, as I was writing this I found that this helps: [sz,ndofs,list,name,type]=mphgetp(model,'solname','sol2') neff=real(1j*list/(2*pi/lambda0)); Done! [/QUOTE] I try mphglobal(model, 'emw.neff'') and [sz,ndofs,list,name,type]=mphgetp(model,'solname','sol2') and then use "list" to calculate neff with neff=real(1j*list/(2*pi/Lambda)), but, i wonder why the answer is different by using that two methods. the Neff is not the same... do you faced this? by the way, im using comsol 4.2. thank

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.