# No. 484 (Brown 1868): "A spiral wound round a cylinder to convert the motion of the wind or a stream of water into rotary motion."
# Model (cm). A cylinder (7 cm across, 24 cm long) on an axle in two posts, a spiral blade wound round it once along
# its length out to 8 cm. A stream (40 cm/s) runs along under the axle, through the lower half of the ring the spiral
# fills (3.5-8.3 cm out;
# fluid.ring about x), and the spiral, slanted across it, is pushed round by it as a nut by a screw; the axle works against a
# load of 0.0005 N m s. The stream is the only input (nothing is driven). The water is particles in that ring developed flat at its
# mean radius (5.9 cm), coming in at the right-hand post and leaving at the left; the stream runs level along the axle, so
# gravity is left out of the ring (it would only bend the stream round). Generator: opencode-runs/water/gen484.py.
number: 484
slug: spiral-cylinder-stream
name: Spiral on a cylinder
brown: "A spiral wound round a cylinder to convert the motion of the wind or a stream of water into rotary motion."
units: cm
sim:
  timestep: 0.002
  integrator: implicitfast
  iterations: 50
  duration_s: 12
  floor: false
bodies:
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#a89878"
    pieces:
      - {kind: poly, points: [[-16.5, -13], [-13.5, -13], [-13.5, 2.2], [-16.5, 2.2]], y: [-3, 3], collide: 0}   # a post, the axle's bearing at its head
      - {kind: poly, points: [[13.5, -13], [16.5, -13], [16.5, 2.2], [13.5, 2.2]], y: [-3, 3], collide: 0}
      - {kind: poly, points: [[-19.5, -14], [19.5, -14], [19.5, -13], [-19.5, -13]], y: [-4, 4], collide: 0}   # the sill
  - id: drum
    shape: part
    pos: [0, 0, 0]
    density: 700
    color: "#b49a70"
    pieces:
      - {kind: rod, from: [-12, 0, 0], to: [12, 0, 0], radius: 3.5, collide: 0}   # the cylinder
      - {kind: rod, from: [-17, 0, 0], to: [17, 0, 0], radius: 0.6, collide: 0, color: "#8f8a80"}   # its axle
      - {kind: loft, a: [[-12.2, 0, 3.3], [-12.2, 0, 8], [-11.8, 0, 8], [-11.8, 0, 3.3]], b: [[-11.5333, -0.573, 3.2499], [-11.5333, -1.3892, 7.8785], [-11.1333, -1.3892, 7.8785], [-11.1333, -0.573, 3.2499]], collide: 2}   # a piece of the spiral
      - {kind: loft, a: [[-11.5333, -0.573, 3.2499], [-11.5333, -1.3892, 7.8785], [-11.1333, -1.3892, 7.8785], [-11.1333, -0.573, 3.2499]], b: [[-10.8667, -1.1287, 3.101], [-10.8667, -2.7362, 7.5175], [-10.4667, -2.7362, 7.5175], [-10.4667, -1.1287, 3.101]], collide: 2}
      - {kind: loft, a: [[-10.8667, -1.1287, 3.101], [-10.8667, -2.7362, 7.5175], [-10.4667, -2.7362, 7.5175], [-10.4667, -1.1287, 3.101]], b: [[-10.2, -1.65, 2.8579], [-10.2, -4, 6.9282], [-9.8, -4, 6.9282], [-9.8, -1.65, 2.8579]], collide: 2}
      - {kind: loft, a: [[-10.2, -1.65, 2.8579], [-10.2, -4, 6.9282], [-9.8, -4, 6.9282], [-9.8, -1.65, 2.8579]], b: [[-9.5333, -2.1212, 2.5279], [-9.5333, -5.1423, 6.1284], [-9.1333, -5.1423, 6.1284], [-9.1333, -2.1212, 2.5279]], collide: 2}
      - {kind: loft, a: [[-9.5333, -2.1212, 2.5279], [-9.5333, -5.1423, 6.1284], [-9.1333, -5.1423, 6.1284], [-9.1333, -2.1212, 2.5279]], b: [[-8.8667, -2.5279, 2.1212], [-8.8667, -6.1284, 5.1423], [-8.4667, -6.1284, 5.1423], [-8.4667, -2.5279, 2.1212]], collide: 2}
      - {kind: loft, a: [[-8.8667, -2.5279, 2.1212], [-8.8667, -6.1284, 5.1423], [-8.4667, -6.1284, 5.1423], [-8.4667, -2.5279, 2.1212]], b: [[-8.2, -2.8579, 1.65], [-8.2, -6.9282, 4], [-7.8, -6.9282, 4], [-7.8, -2.8579, 1.65]], collide: 2}
      - {kind: loft, a: [[-8.2, -2.8579, 1.65], [-8.2, -6.9282, 4], [-7.8, -6.9282, 4], [-7.8, -2.8579, 1.65]], b: [[-7.5333, -3.101, 1.1287], [-7.5333, -7.5175, 2.7362], [-7.1333, -7.5175, 2.7362], [-7.1333, -3.101, 1.1287]], collide: 2}
      - {kind: loft, a: [[-7.5333, -3.101, 1.1287], [-7.5333, -7.5175, 2.7362], [-7.1333, -7.5175, 2.7362], [-7.1333, -3.101, 1.1287]], b: [[-6.8667, -3.2499, 0.573], [-6.8667, -7.8785, 1.3892], [-6.4667, -7.8785, 1.3892], [-6.4667, -3.2499, 0.573]], collide: 2}
      - {kind: loft, a: [[-6.8667, -3.2499, 0.573], [-6.8667, -7.8785, 1.3892], [-6.4667, -7.8785, 1.3892], [-6.4667, -3.2499, 0.573]], b: [[-6.2, -3.3, 0], [-6.2, -8, 0], [-5.8, -8, 0], [-5.8, -3.3, 0]], collide: 2}
      - {kind: loft, a: [[-6.2, -3.3, 0], [-6.2, -8, 0], [-5.8, -8, 0], [-5.8, -3.3, 0]], b: [[-5.5333, -3.2499, -0.573], [-5.5333, -7.8785, -1.3892], [-5.1333, -7.8785, -1.3892], [-5.1333, -3.2499, -0.573]], collide: 2}
      - {kind: loft, a: [[-5.5333, -3.2499, -0.573], [-5.5333, -7.8785, -1.3892], [-5.1333, -7.8785, -1.3892], [-5.1333, -3.2499, -0.573]], b: [[-4.8667, -3.101, -1.1287], [-4.8667, -7.5175, -2.7362], [-4.4667, -7.5175, -2.7362], [-4.4667, -3.101, -1.1287]], collide: 2}
      - {kind: loft, a: [[-4.8667, -3.101, -1.1287], [-4.8667, -7.5175, -2.7362], [-4.4667, -7.5175, -2.7362], [-4.4667, -3.101, -1.1287]], b: [[-4.2, -2.8579, -1.65], [-4.2, -6.9282, -4], [-3.8, -6.9282, -4], [-3.8, -2.8579, -1.65]], collide: 2}
      - {kind: loft, a: [[-4.2, -2.8579, -1.65], [-4.2, -6.9282, -4], [-3.8, -6.9282, -4], [-3.8, -2.8579, -1.65]], b: [[-3.5333, -2.5279, -2.1212], [-3.5333, -6.1284, -5.1423], [-3.1333, -6.1284, -5.1423], [-3.1333, -2.5279, -2.1212]], collide: 2}
      - {kind: loft, a: [[-3.5333, -2.5279, -2.1212], [-3.5333, -6.1284, -5.1423], [-3.1333, -6.1284, -5.1423], [-3.1333, -2.5279, -2.1212]], b: [[-2.8667, -2.1212, -2.5279], [-2.8667, -5.1423, -6.1284], [-2.4667, -5.1423, -6.1284], [-2.4667, -2.1212, -2.5279]], collide: 2}
      - {kind: loft, a: [[-2.8667, -2.1212, -2.5279], [-2.8667, -5.1423, -6.1284], [-2.4667, -5.1423, -6.1284], [-2.4667, -2.1212, -2.5279]], b: [[-2.2, -1.65, -2.8579], [-2.2, -4, -6.9282], [-1.8, -4, -6.9282], [-1.8, -1.65, -2.8579]], collide: 2}
      - {kind: loft, a: [[-2.2, -1.65, -2.8579], [-2.2, -4, -6.9282], [-1.8, -4, -6.9282], [-1.8, -1.65, -2.8579]], b: [[-1.5333, -1.1287, -3.101], [-1.5333, -2.7362, -7.5175], [-1.1333, -2.7362, -7.5175], [-1.1333, -1.1287, -3.101]], collide: 2}
      - {kind: loft, a: [[-1.5333, -1.1287, -3.101], [-1.5333, -2.7362, -7.5175], [-1.1333, -2.7362, -7.5175], [-1.1333, -1.1287, -3.101]], b: [[-0.8667, -0.573, -3.2499], [-0.8667, -1.3892, -7.8785], [-0.4667, -1.3892, -7.8785], [-0.4667, -0.573, -3.2499]], collide: 2}
      - {kind: loft, a: [[-0.8667, -0.573, -3.2499], [-0.8667, -1.3892, -7.8785], [-0.4667, -1.3892, -7.8785], [-0.4667, -0.573, -3.2499]], b: [[-0.2, -0, -3.3], [-0.2, -0, -8], [0.2, -0, -8], [0.2, -0, -3.3]], collide: 2}
      - {kind: loft, a: [[-0.2, -0, -3.3], [-0.2, -0, -8], [0.2, -0, -8], [0.2, -0, -3.3]], b: [[0.4667, 0.573, -3.2499], [0.4667, 1.3892, -7.8785], [0.8667, 1.3892, -7.8785], [0.8667, 0.573, -3.2499]], collide: 2}
      - {kind: loft, a: [[0.4667, 0.573, -3.2499], [0.4667, 1.3892, -7.8785], [0.8667, 1.3892, -7.8785], [0.8667, 0.573, -3.2499]], b: [[1.1333, 1.1287, -3.101], [1.1333, 2.7362, -7.5175], [1.5333, 2.7362, -7.5175], [1.5333, 1.1287, -3.101]], collide: 2}
      - {kind: loft, a: [[1.1333, 1.1287, -3.101], [1.1333, 2.7362, -7.5175], [1.5333, 2.7362, -7.5175], [1.5333, 1.1287, -3.101]], b: [[1.8, 1.65, -2.8579], [1.8, 4, -6.9282], [2.2, 4, -6.9282], [2.2, 1.65, -2.8579]], collide: 2}
      - {kind: loft, a: [[1.8, 1.65, -2.8579], [1.8, 4, -6.9282], [2.2, 4, -6.9282], [2.2, 1.65, -2.8579]], b: [[2.4667, 2.1212, -2.5279], [2.4667, 5.1423, -6.1284], [2.8667, 5.1423, -6.1284], [2.8667, 2.1212, -2.5279]], collide: 2}
      - {kind: loft, a: [[2.4667, 2.1212, -2.5279], [2.4667, 5.1423, -6.1284], [2.8667, 5.1423, -6.1284], [2.8667, 2.1212, -2.5279]], b: [[3.1333, 2.5279, -2.1212], [3.1333, 6.1284, -5.1423], [3.5333, 6.1284, -5.1423], [3.5333, 2.5279, -2.1212]], collide: 2}
      - {kind: loft, a: [[3.1333, 2.5279, -2.1212], [3.1333, 6.1284, -5.1423], [3.5333, 6.1284, -5.1423], [3.5333, 2.5279, -2.1212]], b: [[3.8, 2.8579, -1.65], [3.8, 6.9282, -4], [4.2, 6.9282, -4], [4.2, 2.8579, -1.65]], collide: 2}
      - {kind: loft, a: [[3.8, 2.8579, -1.65], [3.8, 6.9282, -4], [4.2, 6.9282, -4], [4.2, 2.8579, -1.65]], b: [[4.4667, 3.101, -1.1287], [4.4667, 7.5175, -2.7362], [4.8667, 7.5175, -2.7362], [4.8667, 3.101, -1.1287]], collide: 2}
      - {kind: loft, a: [[4.4667, 3.101, -1.1287], [4.4667, 7.5175, -2.7362], [4.8667, 7.5175, -2.7362], [4.8667, 3.101, -1.1287]], b: [[5.1333, 3.2499, -0.573], [5.1333, 7.8785, -1.3892], [5.5333, 7.8785, -1.3892], [5.5333, 3.2499, -0.573]], collide: 2}
      - {kind: loft, a: [[5.1333, 3.2499, -0.573], [5.1333, 7.8785, -1.3892], [5.5333, 7.8785, -1.3892], [5.5333, 3.2499, -0.573]], b: [[5.8, 3.3, -0], [5.8, 8, -0], [6.2, 8, -0], [6.2, 3.3, -0]], collide: 2}
      - {kind: loft, a: [[5.8, 3.3, -0], [5.8, 8, -0], [6.2, 8, -0], [6.2, 3.3, -0]], b: [[6.4667, 3.2499, 0.573], [6.4667, 7.8785, 1.3892], [6.8667, 7.8785, 1.3892], [6.8667, 3.2499, 0.573]], collide: 2}
      - {kind: loft, a: [[6.4667, 3.2499, 0.573], [6.4667, 7.8785, 1.3892], [6.8667, 7.8785, 1.3892], [6.8667, 3.2499, 0.573]], b: [[7.1333, 3.101, 1.1287], [7.1333, 7.5175, 2.7362], [7.5333, 7.5175, 2.7362], [7.5333, 3.101, 1.1287]], collide: 2}
      - {kind: loft, a: [[7.1333, 3.101, 1.1287], [7.1333, 7.5175, 2.7362], [7.5333, 7.5175, 2.7362], [7.5333, 3.101, 1.1287]], b: [[7.8, 2.8579, 1.65], [7.8, 6.9282, 4], [8.2, 6.9282, 4], [8.2, 2.8579, 1.65]], collide: 2}
      - {kind: loft, a: [[7.8, 2.8579, 1.65], [7.8, 6.9282, 4], [8.2, 6.9282, 4], [8.2, 2.8579, 1.65]], b: [[8.4667, 2.5279, 2.1212], [8.4667, 6.1284, 5.1423], [8.8667, 6.1284, 5.1423], [8.8667, 2.5279, 2.1212]], collide: 2}
      - {kind: loft, a: [[8.4667, 2.5279, 2.1212], [8.4667, 6.1284, 5.1423], [8.8667, 6.1284, 5.1423], [8.8667, 2.5279, 2.1212]], b: [[9.1333, 2.1212, 2.5279], [9.1333, 5.1423, 6.1284], [9.5333, 5.1423, 6.1284], [9.5333, 2.1212, 2.5279]], collide: 2}
      - {kind: loft, a: [[9.1333, 2.1212, 2.5279], [9.1333, 5.1423, 6.1284], [9.5333, 5.1423, 6.1284], [9.5333, 2.1212, 2.5279]], b: [[9.8, 1.65, 2.8579], [9.8, 4, 6.9282], [10.2, 4, 6.9282], [10.2, 1.65, 2.8579]], collide: 2}
      - {kind: loft, a: [[9.8, 1.65, 2.8579], [9.8, 4, 6.9282], [10.2, 4, 6.9282], [10.2, 1.65, 2.8579]], b: [[10.4667, 1.1287, 3.101], [10.4667, 2.7362, 7.5175], [10.8667, 2.7362, 7.5175], [10.8667, 1.1287, 3.101]], collide: 2}
      - {kind: loft, a: [[10.4667, 1.1287, 3.101], [10.4667, 2.7362, 7.5175], [10.8667, 2.7362, 7.5175], [10.8667, 1.1287, 3.101]], b: [[11.1333, 0.573, 3.2499], [11.1333, 1.3892, 7.8785], [11.5333, 1.3892, 7.8785], [11.5333, 0.573, 3.2499]], collide: 2}
      - {kind: loft, a: [[11.1333, 0.573, 3.2499], [11.1333, 1.3892, 7.8785], [11.5333, 1.3892, 7.8785], [11.5333, 0.573, 3.2499]], b: [[11.8, 0, 3.3], [11.8, 0, 8], [12.2, 0, 8], [12.2, 0, 3.3]], collide: 2}
joints:
  - {id: j_c, type: hinge, body: drum, axis: [1, 0, 0], damping: 0.0005}   # + : from +y towards +z
contact: {solref: [0.004, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_c, kind: torque, torque: 0, max_torque: 0.001}   # no hand on it: the stream is the only input
checks:
  - {type: turning, joint: j_c, direction: 1, min_mean: 1.0, min_fraction: 0.9, settle_s: 3.0, window_s: 8}
camera: {target: [0, 0, -2], position: [0, -150, 23], fov: 22}
fluid:
  plane: ring
  ring: {radius: 5.9, copies: 1, theta0: 0, axis: x}
  slab: [3.5, 8.3]
  spacing: 0.5
  dt: 0.002
  iterations: 4
  domain: [0, -13.5, 37.0708, 13.5]
  reservoir: {box: [0, 12, 37.0708, 13.5], head: 13.5, emit: [0, -40]}   # the stream comes in all round at the right-hand post (the drum lies deep in it)
  sinks: [[-1, -14.5, 38.0708, -12.7]]   # and leaves at the left
  tiers: [{id: light, label: "Lighter water (fewer particles)", spacing: 0.675}]
display:
  output: j_c
  labels: {j_c: "Cylinder"}
