Chapter 2 - The Recipe To Build A Mathematical Model: Profa. Lilane Lona - em Revisão

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Profa.

Lilane Lona – Em revisão

Chapter 2 – The Recipe to Build a Mathematical Model


Most chemical engineering students feel a shiver down the spine when they see a set of
complex mathematical equations generated from the modeling of a chemical engineering
system. This is because theyusually do not understand how to achieve this mathematical
model, or theydo not know how to solve the equations system without spending a lot of time
and effort.

Trying to understand how to generate a set of mathematical equations to represent a physical


system (to model) and solve these equations (to simulate) is not a simple task. A model, most
of the time, takes into account all phenomena studied during a Chemical Engineering course
(mass, energy and momentumtransfer, chemical reactions, etc.). In the same way, there is a
multitude of numerical methods that can be used to solve the same set of equations
generated from the modeling, and many different computational languages can be adopted to
implement the numerical methods.As a consequence of thiscomprehensiveness and
combinatorial explosion of possibilities, most books that deal with this subject are very
extensive andembracing, making need for a lot of time and effort to go through this subject.

This book tries dealing with this modeling and simulation issue in a simple, fast and friendly
way, using what you already know or what you can intuitively or easily understand to build
step by step a model, and after that,to solve it using Excel, a very friendly and widely used tool.

This chapterstarts showing that, even if you are a lower undergraduate student, you already
known how to do mental calculations to model and simulate simple problems. To prove that,
let us imagine a cylindrical tank initially with 10m3 of water. Let us also imagine that the input
and output valves in this cylinder operate at the same volumetric flow rate (2m3/h), as shown
in Figure 2.1. Assume that the density of water keeps constant all the time.

3
2 m /h

Initialvolume = 10m 3

3
2 m /h

Figure 2.1 – Tank with water

The first question is: Two hours later, what is the volume of water inside the tank? If you say
10m3, you are correct. The flow rate that enters the tank is equal to the flow rate that exits
(2m3/s), so, the volume of water in the tank keeps constant (10m3).

Now, if the input volumetric flow rate changes to 3m3and the flow rate in the exit keeps 2m3/s,
what is the volume of water in the tank after two hours? If you correctly say 12m3, is because
you mentally develop a model to represent this tank and after that you simulate it. When the

1
Profa. Lilane Lona – Em revisão
inflow rate becomes 3m3/h, by inspection one can conclude easily that the volume of water
will increase 1m3 per hour.

Unfortunately, you only know how to do mental modeling and simulation if the problem is
very simple. In order to understand how to model and simulate complex systems, let us try to
understand what was mentally done for this simple example and transform that into a step by
step procedure, robust enough to successfully work also for very complex systems.

2.1 – Three fundamental concepts used for modeling


In order to build a mathematical model, three fundamental conceptshave to be presented:

1 ) Conservation Law: The conservation law says that what enters the system (E), minus what
leaves the system (L), plus what is generated in the system (G), minus what is consumed (C) in
the system is equal to the accumulation in the system(A). Or:

A=E–L+G–C

The accumulation is the variation that occurs in a period of time. This accumulation can be
positive or negative, i.e., if what enters plus what is generated in the system is greater than
what leaves plus what is consumed in this system, there is a positive accumulation. Otherwise,
there is a negative accumulation.

In practical terms, when developing mass and energy balances, terms of generation and / or
consumption can exist if there are chemical reactions. For example, there is energy generation
if there is an exothermic chemical reaction, which will result in an increase of temperature.

2 ) Control volume: The control volume is the volume in which the model is developed and the
conservation law is applied. All properties (concentration,temperature, density, etc.) have to
be the same inside the controlvolume. In the example of the tank presented previously, all
properties do not change with the position inside the tank (lumped-parameterproblem), sothe
control volume is the entire tank.

3 ) Infinitesimal variation of the dependent variable with the independent variable:Imagine that
a dependent variable yvaries with x(independent variable)according to the function shown in
Figure 2.2. Also, imagine that at an initial condition x0 the initial value of y is y0. To estimate the
value of the dependent variable y after an infinitesimal increment of x ( ∆ x), one can draw a
tangent line to the curve starting from the point (x0, y0), as shown in the Figure 2.2.

2
Profa. Lilane Lona – Em revisão

Figure 2.2: Variation of the dependent variable ywiththe independent variablex.

The tangent line reaches v1 at x = x1 (x1=x0+ ∆ x). If the increment ∆ x is sufficiently small, it
follows that y1 ~ v1 and it is possible to obtain the value of y1using the tangent of α :

y1 − y0 dy dy
tan α = = |x0 , y0 so y1 = y0 + ∆x |x0 , y0
x1 − x0 dx dx

or generalizing: dyi
yi +1 = yi + ∆x (2.1)
dx

The Equation (2.1) could be also obtained using the two first terms of a Taylor series
expansion:

dyi 1 d 2 yi 1 d 3 yi 1 d 4 yi
yi +1 ≅ yi + ∆x + 2
( ∆x) +
2
3
( ∆x) +
3
4
(∆x) 4 + ...
dx 2! dx 3! dx 4! dx

2.2 – The recipe for the development of a model


Keeping in mind the three fundamental concepts presented in section 2.1, let us build a step
by step procedure (a recipe) to model the tank presented previously. Thisprocedure, created
to model this simple system, will be the same used along the entire book, in order to solve
problems more and more complex.

As said before, the entire tank must be considered as the control volume, because we are
dealing with a lumped-parameter problem. The dashed line of figure 2.3showsthe control
volume considered in this case.

3
Profa. Lilane Lona – Em revisão

3
3 m /h

Initial volume = 10m 3

3
2 m /h

Figure 2.3: Tank with water

The application of the conservation law in the control volumeyields the expression presented
as follow (observe there is neither generation nor consumption of water):

A=E–L

The E and L terms can be easily obtained, since the flow rate that enters and leaves the tank
are knew (3m3/h and 2m3/h respectively), however how the accumulation term canbe
obtained?

In order to obtain the accumulation term,we can use the concept of the infinitesimal variation
of the dependent variable with the independent variable. So, if we say that for a time tthe
mass of water in the tank in M(kg), after an infinitesimal period in time (∆t) the mass of water
𝑑𝑑𝑑𝑑
in the tank willbe𝑀𝑀 + ∆𝑡𝑡(kg)(see analogy with equation 2.1). The table below summarized
𝑑𝑑𝑑𝑑
this information.

t t + ∆t Dimension
𝑀𝑀 𝑑𝑑𝑑𝑑 kg
𝑀𝑀 + ∆𝑡𝑡
𝑑𝑑𝑑𝑑

The amount of water that accumulatedin the tank in a period of time∆𝑡𝑡 is the mass of waterin
the time𝑡𝑡 + ∆𝑡𝑡 minus the mass of water in the time t, so:
𝑑𝑑𝑑𝑑
Accumulation = 𝑀𝑀 + ∆𝑡𝑡 – M, or
𝑑𝑑𝑑𝑑

𝑑𝑑𝑑𝑑
A= ∆𝑡𝑡 (kg)
𝑑𝑑𝑑𝑑

Since the mass is equal to the density times the volume (M = ρV) and the density keeps
constant, the accumulation term can be written as:
𝑑𝑑𝑑𝑑
A = 𝜌𝜌 ∆𝑡𝑡 (kg)
𝑑𝑑𝑑𝑑

A very important tool to check if a model is correct is to do a dimensional analysis in all terms
of the conservation law equation.

4
Profa. Lilane Lona – Em revisão
If we calculate how much water accumulated in the tank in a period of time ∆𝑡𝑡, we have to
consider how much water enters and leaves the tank in this same interval of time (∆𝑡𝑡). So in a
period of time ∆𝑡𝑡, the amount of water that enters and leaves the tank is:

E = 3 (m3/h) ρ (kg/m3)∆𝑡𝑡 (h) → E = 3 ρ∆𝑡𝑡 (kg)

L = 2 (m3/h) ρ (kg/m3) ∆𝑡𝑡 (h) →S = 2 ρ∆𝑡𝑡 (kg)

So, applying the conservation law for a period of time ∆𝑡𝑡 yields:

dV
3ρ∆t (kg ) - 2 ρ∆t (kg ) = ρ ∆t (kg ) (2.2)
dt

Enters (E)Leaves (L)Accumulation (A)

Observe that the density (ρ)can be simplified in this equation, so, when the density keeps
constant, we can directly do the volume balance (instead of mass balance). In this case, the
accumulation term as well as the terms E and Lcould be obtained as shown below:

t t + ∆t Accumulation Dimension
𝑉𝑉 𝑑𝑑𝑑𝑑 𝑑𝑑𝑑𝑑 m3
𝑉𝑉 + ∆𝑡𝑡 ∆𝑡𝑡
𝑑𝑑𝑑𝑑 𝑑𝑑𝑑𝑑

E = 3 (m3/h) ∆𝑡𝑡 (h) → E = 3 ∆𝑡𝑡 (m3)

L = 2 (m3/h) ∆𝑡𝑡 (h) → S = 2 ∆𝑡𝑡 (m3)

So the balance becomes:

dV
3∆t (m 3 ) - 2∆t (m 3 ) = ∆t (m3 ) (2.3)
dt

Enters (E)Leaves (L)Accumulation (A)

Observe that Equations2.2and 2.3 are the same, and after simplifying terms yields:
𝑑𝑑𝑑𝑑
= 1 (2.4)
𝑑𝑑𝑑𝑑

Equation 2.4 represents the model for this simple system. Completed the modeling stage, we
need to do the simulation, which is nothing more than solve,by analytical or numerical
methods,the equations generated from the modeling. In our case, as the system is greatly
simplified, a single and very simple Ordinary Differential Equation (ODE) is generated from the
modeling and it will be solved by direct integration.

To solve this ODE one boundary or initial condition is necessary. In our case, we know that in
the beginning of the operation, the volume of water in the tank is 10m3. So, the initial
condition is:

At t = 0, V = 10m3

5
Profa. Lilane Lona – Em revisão
Solving the equation (2.4) using the initial conditions yields:

V = 10 + t(2.5)

Equation (2.5) shows how the volume of liquid in the tank varies with time, being possible to
predict, for example, the time it takes for the liquid overflow the tank (observe also that the
equation says that after 2 hours, the volume of water is 12m3, as predicted previously).

The procedure adopted for this simple example will be used for now one for examples more
and more complex.

Proposed problem:

1 ) Develop a model for the system presented previously, but consider that the flow rate of
water that leaves the tank (Qout m3/s) depends on the level of the water (h) inside the tank, in
the way: Qout = 1 + 0.1h (m3/s). This can be a real situation because as the column of water
increases, the pressure on the exit point also increases, and consequently the exit flow rate
becomes bigger. Assumingthe initial volume of waterinside the tank equal to 10m3and the
cross section area of the tank equal to1 m2, the initial level of water is 10m, so inthe beginning,
the flow rate that leaves the tank (Qout) is equal to 2m3/s. In the beginning, the input flow rate
is equal to 2m3/s, so the volume of water keeps constant, in a steady state regime. If for some
reason the inflow rate varies from 2 to 3 m3/s, develop a mathematical model to represent
how the level of water inside the tank varies with time. Define the initial condition needed to
solve the equation generated from the modeling.

You might also like