# No. 455 (Brown 1868): "Old rotary pump. Lower aperture entrance for water, and upper for exit. Central part revolves with its valves,
# which fit accurately to inner surface of outer cylinder. The projection shown in lower side of cylinder is an abutment to close the
# valves when they reach that point."
# Model (cm, gravity on, Brown's view from in front, cut in section). The central part, a drum on an axle 1.5 cm above the outer
# cylinder's centre, is turned clockwise at 20 rpm (the only drive). Its two valves are curved leaves hinged on its rim at opposite
# seats, trailing; each is pressed out by its spring and its edge (a round bar, colliding) rides the cylinder's inside; the abutment in
# the lower side (colliding) has a ramp that folds a valve flat onto the rim as it comes round and lets it spring out again over the
# entrance. The water is lumped vessels (src/fluid/vessels.c): `lo` is the entrance pipe and the chamber behind the valve that is out,
# `hi` the chamber ahead of it and the exit, both full. The drum is a displacer between them: a turn carries 373.295 cm^3
# from `lo` to `hi` (the chamber's depth times the mean of (R^2 - r^2)/2 across the valve's path from the entrance to the exit, a
# radian's worth), and the two pressures push back on it. The exit delivers 60 cm up, out of the picture, with inertia; a small
# leak (the valves' and the abutment's fit) runs back from `hi` to `lo`.
# Generator: opencode-runs/water/gen455.py.
number: 455
slug: old-rotary-pump
name: Old rotary pump
brown: "Old rotary pump. Lower aperture entrance for water, and upper for exit. Central part revolves with its valves, which fit accurately to inner surface of outer cylinder. The projection shown in lower side of cylinder is an abutment to close the valves when they reach that point."
units: cm
sim:
  timestep: 0.0001
  integrator: implicitfast
  iterations: 60
  duration_s: 12
  floor: false
bodies:
  - id: drum
    shape: part
    pos: [0, 0, 13]
    mass: 0.3
    color: "#5f5a52"
    pieces:
      - {kind: band, center: [0, 13], r: [3.8, 4.4], a: [0, 6.2832], y: [-0.5, 2.5], slices: 36, collide: 0, color: "#5f5a52"}
      - {kind: loft, a: [[-3.9013, 2.5, 13.1006], [-2.4215, 2.5, 16.0604], [-2.019, 2.5, 15.8592], [-3.4987, 2.5, 12.8994]], b: [[-3.9013, -0.5, 13.1006], [-2.4215, -0.5, 16.0604], [-2.019, -0.5, 15.8592], [-3.4987, -0.5, 12.8994]], collide: 0, color: "#5f5a52"}
      - {kind: loft, a: [[-2.2203, 2.5, 16.1848], [2.2203, 2.5, 16.1848], [2.2203, 2.5, 15.7348], [-2.2203, 2.5, 15.7348]], b: [[-2.2203, -0.5, 16.1848], [2.2203, -0.5, 16.1848], [2.2203, -0.5, 15.7348], [-2.2203, -0.5, 15.7348]], collide: 0, color: "#5f5a52"}
      - {kind: loft, a: [[2.4215, 2.5, 16.0604], [3.9013, 2.5, 13.1006], [3.4987, 2.5, 12.8994], [2.019, 2.5, 15.8592]], b: [[2.4215, -0.5, 16.0604], [3.9013, -0.5, 13.1006], [3.4987, -0.5, 12.8994], [2.019, -0.5, 15.8592]], collide: 0, color: "#5f5a52"}
      - {kind: loft, a: [[3.9013, 2.5, 12.8994], [2.4215, 2.5, 9.9396], [2.019, 2.5, 10.1408], [3.4987, 2.5, 13.1006]], b: [[3.9013, -0.5, 12.8994], [2.4215, -0.5, 9.9396], [2.019, -0.5, 10.1408], [3.4987, -0.5, 13.1006]], collide: 0, color: "#5f5a52"}
      - {kind: loft, a: [[2.2203, 2.5, 9.8152], [-2.2203, 2.5, 9.8152], [-2.2203, 2.5, 10.2652], [2.2203, 2.5, 10.2652]], b: [[2.2203, -0.5, 9.8152], [-2.2203, -0.5, 9.8152], [-2.2203, -0.5, 10.2652], [2.2203, -0.5, 10.2652]], collide: 0, color: "#5f5a52"}
      - {kind: loft, a: [[-2.4215, 2.5, 9.9396], [-3.9013, 2.5, 12.8994], [-3.4987, 2.5, 13.1006], [-2.019, 2.5, 10.1408]], b: [[-2.4215, -0.5, 9.9396], [-3.9013, -0.5, 12.8994], [-3.4987, -0.5, 13.1006], [-2.019, -0.5, 10.1408]], collide: 0, color: "#5f5a52"}
      - {kind: rod, from: [4.4, -0.55, 13], to: [4.4, 2.5, 13], radius: 0.3, collide: 0, color: "#5f5a52"}
      - {kind: rod, from: [-4.4, -0.55, 13], to: [-4.4, 2.5, 13], radius: 0.3, collide: 0, color: "#5f5a52"}
  - id: vl
    shape: part
    mount: drum
    pos: [-4.4, 0, 13]
    mass: 0.004
    color: "#c8781e"
    pieces:
      - {kind: band, center: [0, 13], r: [4.42, 4.72], a: [3.1816, 4.0647], y: [-0.45, 2.6], slices: 8, collide: 0, color: "#c8781e"}
      - {kind: rod, from: [-2.7453, -0.45, 9.3715], to: [-2.7453, 2.6, 9.3715], radius: 0.15, collide: 2, capsule: true, color: "#c8781e"}
  - id: vr
    shape: part
    mount: drum
    pos: [4.4, 0, 13]
    mass: 0.004
    color: "#c8781e"
    pieces:
      - {kind: band, center: [0, 13], r: [4.42, 4.72], a: [0.04, 0.9231], y: [-0.45, 2.6], slices: 8, collide: 0, color: "#c8781e"}
      - {kind: rod, from: [2.7453, -0.45, 16.6285], to: [2.7453, 2.6, 16.6285], radius: 0.15, collide: 2, capsule: true, color: "#c8781e"}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#d6cdb8"
    pieces:
      - {kind: band, center: [0, 11.5], r: [8, 8.7], a: [-1.3708, 0.573], y: [-0.6, 3], slices: 20, collide: 1, color: "#b9ae98"}
      - {kind: band, center: [0, 11.5], r: [8, 8.7], a: [0.893, 4.4824], y: [-0.6, 3], slices: 36, collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[7.3102, -0.3, 16.217], [6.7221, -0.3, 15.8375], [5.0164, -0.3, 17.7318], [5.4553, -0.3, 18.2771]], b: [[7.3102, -0.6, 16.217], [6.7221, -0.6, 15.8375], [5.0164, -0.6, 17.7318], [5.4553, -0.6, 18.2771]], collide: 0, color: "#b9ae98"}
      - {kind: disc, center: [0, 11.5], radius: 8.7, y: [2.6, 3], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[7.7353, 3, 13.5409], [7.3129, 3, 12.804], [8.2954, 3, 12.7776], [8.1343, 3, 13.5688]], b: [[7.7353, -0.6, 13.5409], [7.3129, -0.6, 12.804], [8.2954, -0.6, 12.7776], [8.1343, -0.6, 13.5688]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[7.3129, 3, 12.804], [6.7694, 3, 12.1603], [8.3807, 3, 11.9605], [8.2954, 3, 12.7776]], b: [[7.3129, -0.6, 12.804], [6.7694, -0.6, 12.1603], [8.3807, -0.6, 11.9605], [8.2954, -0.6, 12.7776]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[6.7694, 3, 12.1603], [6.1182, 3, 11.6317], [8.3852, 3, 11.1247], [8.3807, 3, 11.9605]], b: [[6.7694, -0.6, 12.1603], [6.1182, -0.6, 11.6317], [8.3852, -0.6, 11.1247], [8.3807, -0.6, 11.9605]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[6.1182, 3, 11.6317], [5.3778, 3, 11.238], [8.3046, 3, 10.279], [8.3852, 3, 11.1247]], b: [[6.1182, -0.6, 11.6317], [5.3778, -0.6, 11.238], [8.3046, -0.6, 10.279], [8.3852, -0.6, 11.1247]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[5.3778, 3, 11.238], [4.5707, 3, 10.9958], [8.1358, 3, 9.4326], [8.3046, 3, 10.279]], b: [[5.3778, -0.6, 11.238], [4.5707, -0.6, 10.9958], [8.1358, -0.6, 9.4326], [8.3046, -0.6, 10.279]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[4.5707, 3, 10.9958], [4.3204, 3, 10.5842], [7.8765, 3, 8.5958], [8.1358, 3, 9.4326]], b: [[4.5707, -0.6, 10.9958], [4.3204, -0.6, 10.5842], [7.8765, -0.6, 8.5958], [8.1358, -0.6, 9.4326]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[4.3204, 3, 10.5842], [4.0673, 3, 10.1787], [7.526, 3, 7.7794], [7.8765, 3, 8.5958]], b: [[4.3204, -0.6, 10.5842], [4.0673, -0.6, 10.1787], [7.526, -0.6, 7.7794], [7.8765, -0.6, 8.5958]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[4.0673, 3, 10.1787], [3.7762, 3, 9.7995], [7.0851, 3, 6.995], [7.526, 3, 7.7794]], b: [[4.0673, -0.6, 10.1787], [3.7762, -0.6, 9.7995], [7.0851, -0.6, 6.995], [7.526, -0.6, 7.7794]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[3.7762, 3, 9.7995], [3.4498, 3, 9.4502], [6.5561, 3, 6.2538], [7.0851, 3, 6.995]], b: [[3.7762, -0.6, 9.7995], [3.4498, -0.6, 9.4502], [6.5561, -0.6, 6.2538], [7.0851, -0.6, 6.995]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[3.4498, 3, 9.4502], [3.0913, 3, 9.134], [5.9431, 3, 5.5674], [6.5561, 3, 6.2538]], b: [[3.4498, -0.6, 9.4502], [3.0913, -0.6, 9.134], [5.9431, -0.6, 5.5674], [6.5561, -0.6, 6.2538]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[3.0913, 3, 9.134], [2.704, 3, 8.8538], [5.2519, 3, 4.9469], [5.9431, 3, 5.5674]], b: [[3.0913, -0.6, 9.134], [2.704, -0.6, 8.8538], [5.2519, -0.6, 4.9469], [5.9431, -0.6, 5.5674]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[2.704, 3, 8.8538], [2.2914, 3, 8.6123], [4.49, 3, 4.4024], [5.2519, 3, 4.9469]], b: [[2.704, -0.6, 8.8538], [2.2914, -0.6, 8.6123], [4.49, -0.6, 4.4024], [5.2519, -0.6, 4.9469]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[2.2914, 3, 8.6123], [1.8575, 3, 8.4117], [3.6664, 3, 3.9434], [4.49, 3, 4.4024]], b: [[2.2914, -0.6, 8.6123], [1.8575, -0.6, 8.4117], [3.6664, -0.6, 3.9434], [4.49, -0.6, 4.4024]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[1.8575, 3, 8.4117], [1.4063, 3, 8.254], [2.7917, 3, 3.5781], [3.6664, 3, 3.9434]], b: [[1.8575, -0.6, 8.4117], [1.4063, -0.6, 8.254], [2.7917, -0.6, 3.5781], [3.6664, -0.6, 3.9434]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[-2.45, -0.6, 3.8], [-1.75, -0.6, 3.8], [-1.75, 3, 3.8], [-2.45, 3, 3.8]], b: [[-2.45, -0.6, -3.5], [-1.75, -0.6, -3.5], [-1.75, 3, -3.5], [-2.45, 3, -3.5]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[1.25, -0.6, 3.7], [1.95, -0.6, 3.7], [1.95, 3, 3.7], [1.25, 3, 3.7]], b: [[1.25, -0.6, -3.5], [1.95, -0.6, -3.5], [1.95, 3, -3.5], [1.25, 3, -3.5]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-1.75, 2.6, 3.8], [1.25, 2.6, 3.8], [1.25, 3, 3.8], [-1.75, 3, 3.8]], b: [[-1.75, 2.6, -3.5], [1.25, 2.6, -3.5], [1.25, 3, -3.5], [-1.75, 3, -3.5]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[5.9304, 3, 15.5869], [11.7717, 3, 17.947], [12.0339, 3, 17.2979], [6.1927, 3, 14.9379]], b: [[5.9304, -0.6, 15.5869], [11.7717, -0.6, 17.947], [12.0339, -0.6, 17.2979], [6.1927, -0.6, 14.9379]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[4.8441, 3, 18.2758], [10.6853, 3, 20.6358], [10.9476, 3, 19.9868], [5.1063, 3, 17.6267]], b: [[4.8441, -0.6, 18.2758], [10.6853, -0.6, 20.6358], [10.9476, -0.6, 19.9868], [5.1063, -0.6, 17.6267]], collide: 1, color: "#b9ae98"}
      - {kind: loft, a: [[6.2086, 3, 15.6993], [11.7717, 3, 17.947], [10.9476, 3, 19.9868], [5.3845, 3, 17.7391]], b: [[6.2086, 2.6, 15.6993], [11.7717, 2.6, 17.947], [10.9476, 2.6, 19.9868], [5.3845, 2.6, 17.7391]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-6.6, 0, -5.5], [6.6, 0, -5.5], [6.6, 6.6, -5.5], [-6.6, 6.6, -5.5]], b: [[-6.6, 0, -6.1], [6.6, 0, -6.1], [6.6, 6.6, -6.1], [-6.6, 6.6, -6.1]], collide: 0, color: "#9c9282"}
      - {kind: loft, a: [[-6.6, 6, 0], [6.6, 6, 0], [6.6, 6.6, 0], [-6.6, 6.6, 0]], b: [[-6.6, 6, -5.5], [6.6, 6, -5.5], [6.6, 6.6, -5.5], [-6.6, 6.6, -5.5]], collide: 0, color: "#9c9282"}
      - {kind: loft, a: [[-6.6, 0, 0], [-6, 0, 0], [-6, 6, 0], [-6.6, 6, 0]], b: [[-6.6, 0, -5.5], [-6, 0, -5.5], [-6, 6, -5.5], [-6.6, 6, -5.5]], collide: 0, color: "#9c9282"}
      - {kind: loft, a: [[6, 0, 0], [6.6, 0, 0], [6.6, 6, 0], [6, 6, 0]], b: [[6, 0, -5.5], [6.6, 0, -5.5], [6.6, 6, -5.5], [6, 6, -5.5]], collide: 0, color: "#9c9282"}
      - {kind: loft, a: [[-20, 0, 0], [-6.6, 0, 0], [-6.6, 8, 0], [-20, 8, 0]], b: [[-20, 0, -1.2], [-6.6, 0, -1.2], [-6.6, 8, -1.2], [-20, 8, -1.2]], collide: 0, color: "#8b7d66"}
      - {kind: loft, a: [[6.6, 0, 0], [20, 0, 0], [20, 8, 0], [6.6, 8, 0]], b: [[6.6, 0, -1.2], [20, 0, -1.2], [20, 8, -1.2], [6.6, 8, -1.2]], collide: 0, color: "#8b7d66"}
joints:
  - {id: j_d, type: hinge, body: drum, axis: [0, 1, 0], damping: 0.002}   # the drum on its axle; + turns it clockwise as seen (up the left side)
  - {id: j_vl, type: hinge, body: vl, axis: [0, 1, 0], range: [0, 1.6], damping: 0.0005, stiffness: 0.01, springref: 2.2}   # 0: folded on the rim; + swings it out
  - {id: j_vr, type: hinge, body: vr, axis: [0, 1, 0], range: [0, 1.6], damping: 0.0005, stiffness: 0.01, springref: 2.2}   # 0: folded on the rim; + swings it out
vessels:
  substeps: 4
  nodes:
    - {id: ground, kind: source, p: 392.4}
    - {id: well, kind: tank, area: 72, z: -5.5, level: 4,
       draw: {section: [[-6, -5.5], [6, -5.5], [6, 0], [-6, 0]], y: [0.05, 6]}}
    - {id: lo, kind: chamber, fixed: -3.5, sections: [[-3.5, 7.2], [3.5, 12.4992]], volume: 233.898, water: 233.898, K: 2e+06,
       draw: {sections: [[[-1.75, -3.5], [1.25, -3.5], [1.25, 3.8], [-1.75, 3.8]], [[-6.5253, 16.2632], [-3.7368, 14.8687], [-2.7549, 16.1411], [-4.5437, 18.1807], [-4.9085, 17.9173], [-5.2614, 17.6312], [-5.601, 17.3224], [-5.9259, 16.9913], [-6.2345, 16.6381]], [[-7.8012, 13.5989], [-4.1658, 13.3198], [-3.7368, 14.8687], [-6.5253, 16.2632], [-6.7967, 15.8672], [-7.0469, 15.4507], [-7.2742, 15.0145], [-7.4768, 14.5597], [-7.6531, 14.0873]], [[-8.0786, 11.5179], [-8.0617, 10.9762], [-8.0077, 10.4307], [-3.9783, 11.7236], [-4.1658, 13.3198], [-7.8012, 13.5989], [-7.9194, 13.0959], [-8.0061, 12.58], [-8.0596, 12.0533]], [[-8.0077, 10.4307], [-7.9156, 9.8843], [-7.7847, 9.3398], [-7.6145, 8.8003], [-7.4048, 8.269], [-7.1556, 7.7492], [-6.8674, 7.2442], [-3.202, 10.3162], [-3.9783, 11.7236]], [[-6.8674, 7.2442], [-6.5408, 6.7573], [-6.1768, 6.292], [-5.7769, 5.8515], [-5.3427, 5.4391], [-4.8764, 5.0579], [-4.3803, 4.7107], [-1.952, 9.306], [-3.202, 10.3162]], [[-4.3803, 4.7107], [-3.8571, 4.4003], [-3.3097, 4.1291], [-2.7414, 3.8994], [-2.1556, 3.7129], [-1.556, 3.5713], [-0.9464, 3.4756], [-0.4131, 8.8425], [-1.952, 9.306]], [[-0.9464, 3.4756], [-0.3306, 3.4268], [0.2873, 3.4251], [0.9033, 3.4707], [1.5135, 3.5631], [2.1139, 3.7015], [2.7008, 3.8849], [1.1869, 8.9941], [-0.4131, 8.8425]]], y: [0, 2.4]}}   # the entrance pipe and the chamber behind the valve
    - {id: hi, kind: chamber, fixed: 10.9541, sections: [[10.9541, 14.7771]], volume: 129.239, water: 129.239, K: 2e+06,
       draw: {sections: [[[3.8168, 11.3006], [4.5951, 10.9541], [5.1441, 11.0968], [5.6674, 11.3097], [6.1576, 11.5885], [6.6081, 11.9281], [7.013, 12.3225], [7.3677, 12.7657], [4.1759, 12.8672]], [[3.917, 14.4535], [4.1759, 12.8672], [7.3677, 12.7657], [7.6681, 13.2511], [7.757, 13.7567], [7.5997, 14.2402], [7.4148, 14.7071], [7.2041, 15.156], [6.9693, 15.586]], [[3.0785, 15.8246], [3.917, 14.4535], [6.9693, 15.586], [6.7121, 15.9961], [6.4344, 16.3854], [6.1377, 16.7534], [5.8237, 17.0996], [5.494, 17.4236], [5.1499, 17.7251]], [[1.7845, 16.7778], [3.0785, 15.8246], [5.1499, 17.7251], [4.7931, 18.004], [4.4247, 18.2601], [4.0462, 18.4933], [3.6586, 18.7038], [3.2631, 18.8914], [2.8608, 19.0563]], [[0.2263, 17.1719], [1.7845, 16.7778], [2.8608, 19.0563], [2.4527, 19.1986], [2.0397, 19.3182], [1.6227, 19.4153], [1.2027, 19.4899], [0.7803, 19.5422], [0.3566, 19.5721]], [[-2.1722, 19.2824], [-1.3653, 16.9486], [0.2263, 17.1719], [0.3566, 19.5721], [-0.0679, 19.5797], [-0.4922, 19.565], [-0.9156, 19.5279], [-1.3373, 19.4685], [-1.7564, 19.3867]], [[-4.5437, 18.1807], [-2.7549, 16.1411], [-1.3653, 16.9486], [-2.1722, 19.2824], [-2.5837, 19.1555], [-2.9901, 19.0061], [-3.3903, 18.8339], [-3.7834, 18.639], [-4.1683, 18.4212]], [[6.2086, 15.6993], [11.7717, 17.947], [10.9476, 19.9868], [5.3845, 17.7391]]], y: [0, 2.4]}}   # the chamber between the drum and the cylinder, and the exit
    - {id: air, kind: source, p: 0}
  links:
    - {id: spring, from: ground, to: well, area: 30, cd: 0.62, z: -5.5}
    - {id: suck, from: well, to: lo, area: 7.2, cd: 0.8, z: -3.3, length: 7,
       draw: {from: [-0.25, 0.6, -3.2], to: [-5.1095, 0.6, 10.05], via: [[-0.25, 0.6, 3.5], [-1.1113, 0.6, 6.6972]], width: 2.6, flow: 0.1}}   # up the entrance and on into the chamber
    - {id: leak, from: hi, to: lo, area: 0.05, cd: 0.62, z: 4.5, zTo: 4.5}   # past the valves' and the abutment's fit
    - {id: deliver, from: hi, to: air, area: 2, cd: 0.9, z: 16.7192, zTo: 60, length: 60,
       draw: {from: [5.6678, 0.6, 14.4726], to: [11.3596, 0.6, 18.9669], via: [[5.7965, 0.6, 16.7192]], width: 1.8, flow: 0.1}}   # out by the exit and on, out of the picture
  displacers:
    - {id: drum, joint: j_d, from: lo, to: hi, volume: 373.295, z: 13}   # a turn of the drum carries this across its valve
driver: {joint: j_d, kind: velocity, rpm: 20, kv: 20, max_torque: 5}
checks:
  - {type: turning, joint: j_d, direction: 1, min_mean: 1.885, min_fraction: 0.95, settle_s: 1.0, window_s: 10.5}
  - {type: amplitude, joint: j_vl, min: 0.3, max: 1.6, settle_s: 1.0, window_s: 10.5}
  - {type: amplitude, joint: j_vr, min: 0.3, max: 1.6, settle_s: 1.0, window_s: 10.5}
  - {type: penetration, max: 0.003}
camera: {target: [1, 0, 3.4], position: [1, -200, 6.4], fov: 11.6}
display:
  output: j_d
  labels: {j_d: "Drum (driver)", j_vl: "Valve", j_vr: "Valve"}
