which means $T_L > T_R$ and $J_R$ is negative. We use Eq. (\[Eq:eff-eng\]) to replace $J_L$ with $P_{\rm gen}/\eta_{\rm eng}$ in Eq. (\[Eq:secondlaw\]). Then, the rate of entropy production by a heat-engine with efficiency $\eta_{\rm eng}(P_{\rm gen})$ at power output $P_{\rm gen}$ is $$\begin{aligned}
\dot S (P_{\rm gen}) 
 &=& 
{P_{\rm gen} \over T_R} \left({\eta_{\rm eng}^{\rm carnot} \over \eta_{\rm eng}(P_{\rm gen})} -1 \right),
\label{Eq:dotS-eng}\end{aligned}$$ where the Carnot efficiency, $\eta_{\rm eng}^{\rm carnot}$, is given in Eq. (\[Eq:Carnot-eng\]). Hence, knowing the efficiency at power $P_{\rm gen}$, tells us the entropy production at that power. Maximizing the former minimizes the latter.

For refrigeration, the load in Fig. \[Fig:thermocouple\] is replaced by a power supply, the thermoelectric thus absorbs a power $P_{\rm abs}$ to extract heat from the cold reservoir. We take reservoir $L$ as cold ($T_L < T_R$) , so $J_L$ is positive. We replace $P_{\rm gen}$ by $-P_{\rm abs}$ in Eqs. (\[Eq:firstlaw\],\[Eq:secondlaw\]). We then use Eq. (\[Eq:eff-fri\]) to replace $P_{\rm abs}$ by $J_L/\eta_{\rm fri}$. Then the rate of entropy production by a refrigerator at cooling power $J_L$ is $$\begin{aligned}
\dot S (J_L) 
 &=& 
{J_L \over T_R} \left({1\over \eta_{\rm fri}(J_L)} -{1 \over \eta_{\rm fri}^{\rm carnot}}  \right),
\label{Eq:dotS-fri}\end{aligned}$$ where the Carnot efficiency, $\eta_{\rm fri}^{\rm carnot}$, 