flowlength function

Calculate flow length