## Reversal Zits: Extruder Pressure vs. Flow vs. Acceleration

Pondering the Reversal Zittage Bestiary led me to wonder about the formal relationship between pressure and flow in a viscous fluid passing through a nozzle. I’ll cheerfully admit my never-very-puissant fluid dynamics fu has become way rusty and, this being the first time I’ve collected all this stuff in one place, there’s certainly something I’m overlooking (to put it charitably), but here goes…

Assuming that (semi-)molten plastic:

Counterargument:

The hot end contains about 20 mm of molten filament, which is 140 mm3 of 3 mm filament. During filament swaps, the filament pushes back about 2 mm = 14 mm3 without any external force, so there’s about 10% springiness in the hot end. That suggests the plastic really isn’t incompressible. Some of the springiness may come from the PTFE tube expanding against the surrounding metal tube, but the fact that the (solidified) molten zone has a larger diameter than the rest of the filament says the PTFE expansion is not very dynamic: the filament solidified at zero pressure.

Boldly assuming incompressiblity anyway, the always-right-and-never-lies Wikipedia tells us that the equations of state boil down to the Stokes Equations, herewith directly cribbed:

That’s using this symbology, typographically modified to eliminate the need for embedded graphics:

• The del operator represents the spatial gradient
• u = fluid velocity
• ∇·u = divergence of velocity (pointiness)
• 2 u = Laplacian of velocity (sharpness of pointiness)
• μ = dynamic viscosity
• f = applied force

Under the breathtakingly aggressive simplifying assumption that we can model slices across the extruder’s nozzle as nearly 2D radially symmetric pipes with a teeny frustum shape, we have a mostly one-dimensional situation:

• The first equation says that axial pressure gradient is directly proportional to the applied force, which makes sense, plus a huge term due to the nozzle shape (how abruptly the velocity gradient changes)
• The second equation is a generalization of GladOS‘s explanation of the conservation of momentum across Portal transfers: Speedy thing goes in, speedy thing comes out. For slightly conical slices, the axial speed increases as the radial area decreases, but the overall velocity gradient comes out zero.

All the force f comes from a stepper motor ramming filament into the hot end:

• To a good first order approximation, stepper motor torque is proportional to winding current.
• For a given filament diameter, drive wheel diameter, and speed, a constant-current stepper applies constant force to the filament.
• Stepper power being roughly constant for a given current, the available force varies inversely with rotational speed.

### Vigorous handwaving

The low Reynolds number says the inertial forces don’t amount to squat, so everything depends on viscous flow. There’s nothing to accelerate; try accelerating a spoon through honey.

Given a desired velocity u (mostly axial, for a particular extruding speed) and a nozzle, the first equation says the required force varies linearly with the pressure gradient ∇p. The gradient runs from atmospheric pressure on one end to the molten pool on the other, with the steepest change in the narrowest part of the nozzle. This suggests a short nozzle aperture is good.

Conversely, a long smooth nozzle reduces ∇2 u by reducing abrupt velocity changes. For a given ∇p, the required force varies directly with the second (spatial) derivative of the velocity; lower velocity doesn’t mean lower force, but smoother changes (and their derivatives) certainly do.

During reversal, the extruder must produce a negative ∇p very quickly to inhale the filament and prevent drooling. Assuming ∇p has the same order of magnitude in both directions (thus, different signs), changing the fluid velocity will produce huge changes in ∇2 u.

Fluid compressibility means that, during the early part of the reversal operation, moving the filament doesn’t change the pressure by very much at all: the first equation remains pretty much constant.

### Caveats

The Stokes equations are time-invariant: the velocity is a constant. So we’re looking at the steady state and making dangerous assumptions about changing conditions.

The force variation seems linear with pressure gradient around a given flow, which is comforting: at least it’s not quadratic or something even more horrible.

Given the low Reynolds number, even moderate flow variations should be roughly linear, as the velocity gradients won’t change much with changing velocity.

This explains why Reversal Zittage gets so much worse at higher speeds: the extruder operates under constant (and, at least in my TOM, low) power that can keep pace with normal extrusion, but doesn’t have an order of magnitude more force in reserve for retraction.

1. #1 by dnewman on 2012-02-01 - 15:38

To make matters slightly worse, molten ABS is viscoelastic which is to say it has memory making its rheology fun and exciting The effects here should be one of further opposing any reversal of flow direction. That is, the dynamics of reversing the flow direction are even more fun then you might have first envisioned and involve integrals with non-Riemmanian measures. (The integrals have an “atom” at time t=0 which gives special weight to the present and then as you look back in time — t increasing — the contribution of the past — the memory — becomes less and less significant.)

• #2 by Ed on 2012-02-01 - 20:28

integrals with non-Riemmanian measures

I can tell this is about to become one of those conversations where, in another few paragraphs, I’ll be able to identify most of the verbs and some of the nouns… [sigh]

Someone, somewhere, has certainly taken some careful data that would help describe what’s going on and eliminate some of the possibilities: wish I could find it!

2. #3 by Bruce on 2012-02-02 - 09:20

Nice rundown, but you should add that your assuming a newtonian fluid to the list of assumptions. It really is a very interesting problem.

I’m not sure you can boil it down to a 1D problem. Even if you assume the distribution of plastic in the pipe as homogeneous (which is a pretty good assumption), the material at the “core” does not experience the friction experienced by the material at the plastic/ptfe interface. You can however exploit axial symmetry to boil it down to a 2D problem.

I’m really glad you made this post, its put the problem into perspective for me.

• #4 by Ed on 2012-02-02 - 11:09

assuming a newtonian fluid

The more I think about this, the more I realize the validity of the adage Hell hath no fury like that of an unjustified assumption. There’s just a whole steaming pile sitting there in the middle of that handwaving, eh?

boil it down to a 2D problem.

Somebody who knows a lot more than I do about fluid modeling could surely conjure up an edifying simulation, but that seems like a lot of work even for grad-student slave laborers. It’d be interesting to know just how many input variables you’d wind up with and what their output sensitivity would be; that’d provide some guidance for relevant measurements.

Unfortunately, I suspect the instrumentation required for those measurements would quickly outstrip my cough funding… [grin]

• #5 by dnewman on 2012-02-02 - 12:35

Have no doubt, there’s a large body of research in this area: the rheology of ABS extrusion is important stuff. Just google “abs extrusion rheology”. (I myself used to do mathematical research on the rheology of the cold drawing of polymers. One of my thesis advisors was Walter Noll, the man to whom the OED credits the word viscoeleastic.)

• #6 by Ed on 2012-02-02 - 12:53

a large body of research

Given the amount of plastic stuff in the world today, I’d expect no less! [grin]

used to do mathematical research on the rheology of the cold drawing of polymers

So, hey, I’ve got just the right project to occupy your copious spare time: there’s this gaping chasm between all that research and what’s going on in, say, a DIY extruder. You capture the theory and wrestle it to the floor, I’ll kick it in the tummy and measure its eyeballs.

All we need is some grant money and we’re good to go! [grin]

3. #7 by Bruce on 2012-02-03 - 18:54

All kinds of methods exist to model this process, the physics is nothing new. I’m currently struggling to find a grant to do just that :)

Things that would need to be considered are the deformation of the extruder barrel, the reaction of the solid plastic, the phase change of the solid plastic, the heat flow, and the flow of molten polymer. To really nail it you could also consider the air outside the extruder. All these physics are shared with the injection molding process, so all it would really require is someone to take this http://usa.autodesk.com/moldflow/ and apply it to extrusion.

• #8 by Ed on 2012-02-03 - 19:52

take this … and apply it to extrusion.

Just guessing, but my toy budget won’t cover that one: you must fill out a form to get in the queue to get the pricing. [wince]

But, yeah, none of this is magic and all of it is an industrial process. What’s new & different is that the high end of the DIY-plastic-thread-squirter world is colliding with the bottom end of the industrial rapid fabrication market: the seat-of-the-pants design methodology doesn’t work nearly as well as it used to.

When you land that grant, let me watch over your shoulder…

4. #9 by Rob Giseburt on 2012-02-04 - 02:08

Funny to see that we are both running into the same problem, but from different angles.

After finally getting a working acceleration in the firmware, I immediately saw this problem. I believe that, for our purposes, it can be simplified quite a bit more than you described.

More to the point: a spring of solid plastic (as it bends to fill the difference between the filament width and the tube it’s in) pushing a small lump of molten, viscous plastic. The molten plastic is clearly elastic, to a certain extent, but much less so that the large spring above it.

My plan is to test what happens when you move the filament at a different acceleration rate than the rest of the bot. I’m thinking a quadratic brazier curve (with two control points) should give enough control to overcome most of these problems.

On acceleration, the control points would allow it to accelerate ahead of the rest of the movement, prepressurizing the system as it’s gaining momentum.

On deceleration, it would reverse the control points, depressurizing early. On both ends the movements are still in sync: they start and end together. This is following the assumption that if there is any pressure at all, there is extrusion. (Witness that gravity is enough, given time.)

The two control points would be different for each extruder type and each plastic type. ABS takes less pressure to compress the spring, but more pressure to extrude than PLA, for example.

This obviously can’t be done in the GCode, so it’s being done in the firmware at the step-by-step timing level.

Hopefully it either works, or I can learn enough to get it right from there.

• #10 by whosawhatsis? on 2012-02-04 - 07:31

Well said, Rob. Complex and intensive modeling is not necessary if we can just get a variable or two that modify the relative timings to give a “good enough” solution after a little empirical tuning. This method is especially preferable given the proliferation of different hot end designs (particularly the differences in filament diameter, and whether the plastic makes contact with brass, PTFE, stainless steel, aluminum, etc. inside the barrel), each of which would have to be modeled independently to get the perfect solution.

• #11 by Ed on 2012-02-04 - 10:29

if we can just get a variable or two

Aye, but starting with the correct variables eliminates a whole bunch of thrashing. Even better, starting with an order-of-magnitude notion of the effects tells you what’s important to measure, how good the control must be, and (best of all) what can be ignored.

I think DIY printers have gotten good enough that this theoretical stuff matters, even though I’ll cheerfully admit to breaking out in a cold sweat the last time I had to untangle an equation involving del-dot-whatever under pressure… [grin]

• #12 by Ed on 2012-02-04 - 09:50

it can be simplified quite a bit more than you described.

I’d be astonished if the final controls needed more than quadratic approximations to maybe three variables, but I thought it’d be interesting to look at the basics to figure out which variables might be relevant. Even though there aren’t many inputs and outputs, it’d be nice to get at least a general idea of what to measure in order to generate those curves!

when you move the filament at a different acceleration rate

At the risk of beating the subject to death, LinuxCNC (nee EMC2, after getting a threatening letter from the corporate EMC’s lawyers) has had separate acceleration controls for all axes forever: it’s what real machine tools do. So this doesn’t require much coding at all.

The LinuxCNC 2.6 branch has a clean-and-easy way to replace G and M codes, plus the usual HAL functions, so it’s now much easier to tinker up custom controls to suit the machine. I’m running out of reasons to avoid building a big, fast printer with industrial-grade motion control.

or I can learn enough to get it right from there.

As I learned long ago, one careful measurement trumps a thousand expert opinions… go for it!