# No. 441 (Brown 1868): Persian wheel.
# Model (cm, gravity on, Brown's side view). A wheel 20 cm across on a hollow shaft, with 6 curved floats from the shaft's drum to the
# rim; from the end of each float hangs a bucket (2.6 cm across, 2 cm deep) on a pin. The water is particles in the plane of the wheel
# (src/fluid/, about 0.65 cm apart, each pushing what it touches): a stream 10 cm deep is kept up upstream and runs under the wheel, on
# the convex side of its lowest floats, and out of the picture: the only input is the water (nothing else is driven). Each bucket dips into
# the stream at the bottom, fills, and rises plumb on its pin up the right-hand side, until a lug on its outer side meets the stationary pin
# beside the wheel, which tilts it and empties it into the trough. The load on the shaft: 0.015 N m s. Generator: opencode-runs/water/gen441.py.
number: 441
slug: persian-wheel
name: Persian wheel
brown: "Persian wheel, used in Eastern countries for irrigation. It has a hollow shaft and curved floats, at the extremities of which are suspended buckets or tubs. The wheel is partly immersed in a stream acting on the convex surface of its floats, and as it is thus caused to revolve, a quantity of water will be elevated by each float at each revolution, and conducted to the hollow shaft at the same time that one of the buckets carries its fill of water to a higher level, where it is emptied by coming in contact with a stationary pin placed in a convenient position for tilting it."
units: cm
sim:
  timestep: 0.002
  integrator: implicitfast
  iterations: 50
  duration_s: 12
  floor: false
bodies:
  - id: wheel
    shape: part
    pos: [0, 0, 14]
    density: 700
    friction: 0.3
    color: "#b49a70"
    pieces:
      - {kind: poly, points: [[2.3919, 13.896], [3.3282, 12.9229], [3.5444, 13.1309], [2.6081, 14.104]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[3.3066, 12.9516], [3.9874, 11.7787], [4.2469, 11.9293], [3.566, 13.1022]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[3.9726, 11.814], [4.3535, 10.4358], [4.6427, 10.5157], [4.2617, 11.894]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[4.3482, 10.471], [4.3965, 8.9578], [4.6964, 8.9674], [4.648, 10.4806]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[4.3991, 8.9908], [4.0974, 7.4163], [4.392, 7.3599], [4.6938, 8.9343]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[4.1064, 7.4461], [3.4507, 5.8825], [3.7274, 5.7665], [4.383, 7.3301]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[3.4647, 5.9084], [2.4638, 4.4246], [2.7125, 4.2569], [3.7134, 5.7407]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[1.286, 16.0195], [2.5969, 16.3437], [2.5249, 16.635], [1.214, 16.3107]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[2.5613, 16.3393], [3.9174, 16.3426], [3.9167, 16.6426], [2.5606, 16.6393]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[3.8794, 16.3474], [5.2634, 15.9882], [5.3388, 16.2785], [3.9547, 16.6377]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[5.2303, 16.0011], [6.565, 15.2864], [6.7066, 15.5509], [5.3719, 16.2656]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[6.5377, 15.3052], [7.7503, 14.2566], [7.9465, 14.4835], [6.7339, 15.5321]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[7.729, 14.2793], [8.7553, 12.9297], [8.9941, 13.1113], [7.9678, 14.4608]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[8.7399, 12.9547], [9.5244, 11.3461], [9.7941, 11.4776], [9.0095, 13.0862]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[-1.1059, 16.1235], [-0.7313, 17.4209], [-1.0195, 17.5041], [-1.3941, 16.2067]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-0.7453, 17.3878], [-0.07, 18.5639], [-0.3302, 18.7132], [-1.0055, 17.5372]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-0.0932, 18.5333], [0.9099, 19.5524], [0.6961, 19.7628], [-0.307, 18.7438]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[0.8821, 19.5301], [2.1684, 20.3286], [2.0102, 20.5835], [0.7239, 19.785]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[2.1385, 20.3144], [3.6529, 20.8403], [3.5545, 21.1237], [2.0401, 20.5978]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[3.6227, 20.8332], [5.3046, 21.0471], [5.2667, 21.3447], [3.5848, 21.1308]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[5.2752, 21.0463], [7.0606, 20.9214], [7.0815, 21.2207], [5.2961, 21.3456]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[-2.3919, 14.104], [-3.3282, 15.0771], [-3.5444, 14.8691], [-2.6081, 13.896]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-3.3066, 15.0484], [-3.9874, 16.2213], [-4.2469, 16.0707], [-3.566, 14.8978]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-3.9726, 16.186], [-4.3535, 17.5642], [-4.6427, 17.4843], [-4.2617, 16.106]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-4.3482, 17.529], [-4.3965, 19.0422], [-4.6964, 19.0326], [-4.648, 17.5194]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-4.3991, 19.0092], [-4.0974, 20.5837], [-4.392, 20.6401], [-4.6938, 19.0657]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[-4.1064, 20.5539], [-3.4507, 22.1175], [-3.7274, 22.2335], [-4.383, 20.6699]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[-3.4647, 22.0916], [-2.4638, 23.5754], [-2.7125, 23.7431], [-3.7134, 22.2593]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[-1.286, 11.9805], [-2.5969, 11.6563], [-2.5249, 11.365], [-1.214, 11.6893]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-2.5613, 11.6607], [-3.9174, 11.6574], [-3.9167, 11.3574], [-2.5606, 11.3607]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-3.8794, 11.6526], [-5.2634, 12.0118], [-5.3388, 11.7215], [-3.9547, 11.3623]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-5.2303, 11.9989], [-6.565, 12.7136], [-6.7066, 12.4491], [-5.3719, 11.7344]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-6.5377, 12.6948], [-7.7503, 13.7434], [-7.9465, 13.5165], [-6.7339, 12.4679]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[-7.729, 13.7207], [-8.7553, 15.0703], [-8.9941, 14.8887], [-7.9678, 13.5392]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[-8.7399, 15.0453], [-9.5244, 16.6539], [-9.7941, 16.5224], [-9.0095, 14.9138]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[1.1059, 11.8765], [0.7313, 10.5791], [1.0195, 10.4959], [1.3941, 11.7933]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[0.7453, 10.6122], [0.07, 9.4361], [0.3302, 9.2868], [1.0055, 10.4628]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[0.0932, 9.4667], [-0.9099, 8.4476], [-0.6961, 8.2372], [0.307, 9.2562]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-0.8821, 8.4699], [-2.1684, 7.6714], [-2.0102, 7.4165], [-0.7239, 8.215]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-2.1385, 7.6856], [-3.6529, 7.1597], [-3.5545, 6.8763], [-2.0401, 7.4022]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[-3.6227, 7.1668], [-5.3046, 6.9529], [-5.2667, 6.6553], [-3.5848, 6.8692]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[-5.2752, 6.9537], [-7.0606, 7.0786], [-7.0815, 6.7793], [-5.2961, 6.6544]], y: [0.3, 2.5], collide: 0}
      - {kind: poly, points: [[10.0598, 14.0052], [9.9078, 15.7417], [9.7883, 15.7313], [9.9402, 13.9948]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[9.906, 15.752], [9.4549, 17.4357], [9.339, 17.4047], [9.7901, 15.721]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[9.4513, 17.4456], [8.7146, 19.0254], [8.6059, 18.9746], [9.3425, 17.3948]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[8.7094, 19.0344], [7.7096, 20.4623], [7.6113, 20.3935], [8.6111, 18.9656]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[7.7029, 20.4703], [6.4703, 21.7029], [6.3854, 21.618], [7.618, 20.3854]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[6.4623, 21.7096], [5.0344, 22.7094], [4.9656, 22.6111], [6.3935, 21.6113]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[5.0254, 22.7146], [3.4456, 23.4513], [3.3948, 23.3425], [4.9746, 22.6059]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[3.4357, 23.4549], [1.752, 23.906], [1.721, 23.7901], [3.4047, 23.339]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[1.7417, 23.9078], [0.0052, 24.0598], [-0.0052, 23.9402], [1.7313, 23.7883]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-0.0052, 24.0598], [-1.7417, 23.9078], [-1.7313, 23.7883], [0.0052, 23.9402]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-1.752, 23.906], [-3.4357, 23.4549], [-3.4047, 23.339], [-1.721, 23.7901]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-3.4456, 23.4513], [-5.0254, 22.7146], [-4.9746, 22.6059], [-3.3948, 23.3425]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-5.0344, 22.7094], [-6.4623, 21.7096], [-6.3935, 21.6113], [-4.9656, 22.6111]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-6.4703, 21.7029], [-7.7029, 20.4703], [-7.618, 20.3854], [-6.3854, 21.618]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-7.7096, 20.4623], [-8.7094, 19.0344], [-8.6111, 18.9656], [-7.6113, 20.3935]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-8.7146, 19.0254], [-9.4513, 17.4456], [-9.3425, 17.3948], [-8.6059, 18.9746]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-9.4549, 17.4357], [-9.906, 15.752], [-9.7901, 15.721], [-9.339, 17.4047]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-9.9078, 15.7417], [-10.0598, 14.0052], [-9.9402, 13.9948], [-9.7883, 15.7313]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-10.0598, 13.9948], [-9.9078, 12.2583], [-9.7883, 12.2687], [-9.9402, 14.0052]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-9.906, 12.248], [-9.4549, 10.5643], [-9.339, 10.5953], [-9.7901, 12.279]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-9.4513, 10.5544], [-8.7146, 8.9746], [-8.6059, 9.0254], [-9.3425, 10.6052]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-8.7094, 8.9656], [-7.7096, 7.5377], [-7.6113, 7.6065], [-8.6111, 9.0344]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-7.7029, 7.5297], [-6.4703, 6.2971], [-6.3854, 6.382], [-7.618, 7.6146]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-6.4623, 6.2904], [-5.0344, 5.2906], [-4.9656, 5.3889], [-6.3935, 6.3887]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-5.0254, 5.2854], [-3.4456, 4.5487], [-3.3948, 4.6575], [-4.9746, 5.3941]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-3.4357, 4.5451], [-1.752, 4.094], [-1.721, 4.2099], [-3.4047, 4.661]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[-1.7417, 4.0922], [-0.0052, 3.9402], [0.0052, 4.0598], [-1.7313, 4.2117]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[0.0052, 3.9402], [1.7417, 4.0922], [1.7313, 4.2117], [-0.0052, 4.0598]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[1.752, 4.094], [3.4357, 4.5451], [3.4047, 4.661], [1.721, 4.2099]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[3.4456, 4.5487], [5.0254, 5.2854], [4.9746, 5.3941], [3.3948, 4.6575]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[5.0344, 5.2906], [6.4623, 6.2904], [6.3935, 6.3887], [4.9656, 5.3889]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[6.4703, 6.2971], [7.7029, 7.5297], [7.618, 7.6146], [6.3854, 6.382]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[7.7096, 7.5377], [8.7094, 8.9656], [8.6111, 9.0344], [7.6113, 7.6065]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[8.7146, 8.9746], [9.4513, 10.5544], [9.3425, 10.6052], [8.6059, 9.0254]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[9.4549, 10.5643], [9.906, 12.248], [9.7901, 12.279], [9.339, 10.5953]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: poly, points: [[9.9078, 12.2583], [10.0598, 13.9948], [9.9402, 14.0052], [9.7883, 12.2687]], y: [2.55, 2.75], color: "#8f7a58"}
      - {kind: disc, center: [0, 14], radius: 2.4, inner: 1.7, y: [0.2, 2.6], color: "#8f7a58"}   # the hollow shaft's drum
      - {kind: disc, center: [0, 14], radius: 1.7, inner: 1.4, y: [-0.4, 3.6], color: "#6f6a60"}   # the hollow shaft
  - id: bucket0
    shape: part
    pos: [2.5882, 0, 4.3407]
    mount: wheel
    density: 800
    friction: 0.3
    color: "#8a7d68"
    pieces:
      - {kind: poly, points: [[1.0682, 1.6207], [4.1082, 1.6207], [4.1082, 1.8407], [1.0682, 1.8407]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[1.0682, 1.6207], [1.2882, 1.6207], [1.2882, 3.8407], [1.0682, 3.8407]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[3.8882, 1.6207], [4.1082, 1.6207], [4.1082, 3.8407], [3.8882, 3.8407]], y: [0.3, 2.5], collide: 2}
      - {kind: rod, from: [2.5882, 2.9, 4.3407], to: [2.5882, 2.9, 7.1407], radius: 0.12, collide: 2, capsule: true}   # its stem, which the pin holds back
      - {kind: rod, from: [2.5882, 2.65, 4.3407], to: [1.1782, 2.65, 3.8407], radius: 0.05, color: "#6f6a60"}   # the bail
      - {kind: rod, from: [2.5882, 2.65, 4.3407], to: [3.9982, 2.65, 3.8407], radius: 0.05, color: "#6f6a60"}
      - {kind: disc, center: [2.5882, 4.3407], radius: 0.25, y: [2.55, 2.85], color: "#6f6a60"}
  - id: bucket1
    shape: part
    pos: [9.6593, 0, 11.4118]
    mount: wheel
    density: 800
    friction: 0.3
    color: "#8a7d68"
    pieces:
      - {kind: poly, points: [[8.1393, 8.6918], [11.1793, 8.6918], [11.1793, 8.9118], [8.1393, 8.9118]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[8.1393, 8.6918], [8.3593, 8.6918], [8.3593, 10.9118], [8.1393, 10.9118]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[10.9593, 8.6918], [11.1793, 8.6918], [11.1793, 10.9118], [10.9593, 10.9118]], y: [0.3, 2.5], collide: 2}
      - {kind: rod, from: [9.6593, 2.9, 11.4118], to: [9.6593, 2.9, 14.2118], radius: 0.12, collide: 2, capsule: true}   # its stem, which the pin holds back
      - {kind: rod, from: [9.6593, 2.65, 11.4118], to: [8.2493, 2.65, 10.9118], radius: 0.05, color: "#6f6a60"}   # the bail
      - {kind: rod, from: [9.6593, 2.65, 11.4118], to: [11.0693, 2.65, 10.9118], radius: 0.05, color: "#6f6a60"}
      - {kind: disc, center: [9.6593, 11.4118], radius: 0.25, y: [2.55, 2.85], color: "#6f6a60"}
  - id: bucket2
    shape: part
    pos: [7.0711, 0, 21.0711]
    mount: wheel
    density: 800
    friction: 0.3
    color: "#8a7d68"
    pieces:
      - {kind: poly, points: [[5.5511, 18.3511], [8.5911, 18.3511], [8.5911, 18.5711], [5.5511, 18.5711]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[5.5511, 18.3511], [5.7711, 18.3511], [5.7711, 20.5711], [5.5511, 20.5711]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[8.3711, 18.3511], [8.5911, 18.3511], [8.5911, 20.5711], [8.3711, 20.5711]], y: [0.3, 2.5], collide: 2}
      - {kind: rod, from: [7.0711, 2.9, 21.0711], to: [7.0711, 2.9, 23.8711], radius: 0.12, collide: 2, capsule: true}   # its stem, which the pin holds back
      - {kind: rod, from: [7.0711, 2.65, 21.0711], to: [5.6611, 2.65, 20.5711], radius: 0.05, color: "#6f6a60"}   # the bail
      - {kind: rod, from: [7.0711, 2.65, 21.0711], to: [8.4811, 2.65, 20.5711], radius: 0.05, color: "#6f6a60"}
      - {kind: disc, center: [7.0711, 21.0711], radius: 0.25, y: [2.55, 2.85], color: "#6f6a60"}
  - id: bucket3
    shape: part
    pos: [-2.5882, 0, 23.6593]
    mount: wheel
    density: 800
    friction: 0.3
    color: "#8a7d68"
    pieces:
      - {kind: poly, points: [[-4.1082, 20.9393], [-1.0682, 20.9393], [-1.0682, 21.1593], [-4.1082, 21.1593]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-4.1082, 20.9393], [-3.8882, 20.9393], [-3.8882, 23.1593], [-4.1082, 23.1593]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-1.2882, 20.9393], [-1.0682, 20.9393], [-1.0682, 23.1593], [-1.2882, 23.1593]], y: [0.3, 2.5], collide: 2}
      - {kind: rod, from: [-2.5882, 2.9, 23.6593], to: [-2.5882, 2.9, 26.4593], radius: 0.12, collide: 2, capsule: true}   # its stem, which the pin holds back
      - {kind: rod, from: [-2.5882, 2.65, 23.6593], to: [-3.9982, 2.65, 23.1593], radius: 0.05, color: "#6f6a60"}   # the bail
      - {kind: rod, from: [-2.5882, 2.65, 23.6593], to: [-1.1782, 2.65, 23.1593], radius: 0.05, color: "#6f6a60"}
      - {kind: disc, center: [-2.5882, 23.6593], radius: 0.25, y: [2.55, 2.85], color: "#6f6a60"}
  - id: bucket4
    shape: part
    pos: [-9.6593, 0, 16.5882]
    mount: wheel
    density: 800
    friction: 0.3
    color: "#8a7d68"
    pieces:
      - {kind: poly, points: [[-11.1793, 13.8682], [-8.1393, 13.8682], [-8.1393, 14.0882], [-11.1793, 14.0882]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-11.1793, 13.8682], [-10.9593, 13.8682], [-10.9593, 16.0882], [-11.1793, 16.0882]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-8.3593, 13.8682], [-8.1393, 13.8682], [-8.1393, 16.0882], [-8.3593, 16.0882]], y: [0.3, 2.5], collide: 2}
      - {kind: rod, from: [-9.6593, 2.9, 16.5882], to: [-9.6593, 2.9, 19.3882], radius: 0.12, collide: 2, capsule: true}   # its stem, which the pin holds back
      - {kind: rod, from: [-9.6593, 2.65, 16.5882], to: [-11.0693, 2.65, 16.0882], radius: 0.05, color: "#6f6a60"}   # the bail
      - {kind: rod, from: [-9.6593, 2.65, 16.5882], to: [-8.2493, 2.65, 16.0882], radius: 0.05, color: "#6f6a60"}
      - {kind: disc, center: [-9.6593, 16.5882], radius: 0.25, y: [2.55, 2.85], color: "#6f6a60"}
  - id: bucket5
    shape: part
    pos: [-7.0711, 0, 6.9289]
    mount: wheel
    density: 800
    friction: 0.3
    color: "#8a7d68"
    pieces:
      - {kind: poly, points: [[-8.5911, 4.2089], [-5.5511, 4.2089], [-5.5511, 4.4289], [-8.5911, 4.4289]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-8.5911, 4.2089], [-8.3711, 4.2089], [-8.3711, 6.4289], [-8.5911, 6.4289]], y: [0.3, 2.5], collide: 2}
      - {kind: poly, points: [[-5.7711, 4.2089], [-5.5511, 4.2089], [-5.5511, 6.4289], [-5.7711, 6.4289]], y: [0.3, 2.5], collide: 2}
      - {kind: rod, from: [-7.0711, 2.9, 6.9289], to: [-7.0711, 2.9, 9.7289], radius: 0.12, collide: 2, capsule: true}   # its stem, which the pin holds back
      - {kind: rod, from: [-7.0711, 2.65, 6.9289], to: [-8.4811, 2.65, 6.4289], radius: 0.05, color: "#6f6a60"}   # the bail
      - {kind: rod, from: [-7.0711, 2.65, 6.9289], to: [-5.6611, 2.65, 6.4289], radius: 0.05, color: "#6f6a60"}
      - {kind: disc, center: [-7.0711, 6.9289], radius: 0.25, y: [2.55, 2.85], color: "#6f6a60"}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    friction: 0
    color: "#c8b98f"
    pieces:
      - {kind: poly, points: [[-35, -1], [38, -1], [38, 0], [-35, 0]], y: [0.3, 2.5], collide: 2}   # the stream's bed
      - {kind: poly, points: [[-36, -1], [-35, -1], [-35, 14], [-36, 14]], y: [0.0, 2.8], collide: 2}   # upstream: the reservoir's end (out of the picture)
      - {kind: rod, from: [3, 2.85, 25.1394], to: [3, 3.5, 25.1394], radius: 0.18, collide: 1, capsule: true, color: "#6f6a60"}   # the stationary pin that tilts each bucket
      - {kind: rod, from: [3, 3.5, 25.1394], to: [3, 3.5, 28.1394], radius: 0.18, color: "#6f6a60"}   # its arm
      - {kind: poly, points: [[-40, 15.458], [3.8, 19.4], [3.8, 19.65], [-40, 15.708]], y: [0.3, 2.5], collide: 2, color: "#a08a62"}   # the trough
      - {kind: poly, points: [[3.8, 19.4], [4.05, 19.4], [4.05, 20], [3.8, 20]], y: [0.3, 2.5], collide: 2, color: "#a08a62"}   # its upper end
      - {kind: rod, from: [3.2, 3.0, 19.346], to: [3.2, 4.0, 19.346], radius: 0.15, color: "#6f6a60"}   # a stay (to the frame behind)
      - {kind: rod, from: [-2, 3.0, 18.878], to: [-2, 4.0, 18.878], radius: 0.15, color: "#6f6a60"}   # a stay (to the frame behind)
      - {kind: rod, from: [-16, 1.4, 17.618], to: [-16, 1.4, 0], radius: 0.25, color: "#8f7a58"}   # a post under it, outside the wheel
      - {kind: rod, from: [-26, 1.4, 16.718], to: [-26, 1.4, 0], radius: 0.25, color: "#8f7a58"}   # a post under it, outside the wheel
      - {kind: poly, points: [[-0.8, 0], [0.8, 0], [0.5, 13.4], [-0.5, 13.4]], y: [3.6, 4.4], color: "#b7ad98"}   # the post carrying the hollow shaft (behind the wheel)
joints:
  - {id: j_w, type: hinge, body: wheel, axis: [0, -1, 0], damping: 0.015}   # + : anticlockwise as drawn (Brown's arrow)
  - {id: j_b0, type: hinge, body: bucket0, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_b1, type: hinge, body: bucket1, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_b2, type: hinge, body: bucket2, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_b3, type: hinge, body: bucket3, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_b4, type: hinge, body: bucket4, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_b5, type: hinge, body: bucket5, axis: [0, -1, 0], damping: 0.0002}
contact: {solref: [0.004, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_w, kind: torque, torque: 0, max_torque: 0.001}   # no hand on the wheel: the water is the only input
checks:
  - {type: turning, joint: j_w, direction: 1, min_mean: 0.3, min_fraction: 0.9, settle_s: 3.0, window_s: 8.5}
  - {type: penetration, max: 0.003}
camera: {target: [4, 0, 14], position: [4, -110, 14], fov: 17}
fluid:
  plane: xz
  slab: [0.3, 2.5]
  spacing: 0.65
  dt: 0.002
  draw: surface
  domain: [-41, -1.5, 39, 30]
  reservoir: {box: [-35, 0, -29, 13], head: 10}
  sinks: [[37, -1.5, 39, 13], [-40, 14.458, -37, 16.728]]
  controls: {head: [6, 12], label: "Depth of the stream"}
  tiers: [{id: light, label: "Lighter water (fewer particles)", spacing: 0.75, iterations: 1}]
display:
  output: j_w
  labels: {j_w: "Persian wheel", j_b0: "A bucket on its pin"}
  proof: {label: "Floats and buckets out of contact", sub: "the stream runs under the wheel and the wheel stands"}
  caption: right
