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.

Syntax to invoke solutions at a specific frequency in the frequency domain interface

Please login with a confirmed email address before reporting spam

Hi all,
in short: When multiple frequencies are solved for in the frequency domain, what is the syntax to invoke the solution at a specific frequency?

In detail: I am modelling a nonlinear optical process enhanced by a nanoparticle, see model attached. I use the wave optics module with frequency domain interfaces. In a first study step, I compute separately the field distribution created by two laser beams at the frequencies f_pump and f_stokes respectively. I can visualize both of them and they seem correct. Those two fields induce a nonlinear excitation, and the resultant field distribution is calculated in the second study step. I introduce the excitation through an external current density node. I would like to write there something like (the actual physical expression is more complicated) chi3*exc.Ex(f_pump)^2*exc.Ex(f_stokes), but I couldn't figure out what is the syntax to invoke the solution at a specified frequency. However, it should be possible, since the two fields can be visualized separately. Or am I missing something on how the solver works and should I structure the model differently?

Of course, any general comment on the model is appreciated as well

Thanks in advance,
Attilio


4 Replies Last Post Sep 30, 2016, 10:40 a.m. EDT
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Sep 29, 2016, 10:06 a.m. EDT
Hello Attilio,
I believe you may be looking for the "with" operator. See Reference Manual for COMSOL Multiphysics, version 5.2a, page 250.
Best,
Jeff
Hello Attilio, I believe you may be looking for the "with" operator. See Reference Manual for COMSOL Multiphysics, version 5.2a, page 250. Best, Jeff

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Sep 29, 2016, 12:36 p.m. EDT
Hi Jeff,
I think your suggestion goes in the right direction, still I cannot make it work yet.

I have modified my simplified expression (see attached model):
"chi3*exc.Ex(f_pump)^2*exc.Ex(f_stokes)" into "chi3*with(1,exc.Ex)^2*with(2,exc.Ex)"
but this results into the Error "The solution specification is nonscalar or out of range".
Interestingly, only the call "with(2,exc.Ex)" triggers the error. However, I can plot both solution 1 and 2 when postprocessing.

Possibly this is because the with operator can be used for result evaluation only, but not in calculations? If so, can you suggest an alternative to access the solutions during calculation? Note I have still version 4.4 at the moment.

Any help of course much appreciated.
Hi Jeff, I think your suggestion goes in the right direction, still I cannot make it work yet. I have modified my simplified expression (see attached model): "chi3*exc.Ex(f_pump)^2*exc.Ex(f_stokes)" into "chi3*with(1,exc.Ex)^2*with(2,exc.Ex)" but this results into the Error "The solution specification is nonscalar or out of range". Interestingly, only the call "with(2,exc.Ex)" triggers the error. However, I can plot both solution 1 and 2 when postprocessing. Possibly this is because the with operator can be used for result evaluation only, but not in calculations? If so, can you suggest an alternative to access the solutions during calculation? Note I have still version 4.4 at the moment. Any help of course much appreciated.


Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Sep 29, 2016, 2:33 p.m. EDT
I'll invite you to please contact COMSOL's support team for further assistance.
Best regards,
Jeff
I'll invite you to please contact COMSOL's support team for further assistance. Best regards, Jeff

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Sep 30, 2016, 10:40 a.m. EDT
Eventually, I found out I have to configure the second study step to inherit from the first step all Dependent variables not solved for, see attached snippet.

This seems to have solved the problem. However, does this means the "with" operator can be used for calculations as well, and not only in postprocessing?

Best
Attilio
Eventually, I found out I have to configure the second study step to inherit from the first step all Dependent variables not solved for, see attached snippet. This seems to have solved the problem. However, does this means the "with" operator can be used for calculations as well, and not only in postprocessing? Best Attilio

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.