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.

Is it possible toselect a particular solution of a certain data set using "withsol"

Please login with a confirmed email address before reporting spam

I have 2 study steps giving 2 data sets under different boundary conditions. I now want to be able to access the mode solutions of both the data sets and integrate them across the entire geometry. The new operator "withsol" seems to be the answer if I have control over which eigensolutions to include in the integration. Is that a possible?

I am attaching a simplistic model for the same. The variable to evaluate is defined as kappaL and kappaR in "Variables" node.


6 Replies Last Post 08.10.2015, 01:23 GMT-4
Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 16.09.2015, 16:47 GMT-4
Hi,

Yes, that is possible by using the setval() argument to withsol().

See for example the discussion in www.comsol.com/community/forums/general/thread/86181

Regards,
Henrik
Hi, Yes, that is possible by using the setval() argument to withsol(). See for example the discussion in http://www.comsol.com/community/forums/general/thread/86181 Regards, Henrik

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 19.09.2015, 01:02 GMT-4
Thank you, Henrik. So, for a certain eigen value, it would be setval('solnum', ##)??
Thank you, Henrik. So, for a certain eigen value, it would be setval('solnum', ##)??

Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 21.09.2015, 03:04 GMT-4
Hi,

In your case it probably easiest to pick by eigenvalue number (rather than by value). Use setind() like in withsol('sol1',emw.normE,setind(lambda,2)) to pick eigenvalue number 2.

Trick: Use withsol() in a plot to see that it works as expected. With the expression above you can override the Data set and Mode index selectors in the plot.

Regards,
Henrik
Hi, In your case it probably easiest to pick by eigenvalue number (rather than by value). Use setind() like in withsol('sol1',emw.normE,setind(lambda,2)) to pick eigenvalue number 2. Trick: Use withsol() in a plot to see that it works as expected. With the expression above you can override the Data set and Mode index selectors in the plot. Regards, Henrik

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 22.09.2015, 05:08 GMT-4
Thank you, Henrik, It works perfectly:) One final question: is there a way to do the same thing by defining variables in the variables section? I have checked that the "withsol" command works for the second set of solutions but not if I try to use the first set of solutions that is stored as Solution Store 1.
Thank you, Henrik, It works perfectly:) One final question: is there a way to do the same thing by defining variables in the variables section? I have checked that the "withsol" command works for the second set of solutions but not if I try to use the first set of solutions that is stored as Solution Store 1.

Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 23.09.2015, 02:13 GMT-4
Hi,

It should work under Variables too. Variables containing withsol() operators can of course not be used in a place in the solver sequence before the referenced solution is computed. But that should not be the issue here, since it seems to be the first solution (='sol2') which causes problems.

Please submit your model to support if you cannot sort out this problem.

Regards,
Henrik
Hi, It should work under Variables too. Variables containing withsol() operators can of course not be used in a place in the solver sequence before the referenced solution is computed. But that should not be the issue here, since it seems to be the first solution (='sol2') which causes problems. Please submit your model to support if you cannot sort out this problem. Regards, Henrik

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 08.10.2015, 01:23 GMT-4
Thank you, Henrik. It works for my requirements!
Thank you, Henrik. It works for my requirements!

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.