⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ---josephson-cooperative.nlogo

📁 NETLOGO
💻 NLOGO
📖 第 1 页 / 共 3 页
字号:
; NetLogo Model: josephson-cooperative :: Version: 0.4.3 (21 Oct 2003); Author: S. Maggi :: NetLogo version: 1.3.1 (for Mac OS X); -----------------------------------------------------------------------------; Global variables:;    population = turtle population (equal to the width of the graphics window);    pi2        = 2 x 3.14159...;; Variables belonging to each turtle:;    tau    = current simulation time;    phi    = phase difference at time tau;    phidot = derivative of the phase at time tau globals     [population pi2]turtles-own [tau phi phidot]; Setup of simulation: clears Graphics window, sets some constants and defines ; characteristics of turtle populationto setup   clear-all   set pi2    2 * pi   set plot?  false; The turtle population is set equal to the total width of the Graphics window   set population screen-size-x   create-turtles population; Turtle setup: the initial coordinates of the turtles are:; [x = -screen-edge-x, -screen-edge-x + 1, ... +screen-edge-x;  y = 0],; i.e., the turtles are distributed along the y = 0 axis of the Graphics window   ask turtles [set tau    0.0                set phi    phi-0                set phidot phidot-0                set color yellow                set heading 0                setxy (who - screen-edge-x) 0               ]   setup-plotend; Default simulation parameters (set by pressing the Default params button)to default   set dtau      0.1   set phi-0     0.0   set phidot-0  0.0   set alpha-dc  0.0   set beta-c    0.1   set alpha-rf  0.0   set omega-rf  0.0     set slowdown  0   set y-ampl    5end; Main simulation loopto go   without-interruption [solve-diff-eq                         if plot? [do-plot]                         wait (slowdown / 500)                        ]end; Solve the 2nd order differential equation using a finite difference methodto solve-diff-eq   locals [who-1 who+1 ntc           tau_n phi_n phi_n+1           phidot_n phidot_n+1          ]   set ntc (dtau / beta-c)   without-interruption      [set who-1    who-of    turtle ( (who - 1) mod screen-size-x )       set who+1    who-of    turtle ( (who + 1) mod screen-size-x )       set tau_n    tau-of    turtle    who       set phi_n    phi-of    turtle    who       set phidot_n phidot-of turtle    who; this finite-difference method does not work because of numerical instabilities    ;locals [phi_n-1]    ;set phi_n-1  phi-of  turtle who-1    ;set phi_n+1  ( (2 * beta-c + dtau) * phi_n - (beta-c) * phi_n-1 + (dtau ^ 2) * (alpha-dc + alpha-rf * sin (rad-to-deg (tau_n * omega-rf) ) - sin (rad-to-deg phi_n) ) ) / (beta-c + dtau); this finite-difference method works!       set phidot_n+1 (1 - ntc) * phidot_n + ntc * ( alpha-dc + alpha-rf * sin (rad-to-deg (omega-rf * tau_n)) - sin (rad-to-deg (phi_n)) )       set phi_n+1    (phi_n + phidot_n+1 * dtau)       ask turtle who+1 [set tau    (tau_n + dtau)                         set phi    (phi_n+1) mod pi2                         set phidot (phidot_n+1)                         set ycor   (y-ampl * phidot)                        ]      ]end; This procedure converts an angle from radians to degrees (as used by NetLogo).;   input: 'angle' in radians;   report: angle converted to degreesto-report rad-to-deg [angle]   report angle * 360 / pi2end; This procedure sets up the phase-space plotto setup-plot   set-current-plot "Phase space"   auto-plot-on   set-plot-x-range  -3.2  3.2   set-plot-y-range  -1.0  1.0   set-plot-pen-mode  2   set-plot-pen-color blueendto do-plot   set-current-plot "Phase space"   plotxy (phi mod pi2 - pi) phidot; one could also plot the cosine of phi instead of phi;   plotxy cos (rad-to-deg phi) phidotendto reset-plot   setup-plot   plot-pen-reset   set plot? falseend@#$#@#$#@GRAPHICS-WINDOW210306213652001501.0110111TEXTBOX202018038Simulation settings:SLIDER154018573dtaudtau0.00200.20.10.00201NILSLIDER1580185113phi-0phi-006.40.00.21NILSLIDER15120185153phidot-0phidot-006.40.00.21NILTEXTBOX20180180198Junction parameters:SLIDER15200185233alpha-dcalpha-dc-10100.00.11NILSLIDER15240185273beta-cbeta-c0.12.50.10.21NILSLIDER15290185323alpha-rfalpha-rf0100.00.11NILSLIDER15330185363omega-rf

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -