def velocity(v_1, rho_1, d, my, C_D, A, dt, V, m, epsilon):
    """One step of velosity(vertical motion) with forward euler"""
    re = pm.re(v_1,d,rho_1,my)
    f_b = pm.force_buoyancy(rho_1,V)
    f_g = pm.force_gravity(m)
    if re<epsilon:
        #Use stokes drag model
        f_d = pm.force_stokes_drag(d, my, v_1)
    else:
        #Use quadratic drag model
        f_d = pm.force_quadratic_drag(C_D, rho_1, A, v_1)
    v = v_1 + (dt/float(m))*(f_d + f_b + f_g)
    return v
def crank_nicholsen(rho,rho_b,my,d,C_D,V,A,epsilon,dt,v_1, g = -9.81):
    """
    Compute one velosity step of a vertical movment in fluid
    :param dt: Timestep
    :param v_1: Initial velosity
    :param rho: Density of fluid
    :param rho_b: Density of object
    :param my: Dynamic viscosity
    :param d: Diameter of object perpendicular to flow
    :param C_D: Drag coefficient
    :param V: Volume of object
    :param A: Cross-sectional area of object
    """
    b = g*(1-rho/float(rho_b))
    if(re(v_1,d,rho,my)< epsilon):
        a = (3*pi*d*my)/(V*rho_b);
        return crank_nicholsen_stokes_drag(a,b,dt,v_1);
    else:
        a = 0.5*C_D*(rho*A)/(rho_b*V);
        return crank_nicholsen_quadratic_drag(a,b,dt,v_1);