# No. 464 (Brown 1868): Hero’s fountain. Water being poured into upper vessel descends tube on right into lower; intermediate vessel being also filled and more water poured into upper, confined air in cavities over water in lower and intermediate vessels and in communication tube on left, being compressed, drives by its elastic force a jet up central tube.
# Model (cm, gravity on, Brown's front view). The water is lumped vessels (src/fluid/vessels.c): the basin, open; the lower
# vessel and the bowl, closed chambers of water under air, their air joined by the left tube; the right tube from the basin's floor down
# into the lower vessel; the jet pipe from near the bowl's bottom up to the nozzle over the basin, a pipe whose water has inertia. The water
# in the basin runs down the right tube into the lower vessel and squeezes its air, which presses through the left tube on the bowl's
# water and drives it up the jet pipe; the jet falls back into the basin. A jug, tipped on its lip by the hand (the only input, 1.2 rad
# and back over the run), pours into the basin as Brown's text has it. Nothing is painted: every surface and stream is from the vessels' state.
# Generator: opencode-runs/water/gen464.py.
number: 464
slug: heros-fountain
name: "Hero's fountain"
brown: "Hero’s fountain. Water being poured into upper vessel descends tube on right into lower; intermediate vessel being also filled and more water poured into upper, confined air in cavities over water in lower and intermediate vessels and in communication tube on left, being compressed, drives by its elastic force a jet up central tube."
units: cm
sim:
  timestep: 0.0005
  integrator: implicitfast
  iterations: 30
  duration_s: 14
  floor: false
bodies:
  - id: jug
    shape: part
    pos: [18, 0, 50.5]
    mass: 0.4
    color: "#a8875a"
    pieces:
      - {kind: loft, a: [[18, 2.6, 44.1], [26, 2.6, 44.1], [26, 2.6, 43.5], [18, 2.6, 43.5]], b: [[18, -2.6, 44.1], [26, -2.6, 44.1], [26, -2.6, 43.5], [18, -2.6, 43.5]], collide: 0, color: "#a8875a"}
      - {kind: loft, a: [[25.4, 2.6, 51], [26, 2.6, 51], [26, 2.6, 43.5], [25.4, 2.6, 43.5]], b: [[25.4, -2.6, 51], [26, -2.6, 51], [26, -2.6, 43.5], [25.4, -2.6, 43.5]], collide: 0, color: "#a8875a"}
      - {kind: loft, a: [[18, 2.6, 50], [18.6, 2.6, 50], [18.6, 2.6, 43.5], [18, 2.6, 43.5]], b: [[18, -2.6, 50], [18.6, -2.6, 50], [18.6, -2.6, 43.5], [18, -2.6, 43.5]], collide: 0, color: "#a8875a"}
      - {kind: loft, a: [[18, 2.6, 51], [26, 2.6, 51], [26, 2.6, 43.5], [18, 2.6, 43.5]], b: [[18, 2, 51], [26, 2, 51], [26, 2, 43.5], [18, 2, 43.5]], collide: 0, color: "#a8875a"}
      - {kind: loft, a: [[17.1, 1.2, 50.4], [18.6, 1.2, 50], [18.6, 1.2, 50.6]], b: [[17.1, -1.2, 50.4], [18.6, -1.2, 50], [18.6, -1.2, 50.6]], collide: 0, color: "#a8875a"}
      - {kind: rod, from: [26, 0, 49.5], to: [28.5, 0, 48], radius: 0.5, collide: 0, color: "#a8875a"}
      - {kind: rod, from: [28.5, 0, 48], to: [26.3, 0, 45], radius: 0.5, collide: 0, color: "#a8875a"}
      - {kind: rod, from: [18, -2.8, 50.5], to: [18, 2.8, 50.5], radius: 0.25, collide: 0, color: "#5e584e"}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#d6cdb8"
    pieces:
      - {kind: loft, a: [[-14, 3.6, 0.8], [14, 3.6, 0.8], [14, 3.6, 0], [-14, 3.6, 0]], b: [[-14, -3.6, 0.8], [14, -3.6, 0.8], [14, -3.6, 0], [-14, -3.6, 0]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-14, 3.6, 8], [14, 3.6, 8], [14, 3.6, 7.2], [-14, 3.6, 7.2]], b: [[-14, -3.6, 8], [14, -3.6, 8], [14, -3.6, 7.2], [-14, -3.6, 7.2]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-14, 3.6, 8], [-13.2, 3.6, 8], [-13.2, 3.6, 0], [-14, 3.6, 0]], b: [[-14, -3.6, 8], [-13.2, -3.6, 8], [-13.2, -3.6, 0], [-14, -3.6, 0]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[13.2, 3.6, 8], [14, 3.6, 8], [14, 3.6, 0], [13.2, 3.6, 0]], b: [[13.2, -3.6, 8], [14, -3.6, 8], [14, -3.6, 0], [13.2, -3.6, 0]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-15.2, 3.6, 0], [15.2, 3.6, 0], [15.2, 3.6, -1.2], [-15.2, 3.6, -1.2]], b: [[-15.2, -3.6, 0], [15.2, -3.6, 0], [15.2, -3.6, -1.2], [-15.2, -3.6, -1.2]], collide: 0, color: "#7a6f60"}
      - {kind: loft, a: [[-17, 3.6, 40], [17, 3.6, 40], [17, 3.6, 39.2], [-17, 3.6, 39.2]], b: [[-17, -3.6, 40], [17, -3.6, 40], [17, -3.6, 39.2], [-17, -3.6, 39.2]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-17, 3.6, 44], [-16.2, 3.6, 44], [-16.2, 3.6, 40], [-17, 3.6, 40]], b: [[-17, -3.6, 44], [-16.2, -3.6, 44], [-16.2, -3.6, 40], [-17, -3.6, 40]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[16.2, 3.6, 44], [17, 3.6, 44], [17, 3.6, 40], [16.2, 3.6, 40]], b: [[16.2, -3.6, 44], [17, -3.6, 44], [17, -3.6, 40], [16.2, -3.6, 40]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-9, 3.6, 33], [-9.8, 3.6, 33], [-9.4661, 3.6, 30.4636], [-8.6933, 3.6, 30.6706]], b: [[-9, -3.6, 33], [-9.8, -3.6, 33], [-9.4661, -3.6, 30.4636], [-8.6933, -3.6, 30.6706]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-8.6933, 3.6, 30.6706], [-9.4661, 3.6, 30.4636], [-8.487, 3.6, 28.1], [-7.7942, 3.6, 28.5]], b: [[-8.6933, -3.6, 30.6706], [-9.4661, -3.6, 30.4636], [-8.487, -3.6, 28.1], [-7.7942, -3.6, 28.5]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-7.7942, 3.6, 28.5], [-8.487, 3.6, 28.1], [-6.9296, 3.6, 26.0704], [-6.364, 3.6, 26.636]], b: [[-7.7942, -3.6, 28.5], [-8.487, -3.6, 28.1], [-6.9296, -3.6, 26.0704], [-6.364, -3.6, 26.636]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-6.364, 3.6, 26.636], [-6.9296, 3.6, 26.0704], [-4.9, 3.6, 24.513], [-4.5, 3.6, 25.2058]], b: [[-6.364, -3.6, 26.636], [-6.9296, -3.6, 26.0704], [-4.9, -3.6, 24.513], [-4.5, -3.6, 25.2058]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-4.5, 3.6, 25.2058], [-4.9, 3.6, 24.513], [-2.5364, 3.6, 23.5339], [-2.3294, 3.6, 24.3067]], b: [[-4.5, -3.6, 25.2058], [-4.9, -3.6, 24.513], [-2.5364, -3.6, 23.5339], [-2.3294, -3.6, 24.3067]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-2.3294, 3.6, 24.3067], [-2.5364, 3.6, 23.5339], [-0, 3.6, 23.2], [-0, 3.6, 24]], b: [[-2.3294, -3.6, 24.3067], [-2.5364, -3.6, 23.5339], [-0, -3.6, 23.2], [-0, -3.6, 24]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-0, 3.6, 24], [-0, 3.6, 23.2], [2.5364, 3.6, 23.5339], [2.3294, 3.6, 24.3067]], b: [[-0, -3.6, 24], [-0, -3.6, 23.2], [2.5364, -3.6, 23.5339], [2.3294, -3.6, 24.3067]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[2.3294, 3.6, 24.3067], [2.5364, 3.6, 23.5339], [4.9, 3.6, 24.513], [4.5, 3.6, 25.2058]], b: [[2.3294, -3.6, 24.3067], [2.5364, -3.6, 23.5339], [4.9, -3.6, 24.513], [4.5, -3.6, 25.2058]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[4.5, 3.6, 25.2058], [4.9, 3.6, 24.513], [6.9296, 3.6, 26.0704], [6.364, 3.6, 26.636]], b: [[4.5, -3.6, 25.2058], [4.9, -3.6, 24.513], [6.9296, -3.6, 26.0704], [6.364, -3.6, 26.636]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[6.364, 3.6, 26.636], [6.9296, 3.6, 26.0704], [8.487, 3.6, 28.1], [7.7942, 3.6, 28.5]], b: [[6.364, -3.6, 26.636], [6.9296, -3.6, 26.0704], [8.487, -3.6, 28.1], [7.7942, -3.6, 28.5]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[7.7942, 3.6, 28.5], [8.487, 3.6, 28.1], [9.4661, 3.6, 30.4636], [8.6933, 3.6, 30.6706]], b: [[7.7942, -3.6, 28.5], [8.487, -3.6, 28.1], [9.4661, -3.6, 30.4636], [8.6933, -3.6, 30.6706]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[8.6933, 3.6, 30.6706], [9.4661, 3.6, 30.4636], [9.8, 3.6, 33], [9, 3.6, 33]], b: [[8.6933, -3.6, 30.6706], [9.4661, -3.6, 30.4636], [9.8, -3.6, 33], [9, -3.6, 33]], collide: 0, color: "#b9ae98"}
      - {kind: loft, a: [[-9.8, 3.6, 33.8], [9.8, 3.6, 33.8], [9.8, 3.6, 33], [-9.8, 3.6, 33]], b: [[-9.8, -3.6, 33.8], [9.8, -3.6, 33.8], [9.8, -3.6, 33], [-9.8, -3.6, 33]], collide: 0, color: "#b9ae98"}
      - {kind: rod, from: [11.8, 0, 8], to: [11.8, 0, 39.2], radius: 0.9, collide: 0, color: "#9a8f7c"}
      - {kind: rod, from: [-11.8, 0, 8], to: [-11.8, 0, 36], radius: 0.9, collide: 0, color: "#9a8f7c"}
      - {kind: rod, from: [-11.8, 0, 36], to: [-3, 0, 36], radius: 0.9, collide: 0, color: "#9a8f7c"}
      - {kind: rod, from: [-3, 0, 36], to: [-3, 0, 33.8], radius: 0.9, collide: 0, color: "#9a8f7c"}
      - {kind: loft, a: [[-0.7, 0.7, 47], [0.7, 0.7, 47], [0.7, 0.7, 25], [-0.7, 0.7, 25]], b: [[-0.7, -0.7, 47], [0.7, -0.7, 47], [0.7, -0.7, 25], [-0.7, -0.7, 25]], collide: 0, color: "#9a8f7c"}
      - {kind: loft, a: [[-0.7, 0.7, 47], [0.7, 0.7, 47], [0.25, 0.7, 48.2], [-0.25, 0.7, 48.2]], b: [[-0.7, -0.7, 47], [0.7, -0.7, 47], [0.25, -0.7, 48.2], [-0.25, -0.7, 48.2]], collide: 0, color: "#9a8f7c"}
      - {kind: loft, a: [[-17, 1, 39.2], [-15.6, 1, 39.2], [-15.6, 1, 8], [-17, 1, 8]], b: [[-17, -1, 39.2], [-15.6, -1, 39.2], [-15.6, -1, 8], [-17, -1, 8]], collide: 0, color: "#7a6f60"}
      - {kind: loft, a: [[15.6, 1, 39.2], [17, 1, 39.2], [17, 1, 8], [15.6, 1, 8]], b: [[15.6, -1, 39.2], [17, -1, 39.2], [17, -1, 8], [15.6, -1, 8]], collide: 0, color: "#7a6f60"}
joints:
  - {id: j_j, type: hinge, body: jug, axis: [0, -1, 0], damping: 0.002}   # + tips the jug's lip down (counter-clockwise as seen)
vessels:
  substeps: 8
  nodes:
    - {id: pitcher, kind: tank, area: 31.28, z: 44.1, level: 5, body: jug, pos: [22, 0, 45.5],
       draw: {section: [[18.6, 44.1], [25.4, 44.1], [25.4, 51], [18.6, 51]], y: [-2.3, 2.0]}}
    - {id: basin, kind: tank, area: 194.4, z: 40, level: 1.5, max: 3.7, draw: {section: [[-16.2, 40], [16.2, 40], [16.2, 44], [-16.2, 44]], y: [-3.0, 3.0]}}
    - {id: lower, kind: chamber, fixed: 0.8, sections: [[0.8, 158.4]], volume: 1013.76, water: 150,
       draw: {sections: [[[-13.2, 0.8], [13.2, 0.8], [13.2, 7.2], [-13.2, 7.2]]], y: [-3.0, 3.0]}}
    - {id: bowl, kind: chamber, fixed: 24.05, sections: [[24.05, 44.4027], [25.5417, 71.9423], [27.0333, 87.9715], [28.525, 98.2926], [30.0167, 104.6092], [31.5083, 107.6285]], volume: 767.979, water: 614.384,
       draw: {sections: [[[-8.98, 33], [-8.674, 30.6758], [-7.7769, 28.51], [-6.3498, 26.6502], [-4.49, 25.2231], [-2.3242, 24.326], [-0, 24.02], [2.3242, 24.326], [4.49, 25.2231], [6.3498, 26.6502], [7.7769, 28.51], [8.674, 30.6758], [8.98, 33]]], y: [-3.0, 3.0]}}
    - {id: air, kind: source, p: 0}
  links:
    - {id: pour, from: pitcher, to: basin, area: 1.2, cd: 0.62, z: 44.1, zTo: 99, open: {joint: j_j, q: [0.55, 0.95], frac: [0, 1]},
       draw: {from: [17.2, 0, 50.5], fromBody: jug, to: [16.6, 0, 50.1], width: 1.0, flow: 0.03, fall: {dir: [-0.4, 0, -1], floor: 41.2}}}
    - {id: down, from: basin, to: lower, area: 0.5, cd: 0.62, z: 1, zTo: 1,
       draw: {from: [11.8, 0, 39.2], to: [11.8, 0, 1.3], width: 0.8, flow: 0.01}}   # the right tube
    - {id: breath, from: lower, to: bowl, area: 0.5, cd: 0.62, z: 7.1, zTo: 32.9}   # the left tube: air
    - {id: jetL, from: bowl, to: basin, area: 0.03, cd: 0.9, z: 24.35, zTo: 48.2, length: 24.15,
       draw: {from: [-0.1, 0, 48], to: [-0.2, 0, 48.4], width: 0.5, flow: 0.004, fall: {dir: [-0.1, 0, 1], floor: 41.5}}}
    - {id: jetR, from: bowl, to: basin, area: 0.03, cd: 0.9, z: 24.35, zTo: 48.2, length: 24.15,
       draw: {from: [0.1, 0, 48], to: [0.2, 0, 48.4], width: 0.5, flow: 0.004, fall: {dir: [0.1, 0, 1], floor: 41.5}}}
driver: {joint: j_j, kind: velocity, rpm: 0, swing: {amplitude: 1.2, hz: 0.0357}, kv: 100, max_torque: 40}
checks:
  - {type: position, joint: j_j, min: 1.08, max: 1.26, settle_s: 6.5, window_s: 1}
camera: {target: [4, 0, 30], position: [4, -200, 33], fov: 30}
display:
  output: j_j
  labels: {j_j: "Jug (hand)"}
