How to add a slow decay component to a CW source in script

Hello there,
I am actually playing with the parameters of a very basic cavity laser with Distributed Bragg Fibers on both sides.
The link:

I have a CW source as the pump. The following script was present in KB:

this script shows how to create a custom time signal


specify signal

t = linspace(0,150000e-15, 40000);
lc = 750e-9; # wavelength
w_center = (c/lc)2pi;
delta_t = 30e-15;
offset1 = 100e-15;

define amplitude and phase

amp = (t < offset1)exp(-0.5(t-offset1)^2/delta_t^2) + (t >=offset1);
phase = -w_center*t;

set the signal for the desired source



Now in the Fourier Domain Analysis, I am getting two very high frequency components. I suspect that it arises due to the abrupt shutdown of the CW source exactly at 50ps. So, I want to add a slow-decay component to the source starting from 30ps so that I can verify my hypothesis. Can you please help me do that?

Hello @Zaheen.azad,

If you want a “CW source” then why not simply set the center frequency and bandwidth. The solver will automatically produce a well behaved time signal. By setting the time signal you can uninetionally introduce frequencies and sampling artifacts that may alter your results.

I’ll be happy to help you develop any time signal you would like, but this an adventure that requires testing. Please help me to understand you application a bit more.


Thanks for getting back to me. Since you asked for more backdrop, here it goes: this is nothing but the “Simple Cavity Laser” present in your application database. The .fsp and .lsf files are all present there. Here’s the drive link:

I am analyzing this design as a prelude to my own research in plasmonic nanolasers. I am working as an RA in my university’s nanophotonics research group.

The Fourier analysis is done to visualize at which frequency the source is emitting and at which frequency lasing is achieved.

As you can see, source emission occurs at 400Thz and lasing is achieved at 200Thz. But there are two artifacts/outliers between 5000 and 6000 Thz. My professor has asked me to explain/eradicate these two outliers. My theory is that this is happening due to the abrupt shutoff of the source at 50ps. Hence, I want to add a slow-decay component starting from 20-25 ps to see what happens. If there’s gap in my knowledge (which probably is the case), I would love to hear from you why these artifacts are showing up.
Also I configured the source as you told me:

Still, the artifacts show up. So what should I do now?

Hello @Zaheen.azad,

Thanks for your background on the application. It is interesting to hear what users are working on.

This is related to properties of the Fourier transform, in particular you may find it interesting to consider the Gibbs Phenomenon. You have defined a delta like signal in frequency space (in the bandwidth of interest anyway), by making a step like time signal. I did not mean an actual “CW source” since this causes errors for time domain methods, and you do not lose anything by having a finite bandwidth. So I would suggest defining your signal in frequency space with a narrow bandwidth, and these feature should disappear.

If you really want you can use a windowing function in the time domain, but this will have the exact same effect as setting bandwidth in frequency domain.


Thanks for the swift reply. I tried a few bandwidths i.e. 10 -20 Thz. But the artifacts show no sign of going away. The amplitude of both remain the same too

You will need to also extend the sim time. These are due to the simulation abruptly shutting off I believe. Let me know if this effects your results.

Extended sim time by 10 fold and set BW to 150Thz. Yet not sign of them going away. But as you yourself said, the source is abruptly shutting off at the end of the simulation. This is why I have been talking about adding a decay component sometime prior to the end of sim. so that the abrupt shutoff would have minimal effect.

Could you share a screenshot of how your source is set-up?

These are high frequency components, so maybe try changing the time step to see what happens.

Since these frequency components are certainly numerical artifacts, and correspond to hard x-rays, I would not be too concerned with them. They will not effect your simulation and as long as you are not interested in hard x-rays then they should not effect your results either. If you limit your x-axis to 3000 THz (or 100nm) then you will not see them.


Here’s the source settings. I increased the bandwidth to 100THz at one point, but the artifacts remained unscathed.

Hello @Zaheen.azad,

It seems you have not changed the source settings. Make sureto make changes in layout mode or they will not be saved and you must click “set frequency/wavelength” if you choose to set it that way.


I did change the source settings as you asked and then saw no impact. That’s why I reverted back to the original.
I always suspected these are numerical artifacts, but not due to the frequency being a delta as you suggested. But due to the fact that the simulation shuts off abruptly. I guess that resolves my issue with this simulation

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.