# Rope 3D

### 1 collaborator

Uri Wilensky (Author)

### Tags

(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 3D 4.1pre7 • Viewed 599 times • Downloaded 19 times • Run 0 times

### WHAT IS IT?

This project simulates a wave moving along a rope. One end of the rope is green, and the other is blue. The ends of the rope may be driven in sinusoidal motion (along the y and z axes), causing wave patterns to travel along the rope. This creates a wave that travels along the rope.

### HOW IT WORKS

The rope is made up of a line of turtles. The x coordinates (xcors) of the turtles are permanently fixed, but the turtles are free to move in either the y or z directions. Each turtle acts as it were connected to its two neighboring turtles with springs. When a neighboring turtle is farther away, it exerts a stronger force.

In the initial configuration, the green end of the rope is the driving force, and the blue end is fixed to the wall. When the green turtle moves up, it "pulls up" the turtle next to it (in the x direction). This turtle pulls the next turtle up, and so on. As a result, a wave moves down the rope. When the wave reaches the blue end of the rope, the wave is reflected back down the rope the opposite direction from the way it had come.

### HOW TO USE IT

Click the SETUP button to set up the rope.

Click GO to start the ropes moving.

The FRICTION slider controls the amount of friction in the rope.

The SYNCHRONIZE-ENDS? switch locks the path of the blue end in step with the path of the green end.

The MOVE-GREEN-END? switch controls whether the green end is moving in sinusoidal motion, or whether it is fixed to the wall.

The MOVE-BLUE-END? switch controls whether the blue end is moving in sinusoidal motion, or whether it is fixed to the wall.

Also, for each end (blue and green), there are sliders to change the frequency and amplitude of their sinusoidal behavior.

### THINGS TO NOTICE

There's a connection between the frequency with which the left end of the rope goes up and down and the number of peaks that emerge.

### THINGS TO TRY

Change the values on the sliders and observe what happens to the waves on the rope.

Experiment with using different y frequencies and amplitudes than z frequencies and amplitudes. Can you get the green end of the rope to move in a circle? An ellipse? A figure eight? What other shapes can you find -- will the green turtle's path always repeat? (You may find it useful to put the green turtle's pen down. You can do this from the Command Center by typing "ask turtle 0 [ pd ]")

Try to create a "standing wave", in which some points on the rope do not move at all.

Experiment with different amounts of friction. What is the effect on the waveforms? Some particularly strange behaviors happen when friction is 0. Can you explain what you observe?

### EXTENDING THE MODEL

Change the blue end of the rope so that it moves freely, rather than being a driving force, or being fixed. How does that change the behavior of waves in the rope?

Add the effect of gravity to the model. Make the strength of gravity be adjustable in the Interface tab by using a slider.

### NETLOGO FEATURES

For this project, it does not make sense for the turtles to "wrap" when they go outside the world boundary box in the 3D view. So the real y-position and z-position of the turtles are kept in turtle variables (YPOS and ZPOS), and the turtle is hidden if its YPOS or ZPOS are outside the range of the world's boundaries.

### RELATED MODELS

Rope (2D version)

### HOW TO CITE

If you mention this model in an academic publication, we ask that you include these citations for the model itself and for the NetLogo software:

- Wilensky, U. (2006). NetLogo Rope 3D model. http://ccl.northwestern.edu/netlogo/models/Rope3D. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

Permission to use, modify or redistribute this model is hereby granted, provided that both of the following requirements are followed:

a) this copyright notice is included.

b) this model will not be redistributed for profit without permission from Uri Wilensky. Contact Uri Wilensky for appropriate licenses for redistribution for profit.

This is a 3D version of the 2D model Rope.

Click to Run Model

```turtles-own [
yvel           ;; velocity along the y axis
zvel           ;; velocity along the z axis
ypos           ;; y position (separate from ycor since we might exceed the
;;   boundaries of the view, which ycor can never do)
zpos           ;; z position (separate from zcor since we might exceed the
;;   boundaries of the view, which zcor can never do)
]

to setup
ca
set-default-shape turtles "circle"
crt world-width                 ;; create enough turtles to span screen
[
set xcor (who + min-pxcor)  ;; place them along the x-axis
set color red
if xcor = max-pxcor
[ set color blue ]            ;; "rightmost" turtle is blue
if xcor = min-pxcor
[ set color green ]           ;; "leftmost" turtle is green
]
end

to go
tick
if (move-green-end?)
[
;; the blue turtle locks in step with the green turtle, if they are synchronized
ask turtles with [(color = green) or (synchronize-ends? and color = blue)]
[
ifelse (ticks > 100)  ;; ramp the force up gradually to avoid spikes in the wave
[ set ypos y-amplitude-green * sin (y-frequency-green * ticks)
set zpos z-amplitude-green * cos (z-frequency-green * ticks)
]
[ set ypos (ticks / 100) * y-amplitude-green * sin (y-frequency-green * ticks)
set zpos (ticks / 100) * z-amplitude-green * cos (z-frequency-green * ticks)
]
set ycor ypos
set zcor zpos
]
]
if (move-blue-end? and not synchronize-ends?)
[
ask turtles with [ color = blue ]
[
ifelse (ticks > 100)  ;; ramp the force up gradually to avoid spikes in the wave
[ set ypos y-amplitude-blue * sin (y-frequency-blue * ticks)
set zpos z-amplitude-blue * cos (z-frequency-blue * ticks)
]
[ set ypos (ticks / 100) * y-amplitude-blue * sin (y-frequency-blue * ticks)
set zpos (ticks / 100) * z-amplitude-blue * cos (z-frequency-blue * ticks)
]
set ycor ypos
set zcor zpos
]
]
ask turtles with [color = red]  ;;the red turtles respond to their neighbors' positions
[ ;; increment your y velocity by the difference between your current location,
;;   and the location that you "should be at" -- halfway between your two neighbors.
set yvel yvel + ((([ypos] of (turtle (who - 1))) - ypos) +
(([ypos] of (turtle (who + 1))) - ypos))
set zvel zvel + ((([zpos] of (turtle (who - 1))) - zpos) +
(([zpos] of (turtle (who + 1))) - zpos))
set yvel ((1000 - friction) / 1000) * yvel  ;; apply friction
set zvel ((1000 - friction) / 1000) * zvel  ;; apply friction
]
;; we need two separate ask blocks here so all the turtles calculate their
;; new velocities before any turtles move
ask turtles with [color = red]
[ ;; calculate new y position
set ypos ypos + yvel                    ;; calculate new y position
set ycor ypos
set zpos zpos + zvel                    ;; calculate new z position
set zcor zpos
;; make sure turtles do not wrap the screen, by hiding them if necessary.
ifelse (abs ypos) <= max-pycor and (abs zpos) <= max-pzcor
[ show-turtle ]
[ hide-turtle ]
]
end

; The full copyright notice is in the Information tab.
```

There are 3 versions of this model.