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

#### dRic2

Gold Member
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

Related Materials and Chemical Engineering News on Phys.org

#### anorlunda

Mentor
Gold Member
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.

#### anorlunda

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

#### dRic2

Gold Member
First of all, thank you for the reply :)

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.
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$.

I don't understand your energy balance
$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.

#### dRic2

Gold Member
You do not say what range of temperatures you need
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.

The next step I presume is numerical integration of the differential equations
Yes.

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

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

#### Chestermiller

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:

#### dRic2

Gold Member
Thank you @Chestermiller for the very interesting reply.

Furthermore, the open system energy balance should read:
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:

If we combine these equations with the mass balance equation, we obtain:
Where did $e(T_r)$ go?

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

#### Chestermiller

Mentor
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?
It cancelled from both sides of the equation as a result of the mass balance.
In your final formula what is $T$? Is $T = T_r$? And how can I find $T$?
T is the temperature in the tank. Tr is gone. You need to go through the math.

#### Chestermiller

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

#### dRic2

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

#### dRic2

Gold Member
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

#### Chestermiller

Mentor
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?
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.
2) Is it safe to assume that $T_{out} = T$ to simplify the equation (assuming perfect mixing)?
Yes, if you judge that that is a good approximation, such as if there is adequate stirring in the tank.
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?
This development is presented in detail in Transport Phenomena by Bird, Stewart, and Lightfoot

#### dRic2

Gold Member
Even for an incompressible fluid, there is a difference between H and U.
Then why $C(T) ≈ C_v(T) ≈ C_p(T)$ for incompressible fluids ?

This development is presented in detail in Transport Phenomena by Bird, Stewart, and Lightfoot
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

#### Chestermiller

Mentor
Then why $C(T) ≈ C_v(T) ≈ C_p(T)$ for incompressible fluids ?
Those are partial derivates with respect to T. The partial derivative of the Pv with respect to T is zero.
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
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.

#### dRic2

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

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.
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

#### dRic2

Gold Member
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:

Furthermore, the open system energy balance should read:
$$\frac{dE}{dt}=F_{in}h_{in}−F_{out}h_{out}−PA\frac{dl}{dt}+Q$$​
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$$

#### Chestermiller

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.

#### dRic2

Gold Member
our issue is definitely is related to the term ∇⋅(pv)∇⋅(pv)\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.
Oh, now I see it clearly. Thank you very much. But I have no idea how to show it mathematically...

#### Chestermiller

Mentor
Oh, now I see it clearly. Thank you very much. But I have no idea how to show it mathematically...
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.

#### dRic2

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

#### dRic2

Gold Member
Sorry to bother you again, this will be the last time. Do you think this will do?

$$\int_V ∇ \cdot (p \mathbf v) dV = \int_S p \mathbf v d \mathbf S = p_{ext} \int_S \mathbf v d \mathbf S$$

$$\int_S \mathbf v \space d \mathbf S = \int_S \frac {d \mathbf r} {dt} \cdot \mathbf n \space dS = \int_S \frac {d( \mathbf r \cdot \mathbf n)} {dt} \space dS = \int_S \frac {d \mathbf r_{\bot}} {dt} \space dS = \frac d {dt} \int_S r_{\bot} \space dS = \frac {dV} {dt}$$

I'm not super about two things:
1) If I can extract $p$ out of the integral by considering the external pressure
2) If the second integral is correct

#### Chestermiller

Mentor
Sorry to bother you again, this will be the last time. Do you think this will do?

$$\int_V ∇ \cdot (p \mathbf v) dV = \int_S p \mathbf v d \mathbf S = p_{ext} \int_S \mathbf v d \mathbf S$$

$$\int_S \mathbf v \space d \mathbf S = \int_S \frac {d \mathbf r} {dt} \cdot \mathbf n \space dS = \int_S \frac {d( \mathbf r \cdot \mathbf n)} {dt} \space dS = \int_S \frac {d \mathbf r_{\bot}} {dt} \space dS = \frac d {dt} \int_S r_{\bot} \space dS = \frac {dV} {dt}$$

I'm not super about two things:
1) If I can extract $p$ out of the integral by considering the external pressure
2) If the second integral is correct
The pressure can't be taken out of the integral unless the pressure is constant over the moving portion of the boundary, such as in your homework example. Otherwise, $$\int_V{\nabla \centerdot (p\mathbf{v})dV}=\int_S{p(\mathbf{v}\centerdot\mathbf{n})dS}$$This is the integral of the rate of doing work at the surface (work on the surroundings). In your homework problem, it is equal to the rate of doing work to push back the piston, plus the rate of work required to push material into and out of the control volume.

#### dRic2

Gold Member
Ok, this is clear. But let's take the example of an ideal gas expanding in a piston against atmospheric pressure: how do I get from $\int_S p(\mathbf v \cdot n)dS$ to $-P_{ext}\frac{dV}{dt}$ ? Is my method wrong ?

#### Chestermiller

Mentor
Ok, this is clear. But let's take the example of an ideal gas expanding in a piston against atmospheric pressure: how do I get from $\int_S p(\mathbf v \cdot n)dS$ to $-P_{ext}\frac{dV}{dt}$ ? Is my method wrong ?
By Newton's third law, the force exerted by the gas on the inside face of the piston (its surroundings), pA, is equal to the force exerted by the inside face of the piston on the gas, denoted $P_{ext}$A. So, at the piston face portion of the boundary surrounding the control volume, $$p=P_{ext}$$ assumed uniform on the piston face. So, in this case $p(=P_{ext})$ comes out of the integral. The remainder of the integral represents the rate of volume being swept out by the piston movement (since the tangential component of velocity is zero at the piston surface).

#### dRic2

Gold Member
Thank you!

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

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving