I've been trying to figure this out for about a month now, and this is the best solution I've come up with. The drawbridge on the lower part of the picture, when lowered, caps the HFS. (the entrance to which is right below where the picture cuts off.) When raised, it blocks off the rest of the fortress. All twenty floodgates surrounding the middle corridor are linked to the same lever in the main part of the fortress, and the floodgates on either side of the obsidian machine open into drainage pits. The lever right next to the door at the back of the adapted barracks raises both floodgates to drain the machine (presumable after encasing demons in obsidian) and the two back-to-back levers just above the mini-bridges block off the middle corridor. The magma comes from the sea on the left, and the water on the right is piped from a brook many z-levels up.
The only problem with it is that the corridor isn't long enough to hold all of the clowns; When I redesigned the middle corridor to be twice as long, the water and magma didn't mix consistently in the middle and stopped up the fortifications on either side (leaving the demons in the middle trapped but un-harmed).
The first time I used it, it probably got about 80% of what came up the tube. I built a stairway all the way down to the clown college, but my poor cheese maker got attacked by clowns after that. I started building walls around the stairway, but it was incredibly slow going - build one or two walls, retreat, kill the one or two clowns, and spend half a year draining the magma/water and cleaning out the obsidian.
Any suggestions to improve on this design?