I am trying to simulate the second harmonic generation in gold nanorods. This paper (link: http://link.springer.com/article/10.1007/s11468-015-9921-6) provides the nonlinear responses of the material in terms of polarization. It is possible to create a new material plugin by discretizing the equations and solving E(n+1), like the steps in the Lorentz medium example?

# material plugin in the simulation of gold nanorods SHG

**bkhanaliloo**#2

Thank you for reaching out. To answer your question I would need some further information from you, but I provided a few cases that might help you to solve the problem by simplifying it.

A good starting point for Chi2 problems is here. Here we assume that Chi2 is a constant number i.e. it either a) does not change with frequency b) the change is negligible in the bandwidth of interest c) your source operated at a single frequency and you know the material Chi2 response at the specific frequency.This should work for most of the cases and hopefully your problems fits into one of these categories.

The problem gets a bit complicated when your material response behaves as a Lorentz medium. Fortunately, since this case is linear with electric field, the polarisation response with electric field in frequency domain can be Fourier transformed to be solved in FDTD. You can learn more about Lorentz medium algorithm analysis here.

However, materials can have a complicated Chi2 reponse. This becomes challenging if you are trying to study a pulse behaviour in this medium where you need to know the response of the medium at each frequency to understand the shape of the output field.

If you provide me with more information, we can plan on simplifying your case and if we are lucky, we will not need to write a code in c++ where require more time and effort.

I hope this was helpful.

**chaulwong5-c**#3

Hi.

i can’t find a suitable value of Chi2 from literature and I do want to reproduce exactly the paper’s result, so I tried to follow the equations provided by the paper. However, since the equations involve cross product, the discretization ends up with the polarization of certain direction depends on another direction (such as the magnetic nonlinear term ), I am not sure C++ can handle this kind of problem.

**bkhanaliloo**#4

Hi @chaulwong5-c,

I am a bit confused. **P** in your equation seems to be the momentum of a charged particle (electron here) that travels inside a magnetic field **B** . More clearly the right hand side is the magnetic field force on a charged particle. Please do advise me if this is not the case.

Genrally Chi2 can have a complicated form such as:

but we are limiting ourselves to simple cases and for simplicity we use Chi_xx rather than Chi_xxx. For Chi2 nonlinearities, Lumerical can handle the equations where Chi2 is either a constant or has only constant diagonal terms i.e. the polarisation on each direction depends only on the electric field on that direction:

For the latter case, you can set the *Diagonal Anisotropy* from the *Material Database* as is shown below:

Please let me know if I could answer your question.

Calculation of second harmonic generation in Lumerical

**chaulwong5-c**#5

Hi,

I am a bit confused. P in your equation seems to be the momentum of a charged particle (electron here) that travels inside a magnetic field B . More clearly the right hand side is the magnetic field force on a charged particle. Please do advise me if this is not the case.

I think the **P** in the equation is representing the polarization of elelctrons, the subscript “f” means free electrons. The equation seems to be in the form of momentum because the derivation was started with the Newton’s law of motion. For more details, you can take a look at this paper (link: https://www-osapublishing-org.ezproxy.lb.polyu.edu.hk/jlt/abstract.cfm?uri=jlt-32-21-3402)

I know I can simplify the nonlinearities of the material by introducing a Chi2 term. Other than that, this is my question.

In the paper, they show two equations to describe the polarization of free electrons and bound electrons when it interacting with light,

the PD and PL are the Drude and Lorentz terms respectively

I found that the lorentz term is exactly as same as the discretized form that has been shown in the powerpoint slides of the tutorial. I know they may use the the program code to do the FDTD simulation instead of using FDTD commercial solvers, but i am curious whether I can couple these equation with the FDTD simulation by the material plugin function of this solver. I tried to discretize the equations, say the magnetic term of the bound electron polarization equation, since it involves cross product, the discreteized form is a bit messy.

So my question is: Is it possible to write a code in C++ to include the nonlinear polarization term (other than PD and PL) in the material plugin model, so that the simulation shows the nonlinear behavior of the material?

**bkhanaliloo**#6

Dear @chaulwong5-c

This is an interesting problem to solve!

You are right, we can use the material plugin that includes the material nonlinear response. If your equations are simplified to a Lorentz form, you can follow the steps as described in the link I provided earlier. The video explains how you can write your own script from scratch and a bit of background how you can find your fields electric field in time *n+1* for the Lorentz case.

Unfortunately, I din’t have time to simplify the equations but the problem seems to be similar as the Lorentz example i.e. polarisation at *n+1* depends on the polarisation at *n* and *n-1*. In your case, since your polarisation at each direction depends on the polarisation in other directions, your loop to calculate the field on each direction will be slightly challenging. Also, I don’t have a very clear idea how you want to deal with the third term on the right hand side of the first equation which requires position derivatives. I am guessing that it might require extra storing fields to recall in your loops as for example polarisation at point *x* will require to know the polarisation at *x+dx* and *x-dx* where *dx* is the size of mesh or Yee cell along the x direction.

I hope the video can help you to solve the problem.

Second harmonic generation from a MoS2 monolayer