def cl_velocity(r, v0, vinf, rstar, beta):
    """
    Calculate the velocity for a 1D spherical wind using the velocity law as
    given in Castor & Lamers 1979.

    Parameters
    ----------
    r: float
        The distance to calculate the velocity at
    v0: float
        The initial velocity at the bottom of the spherical wind
    vinf: float
        The terminal velocity at the edge of the wind
    rstar: float
        The radius of the central source (star)
    beta: float
        The acceleration exponents. Controls how rapidly the velocity
        is accelerated to the terminal velocity vinf.

    Returns
    -------
    v: float
        The velocity at a point r for a 1D spherical wind
    """

    return v0 + (vinf - v0) * (1 - rstar / r) ** beta