Several codes used in Suckale, et al., Bistability of buoyancy-driven exchange flows in vertical tubes, JFM, 2018.