Fast linear solver for pressure computation in layered domains