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

📄 ---rossler02.nlogo

📁 NETLOGO
💻 NLOGO
📖 第 1 页 / 共 2 页
字号:
;;; rossler.nlogo rev 01, 31 march 2005 by ralph abraham
;;; based upon vectorfield.nlogo of the CCL Model Library
;;; modify dorband.nlogo for the rossler attractor, delete mouse placements
;;; this is a 3D model in NetLogo 3D
;;; NOTE: manually set screen-edge-x,y,z in 2D Graphic Window
;;; to 50 was too much, so try 17
;;; also useful to click "2D also" OFF in 3D window
breeds
[
  particles  ;; the things that are affected by the map
  drops      ;; the droplets left behind to mark the trajectory
]

globals
[
  deltax deltay deltaz  ;;; window widths for conversion routines
  deltau deltav deltaw  ;;; world coord window widths
  umin umax vmin vmax wmin wmax ;;; from def of map-u and map-v
  xmin xmax ymin ymax zmin zmax ;;; from Graphics Window attributes
  ;;; c defined by a slider from 0 to 5
  ;;; stepsize ditto from 0 to 0.1
]

;;; procedures

;;; these are for coord conversion functions (affine isomorphisms)
to init-globals
  set xmin ( - screen-edge-x )
  set xmax screen-edge-x
  set ymin ( - screen-edge-y )
  set ymax screen-edge-y
  set zmin ( - screen-edge-z )
  set zmax screen-edge-z
  set deltax screen-size-x - 1 ;;; this is Graphics Window attribute
  set deltay screen-size-y - 1 ;;; this is Graphics Window attribute
  set deltaz screen-size-z - 1 ;;; this is Graphics Window attribute
  set umin -14
  set umax 14
  set vmin -14
  set vmax 14
  set wmin 0
  set wmax 28
  set deltau (umax - umin) 
  set deltav (vmax - vmin)
  set deltaw (wmax - wmin)
end

;;; reporters
;;; ==============================================
;;; conversion functions, world-coords <--> turtle-screen-coords:
;;; horizontal: (u <--> x), vertical (v <--> y), deep (w <--> z)
;;; ----------------------------------------------
;;; (u <-- x): u = convert(x)
to-report horizconvert [ x ]
  let u (deltau * ( x - xmin ) / deltax) + umin
  report u
end

;;; (u --> x): x = deconvert(u)
to-report horizdeconvert [ u ]
  let x (deltax * ( u - umin ) / deltau) + xmin
  report x
end

;;; (v <-- y): v = convert(y)
to-report vertconvert [ y ]
  let v (deltav * ( y - ymin ) / deltay) + vmin
  report v
end

;;; (v --> y): y = deconvert(v)
to-report vertdeconvert [ v ]
  let y (deltay * ( v - vmin ) / deltav) + ymin
  report y
end

;;; (w <-- z): w = convert(z)
to-report deepconvert [ z ]
  let w (deltaw * ( z - zmin ) / deltaz) + wmin
  report w
end

;;; (w --> z): z = deconvert(w)
to-report deepdeconvert [ w ]
  let z (deltaz * ( w - wmin ) / deltaw) + zmin
  report z
end

;;; ==============================================
;;; more procedures
to setup
  ca
  set-default-shape particles "circle"
  set-default-shape drops "circle"
  init-globals
  place-particle 0 0 0
end

;;; green test particles move along trajectories, leaving red blotches
to go
  ask particles
  [
    ;;;;; set pcolor-of patch-here red ;;; blotch on current patch
    hatch-drops 1 [
      set color yellow
      set size 0.5
    ]
    let xtemp xcor
    let ytemp ycor
    let ztemp zcor
    set xcor map-x xtemp ytemp ztemp ;;; move to image point
    set ycor map-y xtemp ytemp ztemp
    set zcor map-z xtemp ytemp ztemp
  ]
;  ask particles
;  [
;  hideturtle
;  ]
end

;; create a particle at (x,y,z)
to place-particle [x y z]
  create-custom-particles 1
  [
    set xcor x 
    set ycor y
    ;;;set zcor z
    set size 3
    set heading 0
    set color green
  ]
end

;;; reset pcolor of all patches
to clear
  ask patches
  [
    set pcolor black
  ]
  ask particles
  [
  showturtle
  ]
end

;; calculate the horizontal component of the map where the turtle is located
to-report map-x [ x y z] ;; turtle procedure
  let utemp1 horizconvert x
  let vtemp1 vertconvert y
  let wtemp1 deepconvert z
  let utemp2 map-u utemp1 vtemp1 wtemp1
  let xtemp horizdeconvert utemp2
  report xtemp
end

;; calculate the vertical component of the map where the turtle is located
to-report map-y [ x y z] ;; turtle procedure
  let utemp1 horizconvert x
  let vtemp1 vertconvert y
  let wtemp1 deepconvert z
  let vtemp2 map-v utemp1 vtemp1 wtemp1
  let ytemp vertdeconvert vtemp2
  report ytemp
end

;; calculate the depth component of the map where the turtle is located
to-report map-z [ x y z] ;; turtle procedure
  let utemp1 horizconvert x
  let vtemp1 vertconvert y
  let wtemp1 deepconvert z
  let wtemp2 map-w utemp1 vtemp1 wtemp1
  let ztemp deepdeconvert wtemp2
  report ztemp
end
;;; and at last, the map in world coords 
;;; ROSSLER odes with euler method
;;; we might want CLIPPING here
to-report map-u [ u v w ]
;;;;;;  report (1 - c) * u + 4 * c * v * (1 - v)
  report u + stepsize * ( - v - w )
end

to-report map-v [ u v w ]
;;;;;;  report (1 - c) * v + 4 * c * u * (1 - u)
  let a 0.2
  report v + stepsize * ( u + a * v )
end

to-report map-w [ u v w ]
  let b 0.2
  report w + stepsize * ( b + w * ( u - c )) ;;; c is lobal from a slider
end

;;; end of rossler3D.nlogo procedures
@#$#@#$#@
GRAPHICS-WINDOW
278
18
492
253
25
25
4.0
0
10
1
1
1
0
25

CC-WINDOW
5
279
501
374
Command Center

BUTTON
11
62
125
95
setup
setup
NIL
1
T
OBSERVER
T
NIL

BUTTON
10
143
124
176
go
go
T
1
T
OBSERVER
NIL
NIL

SLIDER
12
19
184
52
c
c
0.0
6.0
5.6
0.1
1
NIL

BUTTON
10
186
124
219
NIL
clear
NIL
1
T
OBSERVER
T
NIL

SLIDER
11
232
247
265
stepsize
stepsize
0
0.01
0.0050
0.0010
1
NIL

@#$#@#$#@
WHAT IS IT?
-----------
This is a mathematical model that demonstrates abstract vector fields and integral curves.

Generally speaking, a field is a "region in which a body experiences a force as the result of the presence of some other body or bodies.  A field is thus a method of representing the way in which bodies are able to influence each other.  For example, a body that has mass is surrounded by a region in which another body that has mass experiences a force tending to draw the two bodies together.... The strength of any field can be described as the ratio of the force experienced by a small appropriate specimen to the relevant property of that specimen, e.g. force/mass for the gravitational field"  (Oxford Minidictionary of Physics).

By 'abstract vector fields' we mean that this model is not committed to any specific type of force, such as gravity or magnetism.  Rather, it simulates a general field, in which some focal property of influence affects a "small appropriate specimen", or particle, placed in the field.

Normally, if you look at a field with bare eyes, you will not necessarily see the forces.  For instance, if you drop an apple it falls down, even though you cannot see the gravitational force.  The apple is an object in the gravitational field.  You saw how it behaved so you could guess that there is some force that made it go down.  Humans do not perceive (visually) forces of gravitation or electro-magnetic forces.  However, in a model, we can use little arrows (vectors) to show where, how forceful, and in which direction there are forces in this field.


HOW IT WORKS
------------
In this model, the field is plotted using vector graphics: green streaks are individual vectors with yellow turtles serving as arrowheads.  The length of each vector is roughly proportional to the magnitude of the vector field at each point.  In this model, it is just the distance from the origin: The further away from the origin, the larger the vector.  Also, all vectors are aimed clockwise along tangents to circles centered on the origin.

The vectors show you in what direction and how forcefully an appropriate specimen -- here, a 'particle' -- will be "knocked about" once it is placed the field.  Once the particle is "knocked" to a new location, it will be knocked yet again by the force there (represented by the vector).  Actually, it being "knocked about" continuously, but in this simulation, the "knock" occurs at discrete points in the field.  Since the particle does not use up the forces, it will keep being knocked about.  The path the particle takes is called its 'trajectory.'  You will be able to track this trajectory because the particle will leave a red trail behind it as it moves along its trajectory.  Trajectories in vector fields are called 'integral curves.'

Even though behavior of particles can be interesting and possibly unanticipated, owing to forces not being distributed uniformly in the field, or some other factor, we have chosen, for clarity, a vector field with a logical and consistent relation between location in space and size/orientation of the force.  The vector field chosen for this particular model is

|    - y d/dx  +  x d/dy

Ideally, in the particular force field modeled here, the particle trajectories should be concentric circles (that is, the particle should go round and round along the same circular trajectory).

⌨️ 快捷键说明

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