# How hot is the water in the pot?

Question: How hot is the water in the pot? More precisely speaking, how can I get a temperature of the water as a function of time a priori?

Background & My attempt: Recently I started spend some time on cooking. And I'm curious about it. I have learned mathematics as a undergraduate student for four years, but I know a little about thermodynamics. (I listened to such a lecture once. So I've heard of $dU = TdS - pdV$, Entropy and Gibbs energy for example though I forgot almost everything; anyway I think I've never seen a formula depending on time.) So I conduct a small experiment first: I heat 100ml of water by IH correspond approximately to 700W and measure its temperature every 30 seconds. Here is the results.

It looks almost linear, but I think linear approximation is inappropriate; because if so, the water gets higher than $100^\circ\mathrm{C}$. So I guess it's some convex increasing function like $T(t) = 100 - \alpha e^{-t/\beta}$ for some positive constant $\alpha$ and $\beta$. But it doesn't fit the data. (It does fit the data. I just made a mistake in simple calculation. See my answer.)

I think I ignored too many factors. So feel free to assume anything reasonable. I would greatly appreciate if you help me. Thank you.

Additional question: I do a experiment and some calculation to deal with a problem pointed out in the comments of my answer: bad fitting at lower temperature. However, I cannot get a better solution. Fitting seems worse than before... Here is the results what I got. I heated 100ml water in pot with 9cm radius by IH correspond to 700W. (For calculation, I added linear interpolation values in the graph.) How can I get a better solution? (Light blue curve is a logistic approximation defined by $T = \dfrac{100}{1 + 1.62 e^{-0.0168 t}}$ as mentioned here.)

-
most of my algebraic methods lead to the exponential so I didn't post since you said it didn't work. That is why i came up with the ad hoc. I'm glad to see the exponential works after all. –  Mew Apr 5 '13 at 6:15
@Chris and Taro I finished posting my hint on gnuplot a bit too late. Initially I thought fitting was a second problem to the choice of fit function. Thanks for the down to daily cooking question. –  Stefan Bischof Apr 5 '13 at 6:18
Thank you for spending some time Chris and Stefan. Since it turns out that I just made a mistake in simple calculations and I can't delete this post, I write an answer by myself. I think it's OK, but since I'm not a physics student but a math student, there may be physical mistakes. Please tell me is there are some. –  Orat Apr 6 '13 at 6:31
I'm curious about the downvote. @Taro Please adjust the title of the question to your updated bounty question. I'd recommand removing the section about thermodynamics. –  Stefan Bischof Apr 10 '13 at 5:55
@(downvoter) Could you explain me why you downvote? Unless you didn't explain to me, I can't improve it. @StefanBischof I guess it's because this question becomes similar to the other question of mine. Duplicate one of the question to the other might be better. –  Orat Apr 10 '13 at 9:20

It seems we have reached the point where simple models are no longer satisfying. Rather than posing ad hoc DEs maybe it's time to try an actual physical model. Short of doing a full hydrodynamic simulation (definitely overkill here) we can try what is called a lumped capacitance model where we divide the system up into a number of "lumps" and energy flows between the lumps:

The fundamental law governing this system is the conservation of energy. Every lump has an equation of the form

$$\frac{\mathrm{d}}{\mathrm{d}t}(\text{energy in lump}) = \text{rate of energy entering} - \text{rate of energy leaving}.$$

We treat the heat input as a fixed flow and the air (environment) as a heat bath at a fixed temperature. If we let the heat capacity of the $i$-th lump be $C_i(T)$, which can be a function of temperature then

$$\begin{array}{rcl} \frac{\mathrm{d}}{\mathrm{d}t} \left( C_p(T_p) T_p \right) &=& P - r_1 (T_p - T_w) - r_2 (T_p - T_a)\\ \frac{\mathrm{d}}{\mathrm{d}t} \left( C_w(T_w) T_w \right) &=& r_1 (T_p - T_w) - r_3 (T_w - T_a) \end{array}$$

You can look up how the heat capacity $C_w(T)$ varies with temperature for water (though probably not for the pot material?), but we will simplify dramatically and assume, incorrectly, that the heat capacities are constant.

$$\begin{array}{rccl} \frac{\mathrm{d}}{\mathrm{d}t} T_p &=& - \frac{r_1 + r_2}{C_p} T_p + \frac{r_1}{C_p} T_w + \frac{P + r_2 T_a}{C_p} &\equiv& a T_p + b T_w + s_p\\ \frac{\mathrm{d}}{\mathrm{d}t} T_w &=& \frac{r_1}{C_w} T_p - \frac{r_1 + r_3}{C_w} T_w + \frac{r_3 T_a}{C_w} &\equiv& c T_p + d T_w + s_w \end{array}$$

where the $a,b,c,d,s_p,s_w$ are shorthands. Note that only six combinations of the seven parameters ($r_1,r_2,r_3,P,T_a,C_p,C_w$) actually enter the problem, so there is some degeneracy of the parameters. You can see, Taro, that this is almost the model you came up with in your answer. The difference is that I'm including the heat input explicitly, so that conservation of energy is guaranteed.

With the obvious matrix shorthand these equations can be written

$$\dot{T}-MT = s,$$

which, for a constant source, has the solution

$$T\left(t\right) = \mathrm{e}^{Mt}T_{0}+\mathrm{e}^{Mt}\left(\int_{0}^{t}\mathrm{e}^{-M\tau}\mathrm{d}\tau\right) s.$$

When $M$ is invertible (which it definitely should be for this problem - if it's not then there is a mistake somewhere) the integral can be simplified:

$$T\left(t\right) = \mathrm{e}^{Mt}\left(T_{0}+M^{-1}s\right)-M^{-1}s.$$

You can check this satisfies the original equation with the proper boundary conditions. There are eight parameters to fit: the four matrix elements, two sources, and two initial temperatures. It is a non-linear regression problem since the matrix exponential depends non-linearly on the fit parameters. So I'm afraid I don't know of a robust and efficient way to fit this model to your data, unless you use some assumptions to simplify the parameter dependence, but this is the physically motivated model for your situation.

-
+∞ for actually modelling the system; small nit: naming a rate of energy $Q$ is a bit unfortunate... –  Christoph Apr 9 '13 at 12:40
Theoretically, I'm satisfied with your answer. Fitting parameters isn't problem at all; rewrite the original DE as a equation of parameters $\boldsymbol{x}$ like $A\boldsymbol{x} = \boldsymbol{b}$ and estimate $\hat{\boldsymbol{x}}$ by simple regression is enough. The only left problem is how to compute it. It certainly can't be done with hands though there must be some software that can deal with this kind of problem... –  Orat Apr 9 '13 at 16:30
I try to estimate parameters assuming a rate of energy is 700W and $Ta=20.0$. But somehow $c_w<0$ and I cannot find out what is wrong... Could you help me? Here is a code that I tried. –  Orat Apr 10 '13 at 10:41
I noticed the DE you wrote doesn't converges to that of mine as $r_1 \to 0$. So I tried this to fix that problem. However, capacities is somehow negative, too... –  Orat Apr 10 '13 at 15:51
Lot of work and works missing the reality. Look up some books on steam generation or general chemical technology to learn how evaporation processes are estimated. Much too complicated for today physicists. –  Georg Apr 16 '13 at 12:33

To close this post, I write an answer by myself though it turned out that I made just a simple calculation mistake.

Since the temperature increase should be monotonic and approach to zero at boiling point, it's reasonable to assume that the temperature increase $dT/dt$ is proportional to the difference $T - 100 \mathrm{^\circ C}$, that is, $$\frac{dT}{dt} = -k(T - 100 \mathrm{^\circ C})$$ holds for some positive constant $k$. Solving this equation gives $$T = 100 \mathrm{^\circ C} + (T(t_0) - 100 \mathrm{^\circ C})e^{-k(t - t_0)}.$$

Let's determine coefficient $k$ from $N$ measurements by linear regression. Let $c$ be a time interval of experiments and $x_n$ the temperature of the water on $t_n = cn$. Then estimate the slope of the tangent line by $$y_n = \mathrm{mean}\big(\frac{t_{n + 1} - t_{n}}{c}, \frac{t_{n} - t_{n - 1}}{c}\big) = \frac{t_{n + 1} - t_{n - 1}}{2c}$$ for $0 < n < N$. From above equation, there should be a relation of the form $$y_n = -k(x_n - 100 \mathrm{^\circ C}) + \varepsilon_n$$ where $\varepsilon_n$ stands for experimental errors. I denote this equation by $$y = -kx +\varepsilon$$ as shorthand. The best estimator $\hat{k}$ is given if $x$ and $\varepsilon$ are orthogonal to each other. Therefore $$\hat{k} = -\frac{(x, y)}{(x, x)} \approx 0.00667 \mathrm{s^{-1}}$$ from calculations. And this value fits the experimental data well.

Note: I completely rewrite this answer. Here, I would like to review where my answer was inappropriate. It seems not a problem of physic but a problem of statistics. Last time, I solved DE first and took logarithm to make it linear. However the experimental errors also transformed. Especially, $\ln(100 - x_n) \to -\infty$ as $x_n \to 100$. So this seems to cause overfitting at higher temperature and bad fitting at lower temperature. (Considering a effect of the pot looks a good idea but everything I tried fails. It won't fit data and still open though I already got a reasonable approximation.)

Thank you so much for helping me, Chris, Stefan Bischof, Michael Brown and Christoph.

-
Also the data may be on the low end early on might be due to the pot heating up as well as the water. So you might want to try preheating the pot and then putting water in. –  Michael Brown Apr 6 '13 at 9:47
I added error bars. According to an accounts, the accuracy is $T \pm \max(2.5 ^\circ{C}, 0.025T)$ though I don't check it by experiments yet. –  Orat Apr 6 '13 at 13:25
you might get a better fit if you don't hardcode the 100°C –  Christoph Apr 6 '13 at 13:36
@Taro: reality is messy, and we're dealing with an effective theory; if fudge factors help you get a better fit, use them even if you can't derive them from first principles; explaining where they come from comes after that –  Christoph Apr 6 '13 at 14:03
@Taro Reasons for not $100\,$°C in reality could be cooling effects of pot rims (they could be cooler than directly on bottom of pot). The pressure dependance should be neglectable unless you use a vapor pressure cooker. –  Stefan Bischof Apr 7 '13 at 17:44

Data fitting usually is done by the least-squares fit method. It's already implemented in a couple of computer algebra systems. I recommand the open source gnuplot for fitting the data. You will find the most appropriate model results in the smallest number of the least squares fit. My link contains an gnuplot example script for fitting.

Answer $$T_1(t) = A\cdot t - B\cdot e^{-k\cdot t}+C$$ Start fitting with the suggestion of saturated increase of Chris in the comments. Try to identify $T_{\text{boil}}(p)\approx 100\,$°C and $T_{\text{room}}$ from $T(0s)$.

Edit about extended time after your measurement: Keeping your hot plate still on lets me think about the fact that the water is still cooking. Conversion from water to gas phase is still in process. A measurement diagram after the heating phase would look like a constant/noisy $\approx 100\,$°C saturation. This extended measurement better would be covered by some hyperbolic tangent

$$T_2(t)=A\cdot t+ B\cdot \tanh(k\cdot t)+C$$ The logistic growth represents slower temperature increase and asymptotical increase to $\approx 100\,$°C.

-
How do you come up with hyperbolic tangent factor? –  Orat Apr 6 '13 at 14:13
@Taro I'd call it empiric intuition. My alternative fit $T_2(t)$ is not based on physical laws. Just the fact of a constant temperature of water before and at end of cooking reminded me of a hyperbolic tangent. Though your Newtons cooling law favors the fit with $T_1(t)$. Comparing the quality of fits gives a better objective point of view. Your fit in your answer (+1) looks reasonable, but there could be an additional effect at beginning heating the steel pot. Heating of cold steel pot? –  Stefan Bischof Apr 7 '13 at 10:58
@Taro: the basic idea behind using hyperbolic tangent is logistic growth; fitting the measured pot temperatures with $A \tanh B(t−C) + D$ looks good to me –  Christoph Apr 9 '13 at 6:51
@Christoph Thank you for elaborating an idea behind hyperbolic tangent. I become feel natural to that idea: logistic growth. If so, the dominating equation is probably $$\frac{dT}{dt} = \gamma(T - T_\text{melting point})(T - T_\text{boiling point}).$$ I'll try it. –  Orat Apr 9 '13 at 7:29
@Taro: you can always try to hit your problem with a numeric hammer like five parameter logistic regression $$T = d + (a - d) / (1 + (t / c)^b )^f$$ and you'll get a fit; $a\approx22$ turns out to be the room temperature, $d\approx91$ the steady-state temperature, $b\approx1.5$ might be specific for water or your setup; $c$ and $f$ turn out to be fudge factors of order $10^5$ with high variability (they can be used to balance each other to some degree), which suggests that the functional dependence isn't quite right yet –  Christoph Apr 9 '13 at 9:48