Simulation of density channel guiding in capillary discharge experiments and laser wakefield accelerators