JoeyDelp / JoSIM

Superconductor Circuit Simulator
MIT License
73 stars 33 forks source link

The issues about ivcurve.py #82

Open ZhangLujiu opened 1 year ago

ZhangLujiu commented 1 year ago

Hello Joey,

When I use the ivcurve.py file, I need to supply it with two command-line arguments, but I don't know what those two arguments should be. As shown in the figure, what do argv[1] and argv[2] refer to? Did you tell me how to use this file correctly? image

In addition to, I hope you can provide more examples for beginners and explain in more detail what each line in XXX.cir does or how it should be set up.

Thank you.

Best Regards

Peng Zhang

JoeyDelp commented 1 year ago

Hi Peng,

The first argument is the simulator (path to the executable) and the second argument is the file used to generate the IV curve. This script was just a quick way I used to generate IV curves before I implemented the functionality inside JoSIM itself (https://joeydelp.github.io/JoSIM/syntax/#iv-curve). This is a more reliable way of producing IV curves.

If you wish to continue using the IV curve script, then just point the first argument to the josim-cli executable and the second argument to a file with the following content:

* Example to simulate an IV curve in JoSIM
IS         0          1          pwl(0      0 10p 0 50p 25E-7 )
B1         1          0          jj1        area=1
*R1         1          0          8        
.model jj1 jj(rtype=0, vg=2.8mV, cap=0.07pF, icrit=0.1mA, rn=16, r0=160)
.tran 0.05p 1n 0 0.1p
*.iv jj1 200u iv1.csv
.print DEVI IS
.print NODEV 1 0
.print PHASE B1
.end

I include the (commented) .iv command to show how it can be done with JoSIM itself.

The most basic example (of a JTL) is found here https://joeydelp.github.io/JoSIM/ex_usage/ with each line is quite well explained in https://joeydelp.github.io/JoSIM/syntax/

There are quite a few other examples in the test directory of the source code. Let me know if you have any issues understanding any of the commands in the syntax guide and I will try to explain it better.

Best regards

Joey

ZhangLujiu commented 1 year ago

Joey, thank you for your careful explanation. Unfortunately, I didn't succeed in drawing the I-V curve. I will show you my operation process and input file. Could you tell me which step caused the problem? `* Josephson junction component test

But this error will not occur when I use the input file in your reply. Could you please point out the where the error comes from?

I'm sorry to ask you such a detailed question, because I'm a beginner and unfamiliar with Josephon junction simulation, so I don't know exactly what each Label in the.cir file means. Do you have any suggestions? How can I familiarize myself with this knowledge?

ZhangLujiu commented 1 year ago

Hi Joey,

The above issue has been solved, but I have a new question about the ivcurve.py. The file of ivcurve.py in calculation is to use the loop several times to execute the josim-cli program and finally draw the I-V curve. If I execute the josim-cli file once with the same input file (the file in the follow picture), and use the data of iv1.csv to plot I-V curve, which is same to the I-V curve got from ivcurve.py. So why is the curve drawn using ivcurve.py is corresponding to the curve drawn using iv1.csv? Can you elaborate on the differences?

the input file is:

the I-V curve drawn by ivcurve.py is: image

the I-V curve drawn by that data from iv1.csv is image

By the way, as the following picture, when the capacitance is small, the IV curve is not smooth. Why is this? image

JoeyDelp commented 1 year ago

Hi,

The ivcurve.py was a primitive script used to draw the IV curve before the functionality to do so was directly implemented in JoSIM.

The line .iv jj1 200u iv1.csv does what the entire ivcurve.py used to do. It is therefore not needed to run ivcurve.py when you have the line .iv jj1 200u iv1.csv in your circuit. This line can also be used for any model in any circuit file to generate the IV curve for that mode and is therefore a lot more powerful than running ivcurve.py which requires a specific type of circuit file.

By having the line .iv jj1 200u iv1.csv in the circuit file you feed to ivcurve.py the it is essentially constantly generating a new IV curve at each iteration and will take extremely long. Therefore I advise against using ivcurve.py.

As for the capacitance, I would also advise you not to alter the capacitance in the model as this is very much coupled to the physical process parameters. Altering it without understanding the details about the junction layers in the process is therefore not advised.

ZhangLujiu commented 1 year ago

Thank you for your answe. I have a new question about the time step setting. It is that how to determine the value of T{STEP} in the line .tran T{STEP}? To be specific, when we apply a specified voltage (V) to the Josephson junction then we get a supercurrent of AC and the period of this supercurrent is T=h/(2eV). Does the value of time step take into account the period of AC supercurrent?

JoeyDelp commented 1 year ago

Hi, my apologies for the late response. The T{STEP} will automatically take into account the AC period by reducing the size the user specified as T{STEP} when an error is detected (i.e. the phase of a junction changes too rapidly between steps). This way the simulator will always provide an accurate result during junction switching no matter the size the user specifies in the T{STEP}. It will, however, honor the user specified value during output if the user did not specify a print step P{STEP} by only storing the result at every T_{STEP}

Mengfei-Zhao commented 1 year ago

@JoeyDelp Hi Joey,

Can josim simulate the IV curve of a specific circuit, not just the model of the junction? For example, the following DC-SQUID circuit, can josim simulate the IV curve (Vout verse Ib) of this circuit?

dcsquid

JoeyDelp commented 1 year ago

Hi Mengfei-Zhao,

JoSIM cannot do this with the internal routine. However, using the ivcurve.py script with a netlist that represents this circuit but measuring the voltage at node 1 (between L1 and L2) would allow you to obtain the IV curve.

Hope this helps.

Mengfei-Zhao commented 1 year ago

Hi Joey,

Thank you for reply. I obtained the iv curve by writing a batch program based on pwl of josim.

Mengfei-Zhao commented 1 year ago

@JoeyDelp Hi Joey, I have a question. Is josim a fixed-step simulation or a variable-step simulation. I didn't find a description of this in the documentation. Sorry for asking under the wrong issue.

Looking forward to your reply.

JoeyDelp commented 1 year ago

Hi,

JoSIM does not really do variable-step in the traditional sense.

JoSIM does reduce the step when the difference between the guessed and calculated phase of a JJ between two consecutive steps is too large. In which case the entire simulation is halted and restarted with a step that is half that of the previous. The output step size will be locked to the original step size if no print step size is specified.

In this way the user is oblivious to the fact that the step size had changed. JoSIM does not ever increase the step size.

I am aware there are ways to do this, however, I have yet to investigate whether this will provide any tangible benefit. The non-linearity of the RCSJ model makes it quite difficult to adjust the step on the fly without undesired artifacts creeping in.

Hope this answers your question

Mengfei-Zhao commented 1 year ago

Hi Joey,

I got it. Thank you for reply. 😄

Mengfei-Zhao commented 1 year ago

@JoeyDelp Hi Joey, I have two questions.

  1. Is JoSIM using the Newton's iteration method, or the modified fixed point method as JSIM? or something else?
  2. Does JoSIM support error controling, such as RelTol, AbsTol in SPICE.

Looking forward to your reply. 😃