def nernst_planck_flux(c, gcx, gcy, gvx, gvy, ux, uy, D, z, T, p, mu=0.0):
    """
     Calculate the flux component of the Nernst-Planck equation

     Parameters
     ------------

    c:     concentration
    gcx:   concentration gradient, x component
    gcy:   concentration gradient, y component
    gvx:   voltage gradient, x component
    gvy:   voltage gradient, y component
    ux:    fluid velocity, x component
    uy:    fluid velocity, y component
    D:     diffusion constant, D
    z:     ion charge
    T:     temperature
    p:     parameters object

    Returns
    --------
    fx, fx        mass flux in x and y directions
    """
    alpha = D * z * p.q / (p.kb * T)
    fx = -D * gcx - alpha * gvx * c + ux * c - mu * c * gvx
    fy = -D * gcy - alpha * gvy * c + uy * c - mu * c * gvy
    return fx, fy
