# No. 487 (Brown 1868): "Common paddle-wheel for propelling vessels; the revolution of the wheel causes the buckets to press backward against the water and so produce the forward movement of the vessel."
# Model (cm, gravity on, Brown's side view of the wheel). A wheel 21 cm across, 8 arms each carrying a float (seen edge on)
# out to 10.5 cm, on its shaft in the vessel's side; the lowest floats dip 3.2 cm into still water 8 cm deep. The vessel is
# one body (3 kg) free to move along the water (a slide), its hull's drag a damping of 0.6 N s/m; the wheel turns in it,
# driven by the engine at 24 rpm (the only input). The water is particles in the plane of the wheel (src/fluid/, about 0.5 cm
# apart, each pushing what it touches): the floats press backward on it, the water's push on them drives the vessel forward,
# and the water they throw back runs down the basin. Generator: opencode-runs/water/gen487.py.
number: 487
slug: common-paddle-wheel
name: Common paddle-wheel
brown: "Common paddle-wheel for propelling vessels; the revolution of the wheel causes the buckets to press backward against the water and so produce the forward movement of the vessel."
units: cm
sim:
  timestep: 0.002
  integrator: implicitfast
  iterations: 50
  duration_s: 10
  floor: false
bodies:
  - id: vessel
    shape: part
    pos: [-60, 0, 15.3]
    mass: 3
    color: "#5b4a3a"
    pieces:
      - {kind: poly, points: [[-94, 5], [-40, 5], [-32, 18.3], [-97, 18.3]], y: [4.0, 14.0], collide: 0, color: "#5b4a3a"}   # the vessel's side (beyond the wheel)
      - {kind: poly, points: [[-97, 18.3], [-32, 18.3], [-32, 19.1], [-97, 19.1]], y: [3.6, 14.0], collide: 0, color: "#8a6a45"}   # its gunwale
      - {kind: poly, points: [[-71.7, 26.2], [-48.3, 26.2], [-48.3, 19.1], [-71.7, 19.1]], y: [3.2, 4.0], collide: 0, color: "#6d5a46"}   # the paddle-box's back
      - {kind: disc, center: [-60, 15.3], radius: 2.0, y: [3.0, 4.0], collide: 0, color: "#6f6a60"}   # the shaft's bearing in the vessel's side
  - id: wheel
    shape: part
    mount: vessel
    pos: [-60, 0, 15.3]
    density: 700
    friction: 0.3
    color: "#b49a70"
    pieces:
      - {kind: poly, points: [[-52.507, 16.5865], [-49.6627, 17.1523], [-49.7408, 17.5446], [-52.585, 16.9788]], y: [0.3, 2.5], collide: 2, color: "#8f7a58"}   # a float (seen edge on)
      - {kind: poly, points: [[-58.7889, 15.3625], [-52.4138, 16.6306], [-52.4821, 16.9738], [-58.8572, 15.7057]], y: [1.0, 1.8], collide: 0}   # an arm
      - {kind: poly, points: [[-55.6114, 21.5081], [-54.0002, 23.9193], [-54.3328, 24.1415], [-55.944, 21.7303]], y: [0.3, 2.5], collide: 2, color: "#8f7a58"}
      - {kind: poly, points: [[-59.1878, 16.2005], [-55.5766, 21.6051], [-55.8676, 21.7995], [-59.4788, 16.395]], y: [1.0, 1.8], collide: 0}
      - {kind: poly, points: [[-61.2865, 22.793], [-61.8523, 25.6373], [-62.2446, 25.5592], [-61.6788, 22.715]], y: [0.3, 2.5], collide: 2, color: "#8f7a58"}
      - {kind: poly, points: [[-60.0625, 16.5111], [-61.3306, 22.8862], [-61.6738, 22.8179], [-60.4057, 16.4428]], y: [1.0, 1.8], collide: 0}
      - {kind: poly, points: [[-66.2081, 19.6886], [-68.6193, 21.2998], [-68.8415, 20.9672], [-66.4303, 19.356]], y: [0.3, 2.5], collide: 2, color: "#8f7a58"}
      - {kind: poly, points: [[-60.9005, 16.1122], [-66.3051, 19.7234], [-66.4995, 19.4324], [-61.095, 15.8212]], y: [1.0, 1.8], collide: 0}
      - {kind: poly, points: [[-67.493, 14.0135], [-70.3373, 13.4477], [-70.2592, 13.0554], [-67.415, 13.6212]], y: [0.3, 2.5], collide: 2, color: "#8f7a58"}
      - {kind: poly, points: [[-61.2111, 15.2375], [-67.5862, 13.9694], [-67.5179, 13.6262], [-61.1428, 14.8943]], y: [1.0, 1.8], collide: 0}
      - {kind: poly, points: [[-64.3886, 9.0919], [-65.9998, 6.6807], [-65.6672, 6.4585], [-64.056, 8.8697]], y: [0.3, 2.5], collide: 2, color: "#8f7a58"}
      - {kind: poly, points: [[-60.8122, 14.3995], [-64.4234, 8.9949], [-64.1324, 8.8005], [-60.5212, 14.205]], y: [1.0, 1.8], collide: 0}
      - {kind: poly, points: [[-58.7135, 7.807], [-58.1477, 4.9627], [-57.7554, 5.0408], [-58.3212, 7.885]], y: [0.3, 2.5], collide: 2, color: "#8f7a58"}
      - {kind: poly, points: [[-59.9375, 14.0889], [-58.6694, 7.7138], [-58.3262, 7.7821], [-59.5943, 14.1572]], y: [1.0, 1.8], collide: 0}
      - {kind: poly, points: [[-53.7919, 10.9114], [-51.3807, 9.3002], [-51.1585, 9.6328], [-53.5697, 11.244]], y: [0.3, 2.5], collide: 2, color: "#8f7a58"}
      - {kind: poly, points: [[-59.0995, 14.4878], [-53.6949, 10.8766], [-53.5005, 11.1676], [-58.905, 14.7788]], y: [1.0, 1.8], collide: 0}
      - {kind: poly, points: [[-52.5, 15.3], [-52, 15.3], [-52.1537, 16.8607], [-52.6441, 16.7632]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-52.6441, 16.7632], [-52.1537, 16.8607], [-52.609, 18.3615], [-53.0709, 18.1701]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-53.0709, 18.1701], [-52.609, 18.3615], [-53.3482, 19.7446], [-53.764, 19.4668]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-53.764, 19.4668], [-53.3482, 19.7446], [-54.3431, 20.9569], [-54.6967, 20.6033]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-54.6967, 20.6033], [-54.3431, 20.9569], [-55.5554, 21.9518], [-55.8332, 21.536]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-55.8332, 21.536], [-55.5554, 21.9518], [-56.9385, 22.691], [-57.1299, 22.2291]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-57.1299, 22.2291], [-56.9385, 22.691], [-58.4393, 23.1463], [-58.5368, 22.6559]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-58.5368, 22.6559], [-58.4393, 23.1463], [-60, 23.3], [-60, 22.8]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-60, 22.8], [-60, 23.3], [-61.5607, 23.1463], [-61.4632, 22.6559]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-61.4632, 22.6559], [-61.5607, 23.1463], [-63.0615, 22.691], [-62.8701, 22.2291]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-62.8701, 22.2291], [-63.0615, 22.691], [-64.4446, 21.9518], [-64.1668, 21.536]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-64.1668, 21.536], [-64.4446, 21.9518], [-65.6569, 20.9569], [-65.3033, 20.6033]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-65.3033, 20.6033], [-65.6569, 20.9569], [-66.6518, 19.7446], [-66.236, 19.4668]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-66.236, 19.4668], [-66.6518, 19.7446], [-67.391, 18.3615], [-66.9291, 18.1701]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-66.9291, 18.1701], [-67.391, 18.3615], [-67.8463, 16.8607], [-67.3559, 16.7632]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-67.3559, 16.7632], [-67.8463, 16.8607], [-68, 15.3], [-67.5, 15.3]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-67.5, 15.3], [-68, 15.3], [-67.8463, 13.7393], [-67.3559, 13.8368]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-67.3559, 13.8368], [-67.8463, 13.7393], [-67.391, 12.2385], [-66.9291, 12.4299]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-66.9291, 12.4299], [-67.391, 12.2385], [-66.6518, 10.8554], [-66.236, 11.1332]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-66.236, 11.1332], [-66.6518, 10.8554], [-65.6569, 9.6431], [-65.3033, 9.9967]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-65.3033, 9.9967], [-65.6569, 9.6431], [-64.4446, 8.6482], [-64.1668, 9.064]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-64.1668, 9.064], [-64.4446, 8.6482], [-63.0615, 7.909], [-62.8701, 8.3709]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-62.8701, 8.3709], [-63.0615, 7.909], [-61.5607, 7.4537], [-61.4632, 7.9441]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-61.4632, 7.9441], [-61.5607, 7.4537], [-60, 7.3], [-60, 7.8]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-60, 7.8], [-60, 7.3], [-58.4393, 7.4537], [-58.5368, 7.9441]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-58.5368, 7.9441], [-58.4393, 7.4537], [-56.9385, 7.909], [-57.1299, 8.3709]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-57.1299, 8.3709], [-56.9385, 7.909], [-55.5554, 8.6482], [-55.8332, 9.064]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-55.8332, 9.064], [-55.5554, 8.6482], [-54.3431, 9.6431], [-54.6967, 9.9967]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-54.6967, 9.9967], [-54.3431, 9.6431], [-53.3482, 10.8554], [-53.764, 11.1332]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-53.764, 11.1332], [-53.3482, 10.8554], [-52.609, 12.2385], [-53.0709, 12.4299]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-53.0709, 12.4299], [-52.609, 12.2385], [-52.1537, 13.7393], [-52.6441, 13.8368]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-52.6441, 13.8368], [-52.1537, 13.7393], [-52, 15.3], [-52.5, 15.3]], y: [0.6, 2.2], collide: 0}
      - {kind: poly, points: [[-57.8, 15.3], [-57.4, 15.3], [-57.45, 15.8072], [-57.8423, 15.7292]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-57.8423, 15.7292], [-57.45, 15.8072], [-57.5979, 16.295], [-57.9675, 16.1419]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-57.9675, 16.1419], [-57.5979, 16.295], [-57.8382, 16.7445], [-58.1708, 16.5223]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-58.1708, 16.5223], [-57.8382, 16.7445], [-58.1615, 17.1385], [-58.4444, 16.8556]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-58.4444, 16.8556], [-58.1615, 17.1385], [-58.5555, 17.4618], [-58.7777, 17.1292]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-58.7777, 17.1292], [-58.5555, 17.4618], [-59.005, 17.7021], [-59.1581, 17.3325]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-59.1581, 17.3325], [-59.005, 17.7021], [-59.4928, 17.85], [-59.5708, 17.4577]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-59.5708, 17.4577], [-59.4928, 17.85], [-60, 17.9], [-60, 17.5]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-60, 17.5], [-60, 17.9], [-60.5072, 17.85], [-60.4292, 17.4577]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-60.4292, 17.4577], [-60.5072, 17.85], [-60.995, 17.7021], [-60.8419, 17.3325]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-60.8419, 17.3325], [-60.995, 17.7021], [-61.4445, 17.4618], [-61.2223, 17.1292]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-61.2223, 17.1292], [-61.4445, 17.4618], [-61.8385, 17.1385], [-61.5556, 16.8556]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-61.5556, 16.8556], [-61.8385, 17.1385], [-62.1618, 16.7445], [-61.8292, 16.5223]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-61.8292, 16.5223], [-62.1618, 16.7445], [-62.4021, 16.295], [-62.0325, 16.1419]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-62.0325, 16.1419], [-62.4021, 16.295], [-62.55, 15.8072], [-62.1577, 15.7292]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-62.1577, 15.7292], [-62.55, 15.8072], [-62.6, 15.3], [-62.2, 15.3]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-62.2, 15.3], [-62.6, 15.3], [-62.55, 14.7928], [-62.1577, 14.8708]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-62.1577, 14.8708], [-62.55, 14.7928], [-62.4021, 14.305], [-62.0325, 14.4581]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-62.0325, 14.4581], [-62.4021, 14.305], [-62.1618, 13.8555], [-61.8292, 14.0777]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-61.8292, 14.0777], [-62.1618, 13.8555], [-61.8385, 13.4615], [-61.5556, 13.7444]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-61.5556, 13.7444], [-61.8385, 13.4615], [-61.4445, 13.1382], [-61.2223, 13.4708]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-61.2223, 13.4708], [-61.4445, 13.1382], [-60.995, 12.8979], [-60.8419, 13.2675]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-60.8419, 13.2675], [-60.995, 12.8979], [-60.5072, 12.75], [-60.4292, 13.1423]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-60.4292, 13.1423], [-60.5072, 12.75], [-60, 12.7], [-60, 13.1]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-60, 13.1], [-60, 12.7], [-59.4928, 12.75], [-59.5708, 13.1423]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-59.5708, 13.1423], [-59.4928, 12.75], [-59.005, 12.8979], [-59.1581, 13.2675]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-59.1581, 13.2675], [-59.005, 12.8979], [-58.5555, 13.1382], [-58.7777, 13.4708]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-58.7777, 13.4708], [-58.5555, 13.1382], [-58.1615, 13.4615], [-58.4444, 13.7444]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-58.4444, 13.7444], [-58.1615, 13.4615], [-57.8382, 13.8555], [-58.1708, 14.0777]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-58.1708, 14.0777], [-57.8382, 13.8555], [-57.5979, 14.305], [-57.9675, 14.4581]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-57.9675, 14.4581], [-57.5979, 14.305], [-57.45, 14.7928], [-57.8423, 14.8708]], y: [0.8, 2.0], collide: 0}
      - {kind: poly, points: [[-57.8423, 14.8708], [-57.45, 14.7928], [-57.4, 15.3], [-57.8, 15.3]], y: [0.8, 2.0], collide: 0}
      - {kind: disc, center: [-60, 15.3], radius: 1.2, y: [0.4, 3.6], collide: 0, color: "#6f6a60"}   # the shaft
  - id: basin
    shape: part
    pos: [0, 0, 0]
    fixed: true
    friction: 0
    color: "#c8b98f"
    pieces:
      - {kind: poly, points: [[-101, -1.5], [96, -1.5], [96, 0], [-101, 0]], y: [-0.5, 3.0], collide: 2, color: "#bfae86"}   # the water's bed (drawn only below the picture)
      - {kind: poly, points: [[-101, 0], [-100, 0], [-100, 12], [-101, 12]], y: [-0.5, 3.0], collide: 2, color: "#a89878"}
      - {kind: poly, points: [[95, 0], [96, 0], [96, 12], [95, 12]], y: [-0.5, 3.0], collide: 2, color: "#a89878"}
joints:
  - {id: j_v, type: slide, body: vessel, axis: [1, 0, 0], damping: 0.6}   # + : forward (to the right)
  - {id: j_w, type: hinge, body: wheel, axis: [0, 1, 0], damping: 0.0001}   # + : the top going forward (clockwise as seen)
contact: {solref: [0.004, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_w, kind: velocity, rpm: 24, max_torque: 5}   # the engine turns the wheel in the vessel: the only input
checks:
  - {type: monotonic, joint: j_v, direction: 1, max_back: 0.3, settle_s: 2.0, window_s: 7}
  - {type: penetration, max: 0.003}
camera: {target: [-12, 0, 12], position: [-12, -150, 16], fov: 40}
fluid:
  plane: xz
  slab: [0.3, 2.5]
  spacing: 0.5
  dt: 0.002
  domain: [-101, -1.5, 96, 31.8]
  fill: [[-100, 0, 95, 8]]
  tiers: [{id: light, label: "Lighter water (fewer particles)", spacing: 0.7}]
display:
  output: j_v
  labels: {j_v: "Vessel (forward)", j_w: "Paddle-wheel (engine)"}
