Why isn't $dH=Q+\sum_i\mu_idN_i$ (constant pressure)

So my book claims that under constant-pressure conditions, the change in enthalpy is given by $$dH=Q$$. However, if we look at the thermodynamic identity and first law of thermodynamics, we see that $$dU=TdS-PdV+\sum_i\mu_idN_i=Q+W.$$ This would mean that $$dH= dU+PdV=TdS+\sum_i\mu_idN_i=Q+W+PdV=Q+\sum_i\mu_idN_i.$$ Since heat is defined as the spontaneous flow of energy due to a temperature difference, I would say that we can't include the term $$\sum_i\mu_idN_i$$ to $$Q$$ (because it represent the change in energy by adding particles), but then $$dH$$ isn't equal to $$Q$$... Besides, my book calls $$\sum_i\mu_idN_i$$ "chemical work", which seems to suggest that it should belongn to $$W$$ and not $$Q$$.

Could someone help me out of my confusion?

EDIT

I wasn't clear about this at first, but question kind of revolves around chemical reactions. So we're talking about a closed system, where the chemical work is nonzero.

• I believe the first law equation is for a closed system (no mass transfer between the system and surroundings). If particles are added to the system, it is no longer a closed system. Correct? – Bob D Dec 9 '18 at 17:37
• @BobD I don't think so. For a closed system, we would have $dU=0$, but the first law still holds. Besides, we're talking about a chemical reaction that takes place in a closed system. – Sha Vuklia Dec 9 '18 at 17:40
• Why do you think $dU=0$ for a closed system? Closed means no mass transfer. $Q=0$ is for adiabatic system. – Bob D Dec 9 '18 at 17:44
• Your equation for dH is incorrect. It should read $$dH=dU+PdV+VdP$$ – Chet Miller Dec 9 '18 at 17:46
• @ChesterMiller Yea, but in the title it says constant pressure, so $dP=0$. – Sha Vuklia Dec 9 '18 at 17:51

The chemical potential $$d\mu_i$$ is defined as the partial molar free energy: $$\mu_i=\left(\frac{\partial G}{\partial N_i}\right)_{T,P}$$ But, as a result of this and the other basic relationships, it is also given by: $$\mu_i=\left(\frac{\partial U}{\partial N_i}\right)_{S,V}=\left(\frac{\partial H}{\partial N_i}\right)_{S,P}$$

So, $$dH=TdS+VdP+\sum{\mu_idN_i}$$ and, at constant pressure,$$dH=dU+PdV=TdS+\sum{\mu_idN_i}$$

But, dQ is not equal to TdS unless the process is reversible.

Also, please don't mix differentials up with finite changes. A finite change should be represented by a $$\Delta$$. And Q is not equal to $$T\Delta S$$ unless the temperature is constant (and, again, unless the process is reversible).

Also, $$\Delta H=Q$$ only applies to a closed system (i.e., no mass entering or leaving). Obviously, if mass is entering or leaving, it does so with its own enthalpy (and other properties), and this changes the enthalpy of the system.

As a response to Chester Miller's comment:

The only assumption made is that we are dealing with a chemical reaction in a closed system of constant temperature and constant pressure. I think the point is that while $$\sum_i\mu_idN_i$$ is considered chemical "work", it's still not work that was done on the system by its surroundings. For this chemical energy, heat from the surroundings had to flow into the system (as we're assuming no other forms of work are done, except expansion-compression work), and it doesn't matter that it was converted to/used as chemical energy once this energy entered the system. So I would think the first law of thermodynamics is rather used for "influences" from the outside, and not from the inside (thinking of the system as isolated for a moment), in which forms of energy are converted. The first law is just a rephrasing of the law of conservation of energy anyways in a way that is useful for thermodynamics.

I don't know if all of what I'm saying makes sense, as I'm not sure I'm phrasing it well. But the point is that heat flew into the system, and had the quantity $$TdS+\sum_i\mu_idN_i$$. And the first law kind of tells us how this energy got into the system; either work was performed on the system or heat flew in. But as chemical work isn't work done on the system, but rather within the system, we don't "mind" (as far as the first law goes). The heat that flew in was still $$TdS+\sum_i\mu_idN_i$$, and part of it ($$\sum_i\mu_idN_i$$ to be exact) was used for chemical energy, and $$TdS$$ was just used for other forms of energy, that we don't take into consideration.

I'm guessing then that we could say $$TdS=Q-\sum_i\mu_idN_i.$$ For spontaneous reactions ($$\sum_i\mu_idN_i<0$$) we would then have that $$TdS>Q$$, which could be interpreted as that the entropy first increases due to the heat transfer ($$Q$$), and then also increases due to the chemical reaction ($$\sum_i\mu_idN_i$$).

Disclaimer: I'm not feeling confident about everything, but at least I see some coherence this way.

Based on your answer to my question, this is not how I would approach analysis of a closed system experiencing a chemical reaction. For a closed system experiencing a reaction at constant pressure and temperature, the heat flow Q is just equal to the change in enthalpy: $$Q=\Delta H$$ as predicted by the first law. Notice that I used $$\Delta H$$ here, not dH.

For an ideal gas mixture, the enthalpy change of mixing is equal to zero. So the partial molar enthalpy of each species in the reaction mixture is equal to the "standard" enthalpy of the same pure species at the same temperature as the mixture and 1 bar pressure: $$H=\sum{h^0_i(T)N_i}$$where $$h^0_i(T)$$ is the standard heat of formation of the pure species at the reaction temperature T and 1 bar. The pressure of the mixture does not matter, since the enthalpy of an ideal gas (or ideal gas mixture) is independent of pressure. So the heat that has to be added to the reactor Q is just: $$Q=\Delta H=\sum{h^0_i(N_{i, final}-N_{i, initial})}$$For an exothermic reaction Q and $$\Delta H$$ are both negative.