# Elementary

So my colleague K stops by my office today and asks if I’m busy.

“No.  What’s up?”

“I’ve got a thermodynamics problem and I’m looking for a way to solve it,” says K, who is a chemical engineer by trade.  He proceeds to set the stage, explaining that this is a problem about pressure and temperature changes in a fire extinguisher when in use.  Starting with the ideal gas law, the conservation of energy, an assumption on the nozzle, and the multivariate chain rule, K lays out a sequence of equations.  Six blackboards later, he ends with a pair of differential equations: $displaystyle frac{dP}{dt} = frac{C_p}{ R} frac{P}{T} frac{dT}{dt}, qquad frac{FR T}{V^+} bigg( frac{P_A}{P} - 1 bigg) = frac{C_V}{R} , frac{dT}{dt}.$

“The problem,” concludes K, “is to solve these equations for P and T, where the other variables — the Vs and Rs and Cs — are constants.”

“Well… we can use the first equation to express P in terms of T, and see what the solutions look like in phase space,” I suggest.

So we separate ignore the independent variable $t$ and separate the remaining variables and go to town: $displaystyle int frac{1}{P} , dP = int frac{C_p}{R} , frac{1}{T} , dT$ $displaystyle ln bigg| frac{P}{P_0} bigg| = frac{C_p}{R} ln bigg| frac{T}{T_0} bigg|$

which yields P in terms of T as $displaystyle P = P_0 bigg( frac{T}{T_0} bigg)^{C_p/R}$.

“Okay…” I say.  “Well, since the second equation only involves P but not its derivative, we could substitute the formula for P in it, and reduce the second equation to a single differential equation involving T.” $displaystyle frac{FR T}{V^+} bigg[ frac{P_A}{P_0} bigg( frac{T_0}{T} bigg)^{C_p/R} - 1 bigg] = frac{C_V}{R} , frac{dT}{dt}$ $displaystyle T bigg[ frac{P_A T_0^{C_p/R} - P_0 T^{C_p/R}}{P_0 T^{C_p/R}} bigg] = frac{C_V V^+}{F R^2} , frac{dT}{dt}$

“Oh!” I say, more excited. “This is now a first-order autonomous ODE, so it’s separable too!” $displaystyle int frac{P_0 T^{C_p/R - 1}}{P_0 T^{C_p/R} - P_A T_0^{C_p/R}} , dT = int - frac{F R^2}{C_V V^+} , dt$.

Incredibly, the integral on the left-hand-side can be evaluated with a simple substitution (a fact at which I, admittedly, giggled with glee), so we get $displaystyle frac{R}{C_p} ln bigg| frac{P_0 T^{C_p/R} - P_A T_0^{C_p/R}}{P_0 T_0^{C_p/R} - P_A T_0^{C_p/R}} bigg| = - frac{F R^2}{C_V V^+} , t$.

“So we’ve got (big) T solved implicitly in terms of (little) t,” I say, “so let’s unshackle it explicitly.” $displaystyle P_0 T^{C_p/R} - P_A T_0^{C_p/R} = T_0^{C_p/R}(P_0 - P_A) exp bigg( -frac{C_p F R}{C_V V^+} t bigg)$ $displaystyle T^{C_p/R} = frac{T_0^{C_p/R}}{P_0} bigg[ P_A + (P_0 - P_A) exp bigg( - frac{ C_p F R}{C_V V^+} t bigg) bigg]$ $displaystyle T = T_0 bigg[ frac{P_A}{P_0} + bigg(1 - frac{P_A}{P_0} bigg) exp bigg( - frac{C_p F R}{C_V V^+} t bigg) bigg]^{R/C_p}$

“And you have a T!” I exclaim, surprised that any of that worked. “Now we can substitute into our implicit formula for P to get it to.” $displaystyle P = P_A + (P_0 - P_A) exp bigg( - frac{C_p R F}{C_V V^+} t bigg)$

“By way of checking,” I add, anxious to make sure I didn’t make some bone-headed algebra mistake along the way, “we can check the initial conditions on T…” $displaystyle T bigg|_{t = 0} = T_0 bigg[ frac{P_A}{P_0} + 1 - frac{P_A}{P_0} bigg]^{R/C_p} = T_0$

“and P…” $displaystyle P bigg|_{t = 0} = P_A + P_0 - P_A = P_0$

“and the first differential equation…” (after furiously scribbling for a while) “…checks out, since both sides simplify to $displaystyle frac{dP}{dt} = frac{C_p}{ R} frac{P}{T} frac{dT}{dt} = frac{(P_A - P_0) C_p F R}{C_V V^+} exp bigg( - frac{C_p R F}{C_V V^+} t bigg)$

and each side of the second differential equation…” (more furious scribbling) “… simplifies to” $displaystyle - frac{(P_0 - P_A) F R T_0}{P_0^{R/C_p} V^+} exp bigg( - frac{C_p R F}{C_V V^+} t bigg) bigg[ P_A + (P_0 - P_A) exp bigg( - frac{C_p R F}{C_V V^+} t bigg) bigg]^{-R/C_p - 1}$

…so, yeah, we have a solution!” I conclude triumphantly.

K stares at the work, inspecting the derivation and double-checking some thermodynamical facts in his head. Finally, he pauses, scribbles some notes down in his binder, and turns to me.

“Thanks,” K says, adding, “I knew it was something simple.”