Logic to choose N_cells based on rmax and L