Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I change the frequency values between input source and the output probe? #5

Open
JinZhi-Escape opened this issue Mar 23, 2021 · 8 comments

Comments

@JinZhi-Escape
Copy link

In your second tutorial notebook, I want to change the frequencies of the source and probe. First I want to simply change the 'Omega' parameter in the 'insert_mode' function, but that does not work. The function seems only return the mode information of source and probe. I am new in the inverse design and it can be very helpful if you can give me some suggestions.

Many thanks.

@momchilmm
Copy link
Member

All the examples in the notebooks use the frequency-domain solver, which means that the simulation itself is computed at a single frequency. Note that the omega parameter goes into the simulation too, not just the source and probe. So if you try changing omega in the source and probe but not in simulation, that would indeed produce strange results - you are injecting a source at the "wrong" frequency compared to the simulation. So try changing omega everywhere. If that also produces strange results, please make a minimal working example for us to have a look at!

@JinZhi-Escape
Copy link
Author

thanks for your response. Actually I did changed the 'Omega' parameters both in the 'simulation' function and 'insert_mode' function. I look the codes again and think this might be the problem: In the 'modes.py' file, you write a function called 'get_modes' which can return both 'array of effective indeces of the modes' and 'array containing the corresponding mode profiles'. Then you use it in the 'insert_modes' function, but in the later function, you only return the mode array(screen shoot is shown below).

image

So I think maybe the 'array of effective indeces of the modes' thing can be used to help my work, but I do not know how to modify the code.

many thanks, looking forward to your reply. :)

@momchilmm
Copy link
Member

So let me clarify what the mode solver does - it finds the eigenmodes at a fixed frequency, where the eigenvalues are the effective indexes (i.e. k-vector, or propagation constant) in the propagation direction. These are ordered in decreasing order. We don't really need the values of these indexes, we only need the associated eigenvector - the eigenmode - in order to launch the modal source, which is why we don't store the indexes. The way you can choose between different modes is by setting the m argument in the mode source. In fact as you can see in notebook 2, there's an example of sending m = 1 and m = 2.

@JinZhi-Escape
Copy link
Author

Thanks for your reply which helps me to understand more about the codes. It seems that I did not clarify my question(my fault, sorry).

Simply speaking, I want to use ceviche to simulate a frequency doubler, but some problems occured when I using the codes in the notebook2. At first I thought the codes could change the frequencies between input and output. After the simulation with modified codes, it seems that the codes only result in mode converting. (the simulation result is plotted below)

1

As you can see, the simulation result did not change between input frequency and the output. In my simulation, I set source at omega1 and probe at omega2(omega2 = 2* omega1 and they both had m=1). I did not change the mode_overlap function. I arbitrarily changed the return value of the objective function, but I do not know the meanings of their return values. :(

Here are my new questions(hope I make it clear this time):
Can ceviche simulate a frequency doubler? If it can, what should I do to have a proper objective function to optimize?
I guess I need to do some modification on objective and mode_overlap functions but don't know how.

Many thanks for your help, looking forward to your reply. :)

@ianwilliamson
Copy link
Collaborator

Can ceviche simulate a frequency doubler?

No. I assume you're referring to a device that uses a material with chi2 nonlinearity. These notebooks are demonstrating optimizations of linear devices.

@JinZhi-Escape
Copy link
Author

emmmmm...... that sounds not good.

May I ask you what software you use in this paperAdjoint method and inverse design for nonlinear nanophotonic devices which written by you and your teammates?

It seems that some nonlinearity can be simulated in the experient in the paper. Also, can I use this software and simulate the chi2 nonliearity?

Many thanks to your help. :)

@momchilmm
Copy link
Member

We used angler for that https://github.com/fancompute/angler. ceviche kinda grew out of there, but is mostly focused on inverse design of linear structures. However, even in angler, we only include chi-3 (Kerr) nonlinearity and there is no frequency mixing.

Even without talking about inverse design, It is very hard to do accurate simulations of nonlinear phenomena. That is why most of the times, people come up with a way to compute the expected nonlinear properties from the linear response of the systems at the frequencies of interest. For example, to enhance chi-2 effects, you may optimize a resonator to have strongly confined, high-Q modes with high nonlinear overlap at omega and 2*omega, just by solving for the linear fields at the two frequencies. If you would like to do nonlinear optimizations, my advise would be to try and frame your figure of merit as a function of the linear fields at different frequencies.

@Prettzz
Copy link

Prettzz commented Nov 26, 2022

while running ceviche, I am getting the error
ceviche error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants