import copy


def nondimensionalise_parameters(params):
    """
    Nondimensionalise parameters.

    Arguments
    ---------
    rc : float
        Characteristic radius (length)
    qc : float
        Characteristic flow
    Ru : float
        Upstream radius
    Rd : float
        Downstream radius
    L : float
        Vessel length
    k1 : float
     	First constant from the relation Eh/r0
    k2 : float
        Second constant from the relation Eh/r0
    k3 : float
        Third constant from the relation Eh/R0
    rho : float
        Density of blood
    Re : float
        Reynolds' number
    nu : float
        Viscosity of blood
    p0 : float
        Diastolic pressure

    Returns
    -------
    return : tuple
        Tuple of dimensionless quantities, including Reynold's number
    """
    param = params.param
    sol = params.solution
    geo = params.geo
    nondim = copy.deepcopy(param)
    rc = param['rc']
    rho = param['rho']
    qc = param['qc']
    nondim['Ru'] = param['Ru']/rc
    nondim['Rd'] = param['Rd']/rc
    nondim['R_term'] = param['R_term']/rc
    nondim['L'] = param['L']/rc
    nondim['k1'] = param['k1']*rc**4/rho/qc**2
    nondim['k2'] = param['k2']*rc
    nondim['k3'] = param['k3']*rc**4/rho/qc**2
    nondim['Re'] = param['qc']/param['nu']/rc
    nondim['nu'] = param['nu']*rc/qc
    nondim['p0'] = param['p0']*rc**4/rho/qc**2
    nondim['p_term'] = param['p_term']*rc**4/rho/qc**2
    nondim['R1'] = param['R1']*rc**4/rho/qc
    nondim['R2'] = param['R2']*rc**4/rho/qc
    nondim['CT'] = param['CT']*rho*qc**2/rc**7
    return nondim