Consider a process where some chemical species diffuses from one part of a system (which I'll call $A$) to another ($B$) at a rate $r$ $\text{mol}\cdot \mathrm s^{-1}$. If the system's temperature is constant and homogeneous, we say that energy is dissipated at a rate $$ D = r(\mu_B - \mu_A), $$ where $\mu_A$ and $\mu_B$ are the chemical potentials of the particles in parts $A$ and $B$ of the system respectively. The dissipation is always positive, because $D=T d_i\!S/dt$, where $d_i\!S/dt$ is the rate at which entropy is produced within the system due to the transport process.
However, if the temperatures of the two parts of the system are different then the second law says $$ \frac{d_i\!S}{dt} = r\left( \frac{\mu_B}{T_B} - \frac{\mu_A}{T_A} \right) \ge 0, $$ which means that the above expression for $D$ can be negative if $T_A>T_B$.
So my questions are
- Is the term "dissipation" generally thought to be meaningful in systems that don't have a constant, homogeneous temperature?
- If yes, what is the correct expression for it in the above scenario?
- Most importantly, does anyone know of a reference where the concept of dissipation in systems with a non-constant or non-homogeneous temperature is discussed?