Docsity

Compartmental Analysis-Modeling and Simulation-Lecture Handouts, Lecture notes of Mathematical Modeling and Simulation

Toggle sidebar
bg1
1CIS308‐ModelingandSimulation
Handout#11
CompartmentalAnalysis
Amulti‐compartmentmodelisatypeofmathematicalmodelusedfordescribingthewaymaterialsor
energiesaretransmittedamongthecompartmentsofasystem.Eachcompartmentisassumedtobea
homogenousentitywithinwhichtheentitiesbeingmodeledareequivalent.Thecompartmentalanalysis
modelsareusedinmanyfieldsincludingpharmacokinetics,epidemiology,biomedicine,systemstheory,
complexitytheory,engineering,physics,informationscienceandsocialscience.
MathematicalModel
A20‐quartjuicedispenserinacafeteriaisfilledwithajuicemixturethatis10%mangojuiceand90%
cranberryjuice.Anorange‐mangoblendisenteringthedispenseratarateof4quartsanhourandthe
well‐stirredmixtureleavesatthesamerate.Theorange‐mangoblendis50%orangeand50%mango.
(a)ModelthesituationwithadifferentialequationwhosesolutionisM=M(t),thenumberof
quartsofmangojuiceinthecontainerattimet.Includetheinitialcondition.Sketchthesolution
curve,indicatingthelong‐runbehaviorofM.
(b)ModelthesituationwithadifferentialequationwhosesolutionisC(t),thenumberofquartsof
cranberryjuiceinthecontainerattimet.Includeaninitialcondition.
(c)Supposethatoncethepercentageofmangojuiceinthemixturereaches30%,highenoughto
beirresistible,therateofjuiceconsumptionincreasesto5quartsperhourwhiletherateatwhich
thecontainerisbeingfilledremainsat4quartsanhour.Revisethedifferentialequationinpart(a)
toreflectthesituation.Resettheclocktodenotebyt=0themomentatwhichtheconsumption
rateincreases.
Thebasicstructureforourmodelisrateofchange=ratein‐rateout.Morespecifically,
rateofchange
ofmangojuice=
rateatwhich
mangojuiceenters‐
rateatwhich
mangojuiceleaves
Theleft‐handsideoftheequationis
dt
dM withunitsquartsofmangojuiceperhour.Therateinandrate
outmustalsobemeasuredinquartsofmangojuiceperhour.
Ratein:Amixtureisenteringatarateof4quartsofmixturehour.Halfofthisismangojuice,somango
juiceisenteringatarateof2quartsofmangojuiceperhour.
Rateout:Themixtureisleavingatarateof4quartsofmixturehour,butwhatfractionofthisexiting
juiceismangojuice?Sincethejuiceinthecontaineriswellmixed,thefractionisthesameastheratio
ofmangojuicetomixtureinthecontainer.Theamountofmangojuiceinthecontainerchangeswith
time;itisgivenbyM(t).Theamountofmixtureinthedispenserremainsconstantat20quarts(because
therateatwhichjuiceisenteringisequaltotheratethatjuiceisleaving).
docsity.com
pf3
pf4
pf5

Partial preview of the text

Download Compartmental Analysis-Modeling and Simulation-Lecture Handouts and more Lecture notes Mathematical Modeling and Simulation in PDF only on Docsity!

Handout#

Compartmental Analysis

A multi‐compartment model is a type of mathematical model used for describing the way materials or energies are transmitted among the compartments of a system. Each compartment is assumed to be a homogenous entity within which the entities being modeled are equivalent. The compartmental analysis models are used in many fields including pharmacokinetics, epidemiology, biomedicine, systems theory, complexity theory, engineering, physics, information science and social science.

Mathematical Model

A 20 ‐quart juice dispenser in a cafeteria is filled with a juice mixture that is 10% mango juice and 90% cranberry juice. An orange‐mango blend is entering the dispenser at a rate of 4 quarts an hour and the well‐stirred mixture leaves at the same rate. The orange‐mango blend is 50% orange and 50% mango. (a) Model the situation with a differential equation whose solution is M=M(t), the number of quarts of mango juice in the container at time t. Include the initial condition. Sketch the solution curve, indicating the long‐run behavior of M. (b) Model the situation with a differential equation whose solution is C(t), the number of quarts of cranberry juice in the container at time t. Include an initial condition. (c) Suppose that once the percentage of mango juice in the mixture reaches 30%, high enough to be irresistible, the rate of juice consumption increases to 5 quarts per hour while the rate at which the container is being filled remains at 4 quarts an hour. Revise the differential equation in part (a) to reflect the situation. Reset the clock to denote by t=0 the moment at which the consumption rate increases.

The basic structure for our model is rate of change = rate in ‐ rate out. More specifically, rate of change of mango juice =

rate at which mango juice enters ‐

rate at which mango juice leaves

The left‐hand side of the equation is dt

dM (^) with units quarts of mango juice per hour. The rate in and rate

out must also be measured in quarts of mango juice per hour.

Rate in: A mixture is entering at a rate of 4 quarts of mixture hour. Half of this is mango juice, so mango juice is entering at a rate of 2 quarts of mango juice per hour.

Rate out: The mixture is leaving at a rate of 4 quarts of mixture hour , but what fraction of this exiting juice is mango juice? Since the juice in the container is well mixed, the fraction is the same as the ratio of mango juice to mixture in the container. The amount of mango juice in the container changes with time; it is given by M(t). The amount of mixture in the dispenser remains constant at 20 quarts (because the rate at which juice is entering is equal to the rate that juice is leaving).

Now we can set up the differential equation. rate of change of mango juice = rate in of mango juice – rate out of mango juice

M M

dt

dM

M

dt

dM

The equilibrium solution is the value of M for which (^) = 0. dt

dM

M

M

We know that the solution curve through (0, 2) is concave down because its slope, given by 2 ‐0.2M decreases for M∈(0, 10). In the long run the amount of mango juice in the container will approach 10 quarts. This makes sense, because the juice in the container will eventually look like the incoming juice; it will eventually be half mango juice and half orange juice.

(b) Let C=C(t) be the number of quarts of cranberry juice in the container at time. rate of change = rate in ‐ rate out

(c) From t= 0 on the number of quarts of juice in the dispenser goes down by 1 quart every hour. rate of change = rate in ‐ rate out The rate in remains at 2 quarts of mango juice per hour but the rate out must be recalculated.

Therefore,

t

M

dt

dM

2. The initial condition is M(0)=.3(20)=6.

Tank 2 Mass Balance Setting up a similar mass balance for the salt in Tank 2 gives

m 2 = q ( C 1 − C 2 )−−−−( 5 )

dt

d

where again, we have assumed well‐mixed tanks. Here the concentration leaving Tank 1, C 1 , enters Tank 2, and C 2 is the average (and exit) concentration in Tank 2. Writing the concentrations as mass/volume,

1 1

2 2

2

2 2

1 1

2

2 1 2

m

V

m q

V

m q

dt

d

m

V

q

m

V

q

m

dt

d

m qC C

dt

d

This is a linear first order ODE with an integrating factor given by

2 V 2 dt qt V

q

IF e = e

Multiplying eq.6 wit the integrating factor,

1 1

2 2 2

2 2 2 Ve 2 m

e m q

dt

m d

V

m q

dt

e d V

qt V

qt V

qt

Integrating both sides of this expression gives

e m t dt

V

e m q V

qt V

qt

1 (^ )

1

m 1 (t) is given explicitly by eqn. (3). Thus, we have

e dt

V

qm

e m

Vqt qV V t

⎟⎟⎠ ⎞ ⎜⎜⎝ ⎛ (^) −

1 1

1

10 2

Simplifying, we get

e e c

V V

m V

e c

qV V

VV

V

e dt qm

V

e m qm

V

qt V

qt

Vqt qVVVV t qVVVV t

⎟⎟^ +

−

⎜⎜⎝⎛^ − ⎟⎟⎠⎞ ⎜⎜⎝⎛^ − ⎟⎟⎠⎞

2 1

12

1 2 12

1 2 2

1 2

10 2

1 2

12 1

10 1

2 10

Multiplying by gives

1 2

2 10 2^ V

qt V

qt

e ce

V V

m m V

− −

Applying the initial condition, t=0, m 2 (0)=m 20 =50lb^ to^ determine^ c,^ or

20 10 2 1 2

20 10 2

V V

V

c c m m

V V

V

m m

Therefore, the salt mass in tank 2 versus time is given by

( )^212

1 2

− − − V

qt V

qt V

qt

e e

V V

m t m e m V

Putting in numerical values gives

2 (^ )^50401002040 ⎥=^15040 −^10020 −−−−(^8 )

− t − t − t − t − t

m t e e e e e

What about the peak conditions in tank 2? To address the peak conditions in tank 2, we note that the maximum of m 2 (t) must occur when (^2) = 0 dt

dm (^).

Therefore, taking the derivative of eq. (7) and setting the result to zero, gives

2 1 2 1 2 1 2

2 10 2

20

− − − V

qt V

qt V

qt

e

V

q

e

V

q

V V

V

e m

V

qm

m

dt

d

We could now solve this for t = tmax, and then putting this value of t into eqn. (7) will yield m 2 max. However, this quite complicated. An alternative approach is to go back to the original balance equation given in eq. (5). With (^2) = 0 dt

dm (^) eq. (5) tells us that C 1 = C 2 at peak conditions. This makes sense physically,

since as long as C 1 > C 2 , the concentration of tank 2 should continue to increase. If C 1 < C 2 the amount of salt in tank 2 will decrease since the inflow concentration is less that the outflow concentration. Thus, clearly the peak conditions in tank 2 occur when C 1 = C 2. Thus, we have the valid relationship,

1 2

20 10 2 2

10 1

− − − − V

qt V

qt V

qt V

qt

e e

V V

m e m V

V

m e

V

at peak conditions. Well, although this alternative approach is insightful, this last expression is also complicated.