# Mass and energy balance equations for a tank filled with H20

1. Jul 1, 2018

### dRic2

Hi, this problem should be very simple: I have a tank containing water. (going in and out). I want to write the differential equations to see what happen to the temperature and the level of the vessel if the flow of water is not constant.

the system should be:

$$A \frac {dl} {dt} = F_{in} - F_{out}$$
$$\frac {dE} {dt} = H_{in} - H_{out} - Q_{out}$$

$A$ is the section of the tank
$l$ is the level of water inside the vessel
$F$ are the volumetric flow rates
$Q_{out}$ represents the heat loss

I have a problem with the second equation (energy balance). How do I handle $H_{in}$ and $H_{out}$ ?

I tried to do this:

$$\frac {dE} {dt} = ρ F_{in} \left [ h(T_r) + \int_{T_r}^{T_{in}} cp \right ] - ρ F_{out} \left [ h(T_r) + \int_{T_r}^{T_{out}} cp \right ] - Q_{out}$$

$\rho$ can be assumed to be constant, but $F_{in} ≠ F_{out}$, so how to I handle $h(T_r)$? I can arbitrary set $h(T_r)$ to be $0$, but then what about $T_r$ ?

Thanks
Ric

2. Jul 1, 2018

### Staff: Mentor

Make up your mind. Either use mass flows, mass balance, and energy balance, or volume flow, volume balance, and temperature balance. Since you are dealing with water, it is easy either way. Use $C_{[p,v]}$ the Isobaric volumetric heat capacity (or $c_p$) to convert between the two representations.

I don't understand your energy balance. You didn't define all the symbols. I suspect that you also have problems with the units.

But you have only two temperatures to work with, the inlet temperature and the tank temperature. Outlet flow comes at tank temperature by definition.

You do not say what range of temperatures you need, or what accuracy. But either you assume $C_{[p,v]}$ is constant, or you can use the steam tables to get the values needed and make a curve fit $C_{[p,v]}$ as a function of temperature.

The next step I presume is numerical integration of the differential equations. You are not trying for a closed form time domain solution, correct?

Don't forget to add in the initial conditions for level and temperature.

3. Jul 1, 2018

### Staff: Mentor

By the way, you did not mention pressure. It is an open top tank, correct?

4. Jul 2, 2018

### dRic2

First of all, thank you for the reply :)

Mhm, I don't get what you are saying. Here's what I did (according to the properties of the system given by my professor - it is not really an exercise so I posted here ):

Mass balance:

$$\frac {dm} {dt} = \dot m_{in} - \dot m_{out}$$
$$\frac {d( \rho V)} {dt} = \rho_{in} \dot F_{in} - \rho_{out} \dot F_{out}$$
Assuming $\rho$ constant (the temperature range is not very wide) I get:
$$\frac {d(V)} {dt} = \dot F_{in} - \dot F_{out} → \frac {d(lA)} {dt} = \dot F_{in} - \dot F_{out}$$

I also apologize for my bad notation: when I wrote $c_p$ I meant $c = \left ( \frac {δQ} {dT} \right )$ because, in fluids, $c_p ≈ c_v ≈ c$.

$E$ is the total energy: $dE = d(U + K + φ) = dU ≈ dH$ because, for fluids, at constant pressure and density $d(PV) ≈ 0$ so, internal energy can be replaced with enthalpy.

$K$ is the kinetic energy, and so $dK ≈ 0$ (in this case).
$Φ$ is the potential energy, and so $dΦ ≈ 0$ (in this case).

$H_{in }$ and $H_{out}$ are the enthalpies of the inlet and outlet flow, because because mass flows carry energy inside and outside the system.

5. Jul 2, 2018

### dRic2

Well, I want to know the temperature profile if something happens to $F_{in}$ or $F_{out}$. $F_{in}$ has a Temperature of $60 °C$ while the outside temperature is $25 °C$. Heat loss ($Q_{out}$) can be approximated with $Q_{out} = UA(T-T_{outside})$. For a first general idea $U$ can be treated as a constant.

Yes.

Of course.

Yes

6. Jul 2, 2018

### Staff: Mentor

IN THIS ANALYSIS, THE F'S ARE GOING TO BE THE MASS FLOW RATES. SO THE MASS BALANCE ON THE TANK IS: $$\frac{A}{v}\frac{dl}{dt}=F_{in}-F_{out}$$ where v is the specific volume of the fluid (assumed constant).

If you neglect kinetic energy and potential energy in the tank and assume that the fluid is compressible, then $$E=\frac{Al}{v}\left[e(T_r)+\int_{T_r}^T{C(T')dT'}\right]$$where, for an incompressible fluid, C is both the heat capacity at constant volume and the heat capacity at constant temperature. In addition, if the pressure is constant, $$h_{in}=e_{in}+Pv=e(T_r)+\int_{T_r}^{T_{in}}{C(T')dT'}+Pv$$and $$h_{out}=e_{in}+Pv=e(T_r)+\int_{T_r}^{T_{out}}{C(T')dT'}+Pv$$Furthermore, the open system energy balance should read:
$$\frac{dE}{dt}=F_{in}h_{in}-F_{out}h_{out}-PA\frac{dl}{dt}+Q$$
where the third term on the right hand side represents the work the tank contents are doing in pushing back the surroundings.

If we combine these equations with the mass balance equation, we obtain:
$$\frac{Al}{v}C\frac{dT}{dt}=F_{in}\int_T^{T_{in}}{C(T')dT'}-F_{out}\int_T^{T_{out}}{C(T')dT'}+Pv(F_{in}-F_{out})-PA\frac{dl}{dt}+Q$$
But, from a volume balance, we have that: $$v(F_{in}-F_{out})=A\frac{dl}{dt}$$
Therefore,
$$\frac{Al}{v}C(T)\frac{dT}{dt}=F_{in}\int_T^{T_{in}}{C(T')dT'}-F_{out}\int_T^{T_{out}}{C(T')dT'}+Q$$

Last edited: Jul 2, 2018
7. Jul 2, 2018

### dRic2

Thank you @Chestermiller for the very interesting reply.

Okay, here I am unprepared... my professors never considered the work done by the tank in this way so I'm a bit shocked (I'm not saying that I don't believe you, I'm just new to this). I tried to derive your formula in my own way... if you please can check it I will be very glad I will post il later because now I'm very busy.

There are a few more things I'd like to understand:

Where did $e(T_r)$ go?

In your final formula what is $T$? Is $T = T_r$? And how can I find $T$?

8. Jul 2, 2018

### Staff: Mentor

It cancelled from both sides of the equation as a result of the mass balance.
T is the temperature in the tank. Tr is gone. You need to go through the math.

9. Jul 3, 2018

### Staff: Mentor

This problem can also be solved using the usual "closed system" version of the first law of thermodynamics, giving the identical results.

10. Jul 3, 2018

### dRic2

Sorry If I'm not replying. I'll be back in a few days

11. Jul 9, 2018

### dRic2

Okay, sorry for my late reply!

I've been carefully revising balance equations and I made it to the and of your answer. I just have few things I'd like to ask you:

1) When you use $E$ technically you are referring to $U$ (internal energy) but, since for incompressible fluids there is no difference between $H$ and $U$, you use $E$: it is just a matter of words, right?

2) Is it safe to assume that $T_{out} = T$ to simplify the equation (assuming perfect mixing)?

3) Just for the sake of it, I was trying to derive the macroscopic energy balance starting from the differential form of balance equations, but I get stuck... If you have time, can you please show me how it should be done?

Thank you,
Ric

12. Jul 9, 2018

### Staff: Mentor

Even for an incompressible fluid, there is a difference between H and U. Pv is not equal to zero. This has been taken into account in the development I presented. Also, the open system version of the first law determines dU/dt for the control volume, not dH/dt.
Yes, if you judge that that is a good approximation, such as if there is adequate stirring in the tank.
This development is presented in detail in Transport Phenomena by Bird, Stewart, and Lightfoot

13. Jul 9, 2018

### dRic2

Then why $C(T) ≈ C_v(T) ≈ C_p(T)$ for incompressible fluids ?

I don't want to bother you any further, but I'm not finding it. I looked it up and I found the macroscopic energy balance and it differential formulation, but I didn't find how to switch from one to the other by integrating the equation.

Thanks
Ric

14. Jul 9, 2018

### Staff: Mentor

Those are partial derivates with respect to T. The partial derivative of the Pv with respect to T is zero.
Are the derivations in Chapters 7 and 15 not adequate for filling the gaps in your derivation? Let's see what you've got so far.

15. Jul 10, 2018

### dRic2

I still don't understand why you used $C$ instead of $C_v$...

The derivations are very clear, I just have some problems trying to do it backward... I get stuck from the very beginning (I left out the irreversibility):

$$\rho \left[ \frac {\partial \hat U} {\partial t} + \vec v ⋅ \nabla \hat U \right] = - \nabla ⋅ q - p(\nabla ⋅\vec v)$$

The continuity equation yields:

$$\frac {\partial \rho} {\partial t} + \nabla ⋅(\rho \vec v) = 0$$

So I can use that result to write:

$$\rho \left[ \frac {\partial \hat U} {\partial t} + \vec v ⋅ \nabla \hat U \right] + \hat U \left[ \frac{\partial \rho} {\partial t} + \nabla ⋅(\rho \vec v) \right] = - \nabla ⋅ q - p(\nabla ⋅\vec v)$$

Noting that $\rho \vec v ⋅ \nabla \hat U + \hat U \nabla ⋅ (\rho \vec v) = \nabla ⋅ (\hat U \rho \vec v)$ and that $p(\nabla ⋅\vec v) = \nabla ⋅(\rho \vec v) - \vec v ⋅ \nabla p$ the equation becomes:

$$\rho \frac {\partial \hat U} {\partial t} + \hat U \frac {\partial \rho} {\partial t} + \nabla ⋅ (\rho \vec v \hat U) = - \nabla ⋅ q - \nabla ⋅(\rho \vec v) - \vec v ⋅ \nabla p$$
$$\frac {\partial \rho \hat U} {\partial t} = - \nabla ⋅ q - \nabla ⋅ (\rho \vec v \hat U) - \nabla ⋅(\rho \vec v) - \vec v ⋅ \nabla p$$

But here I'm stuck

16. Aug 14, 2018 at 5:22 PM

### dRic2

Hi, sorry if I revive this old post, but I finally got enough free time to think about it and I still don't get what you did.

The main thing I do not understand is this:

From page 316 of "Transport Phenomena" I will write the infinitesimal energy energy equation (in the most general form possible):

$$\frac {\partial}{\partial t} {\rho( \hat U + \frac 1 2 v^2)} = - ∇⋅\rho \mathbf v( \hat U + \frac 1 2 v^2) - ∇⋅ \mathbf q + \rho( \mathbf v ⋅ \mathbf g) - ∇⋅(p \mathbf v) - ∇⋅[ \mathbf \tau ⋅ \mathbf v]$$

Let's forget about $\frac 1 2 v^2$, $\rho( \mathbf v ⋅ \mathbf g)$ and $∇⋅[ \mathbf \tau ⋅ \mathbf v]$:

$$\frac {\partial}{\partial t} {\rho( \hat U )} = - ∇⋅\rho \mathbf v( \hat U ) - ∇⋅ \mathbf q - ∇⋅(p \mathbf v)$$

Putting together $- ∇⋅\rho \mathbf v( \hat U )$ and $- ∇⋅(p \mathbf v)$:

$$-∇⋅[ \rho \mathbf v( \hat U ) + (p \mathbf v)] = -∇⋅[ \rho \mathbf v ( \hat U + \frac p {\rho})] = -∇⋅[ \rho \mathbf v \hat H ]$$

And back to the main equation:

$$\frac {\partial}{\partial t} {\rho( \hat U )} = -∇⋅[ \rho \mathbf v \hat H ] - ∇⋅ \mathbf q$$

Integrating over the Volume:

$$\int_V \frac {\partial}{\partial t} {\rho( \hat U )} dV = - \int_V ∇⋅[ \rho \mathbf v \hat H ] dV - \int_V ∇⋅ \mathbf q dV$$

Now:

$$\int_V \frac {\partial}{\partial t} {\rho( \hat U )} dV = \frac {\partial}{\partial t} \int_V {\rho( \hat U )} dV = \frac {dU}{dt}$$

Using the divergence theorem:

$$\int_V ∇⋅[ \rho \mathbf v \hat H ] dV = \int_S \rho \mathbf v \hat H ⋅ d \mathbf S = -(H_{in} - H_{out})$$

Finally:

$$\frac {dE}{dt} = H_{in} - H_{out} + Q$$

17. Aug 15, 2018 at 9:09 AM

### Staff: Mentor

I don't have it in me to work out every last detail of the mathematics. But, your issue is definitely is related to the term $\nabla \centerdot (p\mathbf{v})$. The divergence theorem applied to this term definitely includes entering and exiting streams, but it also includes the work done if the boundary of the control volume is moving (in regions where where mass is not entering or leaving) so that the control volume is expanding. If this were a closed system, for example, this term would lead to the familiar pdV/dt term.

18. Aug 15, 2018 at 6:08 PM

### dRic2

Oh, now I see it clearly. Thank you very much. But I have no idea how to show it mathematically...

19. Aug 15, 2018 at 10:34 PM

### Staff: Mentor

I have a suggestion to get you started. Try to do it first for a closed system in which you have a moving boundary like a piston (but no mass entering or leaving). Don't forget to use Reynolds' theorem for differentiation under the integral sign. See if you can derive the usual form of the first law of thermodynamics.

20. Aug 16, 2018 at 6:35 PM

### dRic2

Okay, I will try as soon as I can, thank you again!