NanoComp / meep

free finite-difference time-domain (FDTD) software for electromagnetic simulations
GNU General Public License v2.0
1.2k stars 612 forks source link

Imaginary Chi3 (Nonlinear absorption) #1099

Open pierreluc-plt opened 4 years ago

pierreluc-plt commented 4 years ago

Hi all, Is there a way to simulate an imaginary chi3 (3rd order susceptibility) in a material? I am trying to simulate nonlinear absorption. When I input a complex value for the chi3 of a material, my session crashes (using google colab) so my guess is that complex chi3 are not implemented. Are there any workarounds?

Thanks

stevengj commented 4 years ago

No, this is not supported yet.

You can't simply put in a complex number for χ⁽³⁾ in the time domain — it would be unphysical. One physically reasonable way to implement a lossy nonlinearity is probably to put a nonlinearity into the polarization equation (dP/dt). A similar scheme (albeit using a first-order ODE for the nonlinear polarization) was implemented in this paper, for example.

(It should give an error, not crash?)

danielwboyce commented 4 years ago

@pierreluc-plt If you've got Meep working on Google Colab, maybe you would consider sharing some of your secrets on Issue #460? Some of the more active contributors use Meep on macOS or a flavor of Linux, so supporting users with Google Colab isn't something we're familiar with.

pierreluc-plt commented 4 years ago

@stevengj Thanks for the answer. I will try it.

As for the "crash", it does crash my Colab session (it resets my environment and I have to reinstall meep). Here is what it displays (sorry, it's in French but it means "Your session as crashed for an unknown reason"): image

Here is the logging information: image

It's not a big problem but I just thought I would give you the information.

@danielwboyce I just added an answer to Issue 460. Thanks for pointing it out to me.

stevengj commented 4 years ago

Would be good to check the job output if that is possible. A lot of Meep routines call abort with error messages if they encounter invalid parameters, which is different from a crash resulting from a bug. Python type-conversion failures also abort (#699).

(Single-processor jobs in Python now throw exceptions instead: #953.)