# Combining the first and second laws

Pulling together some characteristics of entropy

- $S$ is a function of the
**state**of the system. So we can write it as a function of any two state variables / functions, for example, $S=S(T,P)$, or $=S(T,V)$, or $=S(P,V)$, or sometimes even $S=S(U,P)$. - Entropy $S$ is extensive. Specific entropy $s=S/m$ is intensive.
- Units for $S$ are
*Joules / Kelvin*. - In a reversible system, $dS = \delta Q_r / T$.

Spakovszky's definition of reversibility:

A process is called completely reversible if, after the process has occurred, both the system and its surroundings can be wholly restored by any means to their respective initial states.

### The first law and the second law, together

**Always true....**
$$dU = \delta Q - \delta W.$$

**Sometimes true:** for reversible work:
$$\delta W = \delta W_r= P\,dV.$$
$$dU = \delta Q - P\,dV.$$

for reversible heat: $$\delta Q=\delta Q_r = T\,dS.$$ $$dU = T\,dS - \delta W.$$

Clearly, it is at least *sometimes* true that (substituting the reversible
forms for $\delta Q$ and $\delta W$):
$$dU = T\,dS - P\,dV.$$

**But wait a sec'...** actually, *all* the quantities in this equation are **state variables or functions
of the state**, so we conclude that this statement, which is **Gibbs
Law** is **always
true**:

$$dU = T\,dS - P\,dV.$$

[Gibbs Law] is by far the most important relation in classical thermodynamics. -Ashley Carter

Now do the first two examples in 6.8 before doing these...

### Entropy changes for some reversible processes

We figured out expressions for the *work* done in isochoric, isobaric, etc.... processes. Now let's do the same thing for the *entropy* change in different processes.

Gibbs law holds for all kinds of processes, but for reversible processes can be written: $$dU = T\,dS-P\,dV = \delta Q_r - P\,dV.$$

**Adiabatic process**:
$$\delta Q_r = 0 \Rightarrow dS =\frac{\delta Q_r}{T}= 0.$$
So, this
is an *isentropic* process.

(However, there are also* irreversible*, adiabatic processes.)

**Isothermal process:**
$$\Delta s =s_2-s_1= \int \frac{dq_r}{T} = \frac{q_r}{T}.$$

**Carnot cycle:
**
Consists of reversible adiabatic compressions/expansions and isothermal compressions/expansions. [Graph a Carnot cycle on a $T$ vs $s$ plot.]

The adiabatic parts of a Carnot cycle are
reversible, so from the above considerations we conclude these are *isentropic (constant entropy)*.
The graph of a Carnot cycle on a $T-s$ plot is then a very simple figure...

The area under a process line on a $T-s$ plot corresponds to...what??

$$\int T\,ds = \int T\(\frac{\delta q_r}{T}\)=\int \delta q_r = q_r.$$

So, apparently the shaded area on this $T-s$ Carnot plot is... $$q_2+q_1 = w.$$

**Phase change: **

If a phase change (e.g. ice, melting to water) takes
place in an open system, it is both *isobaric* and *isothermal*.

The heat absorbed (or given off) per kilomole is the *latent
heat* $l$, so
we conclude that the change of entropy is...
$$\Delta s = \int \frac{\delta q}{T} = \frac{l}{T}.$$

**Isochoric process:**

Normally $u=u(v,T)$. For an isochoric process, $u=u(T)$ and that means $du
= c_v\,dT$. Since $dv=0$, the first law reads $du=\delta q$.

If $c_v$ is independent of temperature, then $\Delta s = c_v\ln\(T_2/T_1\)$.

**Isobaric process:**

For reversible processes, the enthalpy is convenient, since...
$$dh = du+Pdv+vdP=\delta q_r -Pdv+Pdv+vdP=\delta q_r+vdP.$$

For an isobaric process, $h=h(T,P) = h(T)$ and $dh = c_P\,dT$. Dividing by $T$: $$\Delta s = \int_1^2 c_P \frac{dT}{T}.$$

When $c_P$ is constant over this temperature range, $$\Delta s=c_P\ln\(T_2/T_1\).$$

### Entropy changes for an ideal gas

Making no assumptions of reversibility, the Gibbs relation still holds... $$du = Tds-Pdv.$$

For an ideal gas, the internal energy is only a function of $T$, so $du = c_v\,dT$... $$c_v\,dT = T\,ds-P\,dv \Rightarrow ds= c_v\frac{dT}{T}+\frac{P}{T}dv.$$

Using the ideal gas law to write $P/T = R/v$: $$ds = c_v\frac{dT}{T}+R\frac{dv}{v},$$ which relates the fractional temperature and volume changes to entropy changes.

We can write this in terms of $P$ and $v$ instead of $T$ and $v$ by the following trick: Take the natural log of the ideal gas law:

$$\ln P +\ln v= \ln R + \ln T.$$Taking differentials... $$\frac{dP}{P}+\frac{dv}{v} = \frac{dT}{T}.$$

Subbing this equation for $dT/T$ in our $ds$ expression: $$\begin{align}ds = & c_v\( \frac{dP}{P}+\frac{dv}{v} \)+R\frac{dv}{v} = c_v \frac{dP}{P}+\( c_v + R\)\frac{dv}{v}\\ = & c_v \frac{dP}{P}+ c_P\frac{dv}{v} \end{align}$$

Using $c_P/c_v = \gamma$, $$\frac{ds}{c_v} = \frac{dP}{P} + \gamma\frac{dv}{v}.$$

Integrating from state 1 to state 2:

$$\frac{\Delta s}{c_v} =\ln\( \frac{P_2}{P_1}\) + \gamma \ln\( \frac{v_2}{v_1}\) = \ln\( \frac{P_2v_2^\gamma}{P_1v_1^\gamma}\).$$Taking $e^\(...\)$ of both sides... $$\frac{P_2v_2^\gamma}{P_1v_1^\gamma} = e^{\Delta s/c_v}.$$

This expression is good for ideal gases in both reversible and irreversible
processes. But it shows, in a deeper way, that in general for *isentropic* processes
with an ideal gas the result we previously had found for adiabatic processes,
that:
$$Pv^{\gamma} = K.$$