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.

LG beam in cylindrical coordinates

Please login with a confirmed email address before reporting spam

Dear comsolvers,

I define an external matlab function 'laguerre' in comsol to define a Laguerre Gaussian electric field profile. Note that the Laguerre function is in cylindrical coordinates. Eventually, I use this field to define my source as background electric field (Ebx, Eby, Ebz), guess this is cartesian.

My simulation took 4 minutes to run a Gaussian (in cartesian coordinates and without any call to external matlab function), while it took 3.25 h for an LG beam (cylindrical coordinates). In fact, on the 2nd run (with some settings change), it took 6.5 h!

To add further to the frustration, I had to wait for hours after I click on plot. I only try to plot the background field ewfd.Ebx. At this point, I just kill the application.

1) The live link connection to matlab was established and the matlab search path was set to point the location where the matlab function resides. But, I want to know if calling an external function could be the culprit. 2) Transformation from cylindrical coordinate system to carteisian for the solver is time consuming? and the application is trying to do the transformation after I click on plot?

If you have faced similar problems, please drop in a word. Or Can you speculate what you think the problem is or offer any advice that can possibly help me to resolve the issue. Many thanks in advance.


1 Reply Last Post 15 mai 2018, 04:55 UTC−4
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 15 mai 2018, 04:55 UTC−4

As far as I can tell you are doing everything correctly. Calls to Matlab are expected to be slow.

If you field doesn't change while simulating you are much better off calculating the field once and use an interpolation function in your Comsol model to get the data.

You can send the model and M-file to support and we can have a look to see if there is something we can do to speed things up, but I'm not optimistic.

-------------------
Lars Gregersen
Comsol Denmark
As far as I can tell you are doing everything correctly. Calls to Matlab are expected to be slow. If you field doesn't change while simulating you are much better off calculating the field once and use an interpolation function in your Comsol model to get the data. You can send the model and M-file to support and we can have a look to see if there is something we can do to speed things up, but I'm not optimistic.

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.