# Issue with setting simulation time from script and running parameter sweep

#1

Hi Ahsan,

Thanks for your help. My mode source worked.
But now I have another issues:

1. Simulation time for varFDTD which by default is 4000 (fs) but since I have not mentioned it in script so its automatically showing 4e+18 (fs). How can I correct it ?

2. If i force quit my parameter sweep, then I get a following error:

How can I fix this? I can not switch back to layout mode because I am already working in script.

Thanks.

Can’t add mode source in script
#2

I am guessing that you are trying to set the simulation time from script. However when you are setting the time, you are using “fs” as your unit. The main thing to remember here is that the unit is always SI in the script environment. So when you want to set the simulation time to 4000 fs, the command should be,

set("simulation time",4000e-15);

If you use 4000 instead of 4000e-15 then it becomes 4e18 fs and that is what you are seeing I believe.

When you click on force quit, the simulation quits and no data is saved. That is why when the sweep tries to save the results, it finds that the results is unavailable. This is most likely casing the error message. For a sweep to be able to save the result, all the files created by the sweep must contain results. If you want to quit a simulation and still get the result at that point then use the “quit and save” option instead.

#3

Thanks I solved the problem of simulation time.
About my other query, as far as I understand, while running the parameter sweeps, after every single parameter sweep do I need to switch back to the layout mode? If I need to do so, then do I have to add command “switchtolayout;” ? Where should I add this command ? After running parameter sweeps, I cannot obtain any data.

So basically I have written my script in the model group structure

and I am trying to run the sweeps using the tab “Optimization and Sweeps”.

Do I need to write the script for the parameter sweeps also in the Model-Script section? If you want I can send u my whole script.

Thanks.

#4

Did you get any error while running the parameter sweep? I know you mentioned getting the error message saying “The data could not be plotted or imaged”. However I though that you got that message when you chose the “force quit” option and forced the sweep to end. If you don’t do that, do you still get error from the sweep?

If you can share the simulation file with me then that would definitely help. I can run the sweep and check it there is any issue with the settings.

#5

When I run the sweep, it does not show any progress in progress bar for each parameter sweep but it shows progress in overall completion status.

At the end of the sweep, it does not show any results. Well I get the message (which I showed you earlier) at the end of the sweep. I am attaching my file along. Please help me out with this.

SiN racetrack resonator.lms (489.3 KB)

Thanks.

#6

Hi. I have taken a quick look at your file and I believe there might some issues in setting up the simulation. For example, the script in “model” has an “if” statement at the end which is causing the script to fail. If you remove the “if” then simulation runs but the value of T at each monitor is still zero. I will take a look at the file more closely tomorrow. In the mean time please take a look at this example in KB where step by step instructions are provided on how you can set up the simulation for such a device in MODE Solutions.

https://kb.lumerical.com/en/index.html?pic_passive_getting_started_ring_resonator_mode1.html

#7

Hi. I have looked at your file again today and have consulted a colleague (@kchow) about how best to simulate this device. Now there are a few issues in your simulation setup that is forcing the simulation to fail and that is why when you do a sweep you have no results available. However, before trying to fix the simulation setup, we believe that it is important to find out the best option to simulate such a large ring resonator. Please check out this KX post (Best approach for simulating large ring resonators) by @kchow on how to simulate a large ring resonator in a much more efficient and accurate way. If you have any question about the approach please feel free to comment on the corresponding post.

#8

Hi Ahsan,

I have checked the earlier file of Ring Resonator and I could not find the solution to my problem. About the best option to simulate my structure, I tried to find the KX post by @kchow but I could not find it. Can you specifically guide me to that post. Moreover, if @kchow can show me an example of script to simulate such ring structure, than that would be great.
I am not able to find out, what is the reason for sweeps to not work when I am writing my script in Model-Setup-Script section and defining the values for the variables in the variables section.
Please guide me through an appropriate example of script.
Should I re-write my whole script in Script File Editor section?
If @kchow can comment on this, should be helpful.

Thanks.

#9

Sorry I forgot to add the link. I have updated the earlier post with the link to the KX issue.

#10

A post was split to a new topic: Optimization - Large ring