With the analytical solution, we seek to better understand the system, including addressing two items of interest.
What did the fish say when he hit the wall?
Dam.
I'm reading a book about anti-gravity.
It's impossible to put down!
From Ch9.3:
\[ cm\frac{dU}{dt} = q - hS(U-u_{s}) \]
Parameters:
Our ODE is
\[ cm\frac{dU}{dt} = q - hS(U-u_{s}) \]
This can be rewritten as
\[ \begin{aligned} \frac{dU}{dt} &= \frac{q+hSu_{s}}{cm} -U\frac{hS}{cm} \\ \frac{dU}{dt} &= \beta - \alpha U \end{aligned} \]
where \( \alpha = \frac{hS}{cm} \) and \( \beta = \frac{q + h S u_{s}}{cm} \).
This ODE is a first-order linear equation, and can be solved using the method of integrating factors.
\[ \frac{dU}{dt} + \alpha U = \beta, \,\, U(0) = u_0 \]
The integrating factor here is
\[ R(t) = e^{\int_{0}^{t} \alpha dt} = e^{\alpha t} \]
Using the integrating factor \( R(t) \), we can rewrite the differential equation as follows.
\[ \begin{aligned} \frac{dU}{dt} + \alpha U &= \beta \\ \frac{dU}{dt} e^{\alpha t} + \alpha U e^{\alpha t} &= \beta e^{\alpha t} \\ e^{\alpha t} \frac{dU}{dt} + \frac{d}{dt}\left( e^{\alpha t} \right) U &= \beta e^{\alpha t} \\ \frac{d}{dt} \left( U e^{\alpha t} \right) &= \beta e^{\alpha t} \end{aligned} \]
Integrate both sides with respect to \( t \):
\[ \begin{aligned} \frac{d}{dt} \left( U e^{\alpha t} \right) &= \beta e^{\alpha t} \\ e^{\alpha t}U &= \frac{\beta}{\alpha}e^{\alpha t} + K \\ U &= \frac{\beta}{\alpha} + Ke^{-\alpha t} \end{aligned} \]
With \( U(0)=u_0 \), it follows that \( K = u_0 - \frac{\beta}{\alpha} \) and
\[ U(t) = \left(u_0 - \frac{\beta}{\alpha}\right) e^{-\alpha t} + \frac{\beta}{\alpha} \]
From previous slide, our solution to the hot water heater IVP is
\[ U(t) = \left(u_0 - \frac{\beta}{\alpha}\right) e^{-\alpha t} + \frac{\beta}{\alpha} \]
Recall \( \alpha = \frac{hS}{cm} \) and \( \beta = \frac{q + h S u_{s}}{cm} \). Then
\[ \frac{\beta}{\alpha} = \left(\frac{q + h S u_{s}}{cm}\right) \left(\frac{cm}{hS}\right) = \frac{q}{hs} + u_{s} \]
Thus
\[ U(t) = \left( u_0 - u_s - \frac{q}{hS} \right) e^{- \frac{hS}{cm} t } + u_s + \frac{q}{hS} \]
For typical household, we have:
(S <- pi*0.564*1.444+2*pi*(0.564/2)^2)
[1] 3.058227
The temperature of the water in the tank is given by
\[ U(t) = \left( u_0 - u_s - \frac{q}{hS} \right) e^{- \frac{hS}{cm} t } + u_s + \frac{q}{hS} \]
\[ \begin{aligned} \left[\frac{q}{hS}\right] & = \frac{W}{\left(\frac{W}{m^2 \, C }\right)m^2} = C \\ \left[\frac{hS}{cm}t \right] & = \frac{ \left(\,\frac{J}{m^2 sec \, C}\right)\left(m^2 \,\right)\left(\, sec \, \right) } { \left(\frac{J}{kg \, C \,}\right) \,kg \, } = \mathrm{unitless} \end{aligned} \]
Find time required to heat tank of water to \( 60^\circ C \).
\[ U(t) = \left( u_0 - u_s - \frac{q}{hS} \right) e^{- \frac{hS}{cm} t } + u_s + \frac{q}{hS} \]
\[ \alpha = \frac{hS}{cm}, \beta = \frac{q+hSu_s}{cm} \]
\[ U(t) = \left( u_0 - \frac{\beta}{\alpha} \right)e^{-\alpha t} + \frac{\beta}{\alpha} \]
\[ U(t) = \left( u_0 - \frac{\beta}{\alpha} \right)e^{-\alpha t} + \frac{\beta}{\alpha} \]
\[ e^{-\alpha t} = \frac{U(t) - \beta / \alpha}{u_0 - \beta / \alpha} = \frac{\beta / \alpha - U(t) }{\beta / \alpha - u_0 } \]
\[ t = - \frac{1}{\alpha} \ln \left| \frac{\beta / \alpha - U(t) }{\beta / \alpha - u_0 } \right| = \frac{1}{\alpha} \ln \left| \frac{\beta / \alpha - u_0}{\beta / \alpha - U(t)} \right| \]
Time to heat water from \( 15^\circ C \) to \( 60^\circ C \) is 4 hrs and 53 mins.
#System Parameters
us <- 15; u0 <- us
S <- 3.06; q <- 3600; c <- 4200; m<-250; h<-12
#Compute alpha and beta
hS <- h*S; cm <- c*m; a <- hS/cm
b <- (q + hS*us)/(cm)
#Formula for t in hours & minutes
time <- (1/a*log((b/a-u0)/(b/a-60))/3600)
minutes <- (time-floor(time))*60
#Results
c(floor(time), minutes)
[1] 4.00000 52.77996
Formula for \( U(t) \):
\[ \small{ \begin{aligned} U(t) & = \left( u_0 - \frac{\beta}{\alpha} \right)e^{-\alpha t} + \frac{\beta}{\alpha} \\ \alpha & = \frac{hS}{cm} \\ \beta & = \frac{q+hSu_s}{cm} \end{aligned} } \]
Ex10.4Plot(10)
Ex10.4Plot <- function(T) {
#Ch10.2 Example 10.4: Plot Solution
#T is measured in hours for graph
#t is measured in seconds for formulas
T <- T*3600 #Convert hours to seconds
#System Parameters
us <- 15 #ambient temperature
u0 <- us #initial temperature = ambient temperature
S <- 3.06
q <- 3600
c <- 4200
m <- 250
h <- 12
#Compute alpha and beta
hS <- h*S
cm <- c*m
a <- hS/cm
b <- (q + hS*us)/(cm)
#Temperature of Water in Hot Water Heater
U <- function(t){(u0 - b/a)*exp(-a*t) + b/a}
#Initialize vectors for time t and temperature U.
x <- seq(0,T, by=10)
y <- U(x)
N <- length(x)
z <- rep(60,N)
plot(x,y,
main = "Water Temperature",
xlab = "t (Hours)", #x-axis label
ylab = "Temperature (C)", #y-axis label
type = "l",col="blue", #Line type and color
xaxt = "n", #Remove x-axis to customize
xlim = c(0,T), #x-axis interval
ylim = c(0,100) #y-axis interval
)
#Customize x-axis to have tick marks for hours instead of seconds
axis(1, at = seq(0, T, T/10), labels = c(0:10))
#Graph horizontal line for 60 degrees Celcius
lines(x,z, type="l",col="red")
legend("topright",
legend = c("Water Temperature", "Target Temperature"),
col=c("blue","red"), #legend colors
lty=c(1,1) #lty=line type
)
}
The cost of heating the tank is proportional to time it takes for water to heat, i.e., length of time for which the heater is on.
Does doubling the power output halve the heating time?
\[ \begin{aligned} U(t) & = \left( u_0 - \frac{\beta}{\alpha} \right)e^{-\alpha t} + \frac{\beta}{\alpha} \\ t & = \frac{1}{\alpha} \ln \left| \frac{\beta / \alpha - u_0}{\beta / \alpha - U(t)} \right| \end{aligned} \]
\[ \alpha = \frac{hS}{cm}, \, \, \beta = \frac{q+hSu_s}{cm} \]
Substituting in values for \( \alpha \) and \( \beta \), the formula for \( t \) becomes
\[ \begin{aligned} t &= \frac{1}{\frac{hS}{cm}} \ln \left| \frac{\frac{q+hSu_{s}}{cm}/\frac{hS}{cm}- u_{0}}{\frac{q+hSu_{s}}{cm}/ \frac{hS}{cm}-U} \right| \\ \\ &= \frac{cm}{hS} \ln \left| \frac{\frac{q+hSu_{s}}{cm}(\frac{cm}{hS})-u_{0}}{\frac{q+hSu_{s}}{cm}(\frac{cm}{hS})-U} \right| \\ \\ &= \frac{cm}{hS}\ln \left| \frac{\frac{q}{hS}+u_{s}-u_{0}}{\frac{q}{hS}+u_{s}-U} \right| \end{aligned} \]
This figure gives a plot of \( t \) as a function of \( q \) for a water heater to heat from \( u_O = 15 ^\circ C \) to \( U = 60 ^\circ C \), with \( u_s = 15 ^\circ C \) and other parameter values as before.
\[ \small{ t = \frac{cm}{hS}\ln \left| \frac{\frac{q}{hS}+u_{s}-u_{0}}{\frac{q}{hS}+u_{s}-U} \right| } \]
The line \( q \cong 1.6 kW \) is a vertical asymptote; below this level for \( q \) the heating element cannot supply enough energy to heat the mass of water in tank to \( 60 ^\circ C \).
\[ \small{ t = \frac{cm}{hS}\ln \left| \frac{\frac{q}{hS}+u_{s}-u_{0}}{\frac{q}{hS}+u_{s}-U} \right| } \]
The dotted lines indicate time in hours to heat the water for a \( 3.6 kW \) element and for a \( 4.8 kW \) element.
\[ \small{ t = \frac{cm}{hS}\ln \left| \frac{\frac{q}{hS}+u_{s}-u_{0}}{\frac{q}{hS}+u_{s}-U} \right| } \]
The ODE
\[ cm\frac{dU}{dt}=q-hS(U-u_s) \]
represents a balance between heat produced by heating element and heat lost from surface.
This suggests the existence of an equilibrium temperature, or thermal equilibrium.
\[ \begin{aligned} cm\frac{dU}{dt} &=q-hS(U-u_s) \\ 0 &= q-hS(U_e-u_s) \\ U_e & = u_s+\frac{q}{hS} \end{aligned} \]
Recall that the IVP
\[ cm\frac{dU}{dt}=q-hS(U-u_s), \,\, U(0)=u_o \]
has solution
\[ U(t)=\left(u_0-u_s-\frac{q}{hS}\right)e^{-(\frac{hS}{cm})t}+u_s+\frac{q}{hS} \]
If we take the limit of this solution as \( t \rightarrow \infty \), we see that
\[ U(t) \rightarrow u_s+\frac{q}{hS} = U_e \]
In mathematical terms, from ODE describing the heat balance,
\[ cm\frac{dU}{dt}=q-hS(U-u_s), \]
the derivative term is zero for equilibrium temperature.
Formulas:
\[ \small{ \begin{aligned} U(t) & = \left( u_0 - \frac{\beta}{\alpha} \right)e^{-\alpha t} + \frac{\beta}{\alpha} \\ \alpha & = \frac{hS}{cm} \\ \beta & = \frac{q+hSu_s}{cm} \\ U_e & = \frac{\beta}{\alpha} = u_s+\frac{q}{hS} \end{aligned} } \]
Ex10.6Plot(20)