Pressure as an unknown, and multigrid
The question. Factorisation solves a body’s equations whatever its numbers, but its cost climbs steeply as the bricks get smaller. Iteration costs little per step, but tissue that will not squeeze makes it crawl. Is there an iterative solver whose work does not grow with the number of bricks or with how hard the tissue is to squeeze, and what does the simulator have of one?
Solving many equations at once ended with a choice: on the desktop every Newton step is factorised, and in the browser it is solved by conjugate gradients. Factorisation wins at the sizes this book uses. But a finer model of the arm needs smaller bricks, and there the factorisation runs out of time and memory. This chapter builds the method that is meant to take over, shows exactly where tissue defeats it, and shows the change of unknowns that cures part of the trouble.
By the end you will be able to say what a smoother and a coarse level do, explain why a nearly incompressible body slows a multigrid down, write the equations of a body with its pressure kept as an unknown, and read the simulator’s measurements of where the multigrid pays and where it does not.
Why the factorisation runs out
Halve the size of the bricks and a body has eight times as many corners. Assembling its equations, which visits each brick once, costs about eight times as much. Factorising them does not. On a block of muscle 40 × 40 × 200 mm, with the arm’s muscle material, the simulator’s factorisation took 65 to 100 times as long for each halving of the brick, its work growing as the number of unknowns to the power 2.2 to 2.3. The cause is fill-in: in a body that extends in all three directions, every corner has many neighbours that are eliminated after it, and elimination ties them all together.
For the whole 2 kg curl of the arm, which takes about 16 minutes with bricks of 8 mm, the same growth projects about 5 hours with bricks of 4 mm, 21 hours with 3 mm and about two weeks with 2 mm. At 2 mm the factor of that block alone fills 2.0 GB.
An iterative method touches the matrix only to multiply it by a list of numbers, and each such product costs work in proportion to the number of unknowns. If the number of iterations stayed the same as the bricks shrank, the whole solve would cost in proportion to the unknowns too. Conjugate gradients with the corner-by-corner preconditioner do not manage that: their iterations grow as the bricks shrink, and they grow again as the tissue gets harder to squeeze (Solving many equations at once).
Rough errors and smooth errors
Take any guess at the solution. Its error is the guess less the true solution. The iterative methods of the last chapter never see the error, only the residual, but what happens to the error is what decides how fast they finish.
A smoother is a cheap iteration that, at each corner, corrects the guess using only that corner’s equation and its neighbours’ present values. The corner-by-corner preconditioner is one; Gauss–Seidel and Jacobi iterations are the textbook ones. A smoother removes the part of the error that changes sign from one corner to the next very quickly. The part that varies slowly across many corners it hardly touches, and once only that part is left, progress stalls (Zhu et al. 2010, section 2.2).
The numbers show why. Take a chain of seven unknowns with the equation of a stretched string at each: twice the unknown less its two neighbours, with zeros beyond the ends. One sweep of the damped Jacobi smoother sets each value to a third of itself plus a third of each neighbour:
In words: every corner takes the average of itself and its two neighbours.
- A rough error, . At the second corner the new value is , and every inner corner likewise falls from size 1 to size . The end corners go to . One sweep removes two thirds of it.
- A smooth error, the tent . The second corner becomes , unchanged, and so do all but the middle one, which becomes . One sweep removes a sixth of the peak and nothing else.
Now look at the tent on a chain with half as many corners, keeping only the even ones: . One sweep there gives at the ends and in the middle. The peak falls by more than a quarter. The same shape, seen with fewer corners across it, is rougher, and the smoother takes more of it.
That is the idea of multigrid: an error that persists on one grid looks rougher on a coarser one, so by going to ever coarser grids the smoother keeps making progress (Zhu et al. 2010, section 2.2). It has four parts:
- the equations at several levels, from the body’s own bricks to a few large ones;
- a smoother at each level;
- restriction, which carries a residual from a level to the next coarser one, and prolongation, which carries a correction back to the finer one;
- a direct solve at the coarsest level, which is small.
One V-cycle smooths on the finest level, restricts what is left of the residual to the next level, smooths there, and so on down to the coarsest level, where the equations are solved outright. On the way back up it prolongs each correction to the finer level, adds it, and smooths again. The cycle’s rate of convergence is the fraction of the residual a cycle leaves; a cycle with a rate of 0.4 leaves 0.4 of it, the next 0.16, and so on.
Coarse levels without a coarse grid
The simulator’s bodies are embedded in a regular lattice of bricks (A muscle from its surface), so it would be natural to make each coarse brick out of 2 × 2 × 2 fine ones. The simulator does not. Its multigrid finds its coarse levels from the matrix alone, which makes it an algebraic multigrid; one built from coarser bricks would be a geometric multigrid. Its way of doing so is smoothed aggregation (Vaněk, Mandel and Brezina 1996):
- Aggregates. Corners joined by entries of the matrix are gathered into small groups. On a regular lattice the groups come out close to boxes of 3 × 3 × 3 corners. Each group becomes one corner of the next level.
- What a coarse corner can do. A group cannot move only as one point. A body that moves without bending, a rigid motion, stores no energy and so leaves no residual for a smoother to see. Each coarse corner is therefore given the six rigid motions of its group (three shifts and three turns), so that the coarse level can represent every rigid motion exactly.
- Smoothing the prolongation. The plain prolongation copies a group’s motion onto all its corners, and the jumps at the group’s edges are rough. One smoothing step of the prolongation itself evens them out.
- The coarse equations. The matrix of the coarse level is the fine matrix seen through the prolongation: restriction, then the fine matrix, then prolongation. Whatever the fine matrix holds, including the cut bricks at a body’s surface and the ties between touching bodies, is carried down without any special case.
The smoother on each level is a polynomial of degree 3 in the corner-by-corner preconditioned matrix, a Chebyshev smoother (Adams et al. 2003). It needs only products with the matrix, so like the rest of the cycle it runs the same on any number of threads. One V-cycle is then used as the preconditioner of conjugate gradients.
On a block of tissue that squeezes as easily as it shears, this works as multigrid should. One cycle on its own leaves about 0.4 of the residual whatever the size of the bricks, and conjugate gradients with it need about a dozen iterations where the corner-by-corner preconditioner needs 36 to 83, as the laboratory below shows.
Why tissue defeats it
Tissue that keeps its volume is a different matter. On a block of tissue without fibres, held at one end, the cycle’s rate climbs as Poisson’s ratio , defined in Tissue keeps its volume, approaches ½:
| Poisson’s ratio | 0.3 | 0.4 | 0.45 | 0.49 | 0.499 | 0.4999 | 0.49997 (the arm’s muscle) |
|---|---|---|---|---|---|---|---|
| Rate of one cycle, bricks of 8 mm | 0.43 | 0.43 | 0.55 | 0.84 | 0.96 | 0.993 | 0.996 |
| Rate of one cycle, bricks of 4 mm | 0.45 | 0.48 | 0.58 | 0.83 | 0.97 | 0.995 | 0.997 |
The rate does not depend on the bricks: 8 mm and 4 mm agree in every column. It depends on , badly. At the arm’s a cycle on its own would need about 3000 cycles to cut the residual by . Zhu and colleagues report the same for a multigrid of their own: a rate of 0.9 at (Zhu et al. 2010, section 9.1).
The reason is in the shape of the bowl. The stiffness of a nearly incompressible body is a small part that resists change of shape plus a part about times larger that resists change of volume. That large part does not resist every motion. Any motion that keeps every volume, a sideways shear or a swirl, costs it nothing (Zhu et al. 2010, section 4.1). So among the smooth errors there are two kinds: those that squeeze, which the large part makes stiff, and those that keep volume, which only the small part resists. A smoother and a coarse level built on the whole matrix mix the two, and at each level the error that is left is mostly of the kind they cannot separate. Zhu and colleagues add that such volume-keeping errors can even be rough on the grid, so that neither the smoother nor the coarse level can remove them.
Conjugate gradients rescue much of this, because their polynomial removes the few slow modes that dominate a stalled cycle. With the cycle as preconditioner they needed 14 iterations at and 407 at the arm’s , on bricks of 8 mm; at the arm’s the count grew to 549 at 4 mm and 624 at 3 mm. That is far better than the 3000 cycles alone, and still a count that grows.
Keeping the pressure as an unknown
The cure is to stop hiding the pressure inside the stiffness.
Each brick of the simulator already has one pressure. Its volume energy is charged on the brick’s mean volume ratio , a single number per brick, and the brick’s pressure follows from it. When the simulator assembles a brick’s stiffness, that pressure is eliminated, and the brick’s stiffness splits exactly into two parts:
Here is the part that resists change of shape, in newtons per metre. The list , in reciprocal metres, says how much the brick’s mean volume ratio changes for each metre each of its corners moves. The number , in joules, is the brick’s volume times the curvature of its volume energy, about the bulk modulus times the volume. In words: the stiffness is the shape part plus the volume part, and the volume part is one big number times the way the brick’s volume changes, multiplied by itself.
Add all the bricks. With the sum of the shape parts, the table whose rows are the bricks’ , and the list of the down a diagonal, the condensed equations of Solving many equations at once are
with the moves of the corners and the unbalanced forces. Now give each brick a second unknown,
which is its pressure times its volume, in joules. Put it in, and the one set of equations becomes two:
In words: the forces on the corners are those of the shape plus those of the bricks’ pressures, and each brick’s pressure is set by how much its volume changed, divided by its stiffness against squeezing. Eliminating from the second equation and putting it into the first gives back the condensed equations exactly. So keeping the pressure changes how the equations are solved, not the brick or its answer.
Look at where the bulk modulus has gone. In the condensed form it multiplies a whole term of the matrix and dwarfs the rest. In the new form it appears only as , a small number, and every other entry is of the size of the shear stiffness. The block alone does not resist a change of volume at all, so a small part of the volume stiffness, times the shear modulus over the bulk modulus of it with , is left in it; then is the matrix of an ordinary, easily squeezed material, of the kind multigrid handles well.
The price is that the new equations have no bowl. Their matrix is symmetric but not positive definite: along a move of the pressures alone, with , the energy falls instead of rising, by . A system of this kind is called a saddle-point system: its energy rises in some directions and falls in others, like a saddle. Conjugate gradients rely on the bowl and cannot be used. MINRES, a method for symmetric equations that are not positive definite (Paige and Saunders 1975), can. It is preconditioned by a block preconditioner: one V-cycle of the multigrid on the displacement block, and for each brick a simple estimate of how strongly its pressure is resisted. Block preconditioners have been designed for exactly this kind of saddle point, in which the bulk modulus enters as a penalty term (Klawonn 1998).
A worked example
One coordinate of one brick, in metres, with a shape stiffness N/m, per metre, a volume stiffness J, and a force N.
Condensed. , so m. The one entry of the matrix, 10 002, is almost all bulk.
With the pressure. The two equations are
The second gives . Put into the first: , and m, the same. Then J: almost all of the force is carried by the pressure, and 0.0002 N by the shape.
The saddle. The matrix of the two equations has the rows and . Every entry is of the size of the shape stiffness. Along a move its curvature is . For that is , positive. For it is , negative. The energy rises one way and falls the other.
What a rate means. To cut a residual by a cycle of rate needs cycles: 20 cycles at , and about 46 000 at . Those are the rates the laboratory below finds at the two ends of its range.
Try it: three solvers race a block that will not squeeze
A block 24 mm square and 96 mm long, held fast at its bottom and pushed sideways at its top with 5 mN. Each press of Step multiplies its bulk modulus by about 3.2 and solves the same linear equations three ways, each until a hundred-millionth of its starting residual is left: conjugate gradients with the corner-by-corner preconditioner, conjugate gradients with one V-cycle as the preconditioner, and MINRES with the pressure kept as an unknown. The multigrid here makes its coarsest level smaller than the desktop simulator’s, so that even the smallest block has a level below its own.
- Start. With the bulk modulus equal to the shear modulus, the 576 unknowns take 49 iterations by the corner-by-corner preconditioner, 11 with the multigrid and 25 by MINRES. One cycle on its own leaves 0.39 of the residual. The free end moves 4.639 mm, and the three answers agree to well within a micrometre.
- Predict, then check. Which count will grow as the bulk modulus rises? Press Play to the end, where the bulk modulus is about 31 600 times the shear modulus. The corner-by-corner count rises to 453 and the multigrid’s to 198. MINRES rises from 25 to 31 and then stays there. The rate of one cycle climbs to 0.9996: on its own the cycle has stalled.
- Read the free end. It now moves 3.305 mm. All three solvers find this, although their iteration counts differ more than tenfold: they solve the same equations.
- Predict, then check. Choose 5 × 5 × 20 bricks and run again. At the start the multigrid needs 12 iterations and its rate is 0.40, as on the coarser block; the corner-by-corner count has grown to 83. At the end the counts are 1298, 473 and 69. MINRES still does not grow with the bulk modulus, but it does grow with the bricks: 23 on the coarsest block, 31, 56 and 69.
- Read the plots. On the first, the two conjugate-gradient lines rise steadily with the bulk modulus and the MINRES line goes flat. On the second, the cycle’s rate approaches 1.
Check against published results
Zhu and colleagues measured the rate of a geometric multigrid on the displacements alone at 0.9 for (Zhu et al. 2010, section 9.1). The simulator’s algebraic multigrid gave 0.84 on bricks of 8 mm and 0.83 on 4 mm at the same , and the laboratory’s block gives 0.90 at a bulk modulus 100 times the shear modulus, . The slowdown is the same in kind and in size.
With their pressure kept as an unknown, Zhu and colleagues report a rate of 0.26 to 0.28 per cycle even for nearly incompressible material, independent of the resolution (Zhu et al. 2010, section 9.1). Their method differs from the simulator’s in ways that matter here. Their unknowns sit on the faces of the cells instead of at the corners, and they smooth the displacement and the pressure together, by what they call distributive smoothing (Zhu et al. 2010, sections 3 and 4). The simulator’s mixed solve gives a different result:
- Robust in . On the block without fibres, at bricks of 8 mm, MINRES needed 105 iterations at and 107 at the arm’s 0.49997, against 105 and 407 for conjugate gradients with the multigrid.
- Not robust in the bricks. At the arm’s it needed 107 iterations at 8 mm, 191 at 4 mm and 300 at 3 mm. With , 67 at 8 mm and 132 at 4 mm. Two causes are possible, and the measurements do not separate them. One is the pairing itself: one constant pressure per brick against moves at its eight corners, a pairing for which nothing here guarantees that the pressures stay well behaved as the bricks shrink. The other is the preconditioner, whose estimate of how strongly each pressure is resisted is itself rough.
- No help with active fibres. On a block of muscle with its fibres fully active, where the fibres’ stiffness along the block is about a hundred times the shear stiffness, MINRES needed 72 to 139 iterations against 48 to 62 for conjugate gradients, for answers equally close to the factorisation’s. There the fibres, not the volume, make the bowl narrow.
Others have met the same growth. On fibre-reinforced, nearly incompressible heart tissue solved with a block preconditioner and algebraic multigrid, the iterations still grew, from about 100 on the coarsest to about 1000 on the finest of seven grids, summed over the load steps of a loaded artery (Karabelas et al. 2022, section 3.1).
How tightly to solve each step
A Newton step does not need its linear equations solved exactly. Early in a search the step is only a guess at where the balance lies, and solving it to a hundred-millionth wastes work. Inexact Newton solves each step only until its residual is a fraction of the unbalanced force, a fraction called the forcing term (Dembo, Eisenstat and Steihaug 1982), and choosing it well matters for both speed and robustness (Eisenstat and Walker 1996). The simulator’s multigrid path starts at , lowers it as the square of the unbalanced force falls, never raises it above 0.1, and never asks for a residual below a tenth of the force the search accepts as balanced (10 mN on the arm), since a finer solve could not be seen by the test that ends the search.
There is one more thing the factorisation gave for free. When it fails, the simulator knows the matrix is not positive definite and changes its step (Finding the shape that balances). The multigrid gives two signs instead: a setup that meets a corner block it cannot factorise, and conjugate gradients meeting a direction along which the energy does not rise, where they stop. They are not the same test. On the arm’s first balance with bricks of 8 mm, the two agreed on 140 of 142 matrices; the multigrid missed two and raised no false alarm.
Where it pays
The multigrid’s work per solve grows about in proportion to the unknowns, and the factorisation’s much faster. On the 40 × 40 × 200 mm block of muscle, with its fibres active:
| Bricks | Unknowns | Factorisation: multiply–adds | Multigrid to 10⁻⁶: multiply–adds | Factorisation, s | Multigrid setup + solve to 10⁻⁶, s |
|---|---|---|---|---|---|
| 8 mm | 2,592 | 7.2 × 10⁷ | 3.4 × 10⁸ | 0.013 | 0.05 + 0.45 |
| 4 mm | 17,787 | 5.5 × 10⁹ | 3.0 × 10⁹ | 0.50 | 0.48 + 3.8 |
| 3 mm | 38,808 | 3.8 × 10¹⁰ | 7 × 10⁹ | 2.4 | 1.1 + 8.0 |
| 2 mm | 130,977 | 6.7 × 10¹¹ | 2.6 × 10¹⁰ | 54 | 4.3 + 33 |
Conjugate gradients needed 123 to 147 iterations at every size. In arithmetic the multigrid is cheaper from 4 mm down, 26 times cheaper at 2 mm, and its whole hierarchy took 0.23 GB where the factor took 2.0 GB. In time it wins only between 3 and 2 mm. The factorisation does its arithmetic in dense blocks, at 15 to 25 thousand million operations a second on one core; the cycle’s sparse products wait on memory and ran at about 0.9 thousand million. These times were taken on a shared, heavily loaded computer, so only the ratios between them mean anything, and the counts of operations do not depend on it at all.
On the arm itself the story is the same, a step behind. With bricks of 8 mm each linear system took about 1.1 s by the multigrid and 0.08 s by the factorisation, 14 times as long; with 5 mm, 3.8 s against 0.52 s, 7.3 times. At that pace the two would meet near bricks of 2.5 to 3 mm.
The answer is not the same. The simulator can solve each Newton step by factorisation and, beside it, by the multigrid, keeping the factorisation’s step: the search is then the factorisation’s, byte for byte. When the multigrid’s own inexact steps are used instead, the arm’s first balance is found in 137 Newton iterations against 142, in four times the time, and it is a different balance: two bodies of tissue lie up to 35 and 28 mm from where the factorisation put them, although half their lattice corners are within 0.04 and 0.11 mm, and the energy is 0.46 mJ higher. A body of tissue squeezed among others can have more than one balance, and a different path can end in another. Which solver is used is therefore a question for How the simulator is checked as much as for speed. The factorisation remains the simulator’s solver.
What this model leaves out
- The pressure in the Newton search. The simulator’s mixed solve works on one body at a time, outside the search for balance. The tissue’s search uses the factorisation, or the multigrid on the condensed equations.
- A different pressure. A brick whose pressure varies inside it, or is stabilised against oscillation, would change the brick itself and not only the solve. The simulator’s bricks keep one constant pressure each.
- Geometric multigrid with distributive smoothing. Zhu and colleagues’ method, the one reported to be independent of both the bricks and , is a different design that the simulator does not have.
- Contact between bodies. The laboratory’s block touches nothing; on the arm the ties between touching bodies are carried into the coarse levels as they stand, and the contact that switches on and off between iterations is what makes the arm’s systems harder than the block’s.
- A faster cycle. Storing the matrix in 3 × 3 blocks, using 32-bit numbers inside the preconditioner, keeping the coarse levels from one Newton step to the next, and running the cycle on a graphics card are all ways to speed it up that the simulator does not use.
Summary
- The factorisation’s work grows as the unknowns to the power 2.2 to 2.3; one V-cycle of multigrid costs work in proportion to the unknowns.
- A smoother removes rough error fast and smooth error slowly; multigrid sends what is left to coarser levels, where it looks rough again. The simulator builds its levels from the matrix by smoothed aggregation, with the six rigid motions kept exactly.
- On tissue that keeps its volume the cycle stalls, at the same rate on every brick size: 0.996 at the arm’s muscle. Volume-keeping errors cost almost nothing, and the cycle cannot separate them.
- Keeping each brick’s pressure as an unknown leaves the answer unchanged and moves the bulk modulus into a small term. MINRES with a block preconditioner then needs as many iterations at any , but more as the bricks shrink, and it does not help where active fibres dominate.
- In arithmetic the multigrid wins from 4 mm down; in time near 2 to 3 mm. Its inexact steps can lead the arm to a different balance, so the factorisation stays the reference.
Next: the solver works on one body at a time; the next chapter joins a deformable muscle to a moving skeleton: tissue and skeleton together.