ORDINARY DIFFERENTIAL EQUATIONS POWERTOOLLesson 5 -- Application: Mixing ProblemsProf. Douglas B. MeadeIndustrial Mathematics InstituteDepartment of MathematicsUniversity of South CarolinaColumbia, SC 29208
URL: http://www.math.sc.edu/~meade/E-mail: meade@math.sc.eduCopyright \251 2001 by Douglas B. MeadeAll rights reserved-------------------------------------------------------------------<Text-field layout="Heading 1" style="Heading 1">Outline of Lesson 5</Text-field>5.A One-Tank Mixing Problem5.B Variable Volume Mixing Problem5.C Two-Tank Mixing Problem<Text-field layout="Heading 1" style="Heading 1">Initialization</Text-field>restart;with( DEtools ):with( plots ):with( PDEtools ):<Text-field bookmark="5.A" layout="Heading 1" style="Heading 1">5.A One-Tank Mixing Problem</Text-field><Text-field layout="Heading 2" style="Heading 2">Problem Statement</Text-field>A tank initially contains 40 gal of sugar water having a concentration of 3 lb of sugar for each gallon of water. At time zero, sugar water with a concentration of 4 lb of sugar per gal begins pouring into the tank at a rate of 2 gal per minute. Simultaneously, a drain is opened at the bottom of the tank so that the volume of the sugar-water solution in the tank remains constant.(a) How much sugar is in the tank after 15 minutes?(b) How long will it take the sugar content in the tank to reach 150 lb? 170 lb?(c) What will be the eventual sugar content in the tank?<Text-field layout="Heading 2" style="Heading 2">Solution</Text-field>The mathematical formulation of this problem must express the physical requirement thatNiMqJiUiZEciIiIlI2R0RyEiIg== ( amount of sugar in tank) = ( rate sugar is added to tank ) - ( rate sugar is removed from tank ) Let NiMtJSJ4RzYjJSJ0Rw== denote the amount of sugar (pounds) in the tank at time NiMlInRH (minutes). Then, the rates in and out are respectivelyrate_in := 4 * 2;rate_out := (x(t)/40) * 2;so that the governing ODE isode := diff( x(t), t ) = rate_in - rate_out;The amount of sugar in the tank initially, that is, when NiMvJSJ0RyIiIQ==, gives the initial conditionic := x(0)=40 * 3;The ODE in this IVP is first-order and linear. The integrating factor ismu(t) = intfactor( ode );The solution to the IVP issol := dsolve( { ode, ic }, x(t), [linear] );<Text-field layout="Heading 3" style="Heading 3">(a)</Text-field>The amount of sugar (in pounds) in the tank after 15 minutes iseval( sol, t=15. );<Text-field layout="Heading 3" style="Heading 3">(b)</Text-field>The tank will contain 150 pounds of sugar at a time NiMlInRH (in minutes) satisfyingeq150 := eval( sol, x(t)=150 );Thus, the desired time is found by the calculationst150 := solve( eq150, t ):t[`150 lbs`] = t150;`` = evalf(t150);Repeating the same steps for the time when 170 pounds of sugar are in the tank leads to the equationeq170 := eval( sol, x(t)=170 );whose solution ist170 := solve( eq170, t ):t[`170 lbs`] = t170;
`` = evalf(t170);
This complex-valued solution is clearly not physically realistic. A quick inspection of the solution, graphed in Figure 5.1,plot( rhs(sol), t=0..120, title="Figure 5.1" );shows that the amount of sugar in the tank reaches a steady-state limit that is well below 170 pounds. Therefore, at no time is there ever 170 pounds of sugar in the tank.<Text-field layout="Heading 3" style="Heading 3">(c)</Text-field>In (b) it was noted that the amount of sugar in the tank levels off below 170 pounds. The exact limit can be determined from the solution by looking at the limit as NiMlInRHNiMsJCUiPkchIiI=NiMlKWluZmluaXR5Rw==, that is, atsteady_state := map( Limit, sol, t=infinity );whose value isvalue( steady_state );Note that NiMvJSJ4RyIkZyI= is an equilibrium solution for this ODE. However, be careful to avoid the common error of concluding that the limit is 160 pounds because NiMvJSJ4RyIkZyI= is an equilibrium solution. (Recall the logistic growth model, Lesson 3, Section B , which has two equilibria.)<Text-field bookmark="5.B" layout="Heading 1" style="Heading 1">5.B Variable Volume Mixing Problem</Text-field><Text-field layout="Heading 2" style="Heading 2">Problem Statement</Text-field>Consider the previous problem, except that the outflow from the tank is at a rate of 3 gallons per minute.(a) Find the formula for the volume of sugar water in the tank at any time. When is the tank empty?(b) Find the IVP for the amount of sugar in the tank.(c) Find the IVP for the concentration of sugar in the water.(d) When is the tank empty? What is the concentration of sugar immediately before the tank is empty? How much sugar is in the tank at this time?(e) Plot the amount of sugar and concentration of sugar in the tank up to the time the tank becomes empty. What happens to these solutions at later times?<Text-field layout="Heading 2" style="Heading 2">Solution</Text-field><Text-field layout="Heading 3" style="Heading 3">(a)</Text-field>The volume starts at 40 gallons. Every minute 2 gallons of sugar water are added to the tank and 3 gallons are removed; the net change is a loss of 1 gallon per minute. The rates "in" and "out" are respectivelyVrate_in := 2;Vrate_out := 3;so the time-varying volume in the tank isV := 40 + (Vrate_in-Vrate_out)*t;Note that NiMtJSJWRzYjJSJ0Rw== is the solution of the IVPodeV := diff( v(t), t ) = 2 - 3;icV := v(0) = 40;as confirmed viadsolve( { odeV, icV }, v(t), [separable] );<Text-field layout="Heading 3" style="Heading 3">(b)</Text-field>The IVP for the amount of sugar in the tank is similar to the one in the previous example. There is no difference in the rate at which sugar enters the tank. The concentration of sugar exiting the tank is NiMqJi0lInhHNiMlInRHIiIiJSJWRyEiIg== and this is different because NiMvJSJWRy1GJDYjJSJ0Rw== is no longer constant. The rates "in" and "out" are now respectivelySrate_in := rate_in;Srate_out := (x(t)/V) * 3;Thus, the governing ODE isode2 := diff( x(t), t ) = Srate_in - Srate_out;The initial condition is unchanged:ic2 := ic;<Text-field layout="Heading 3" style="Heading 3">(c)</Text-field>The IVP for the concentration of sugar in the tank is obtained from the ODE in (b) and the definition of the concentration, NiMtJSJjRzYjJSJ0Rw==, which isconc_eq := c(t) = x(t)/'V';Rather than deriving the differential equation for NiMtJSJjRzYjJSJ0Rw== manually, the dchange command from the PDEtools package will be used to automate the process. It givesodeC := dchange( x(t) = c(t)*V, ode2, [c] );The initial condition for the concentration isicC := c(0) = 3;<Text-field layout="Heading 3" style="Heading 3">(d)</Text-field>The tank is empty when the volume of sugar water is zero. This occurs after 40 minutes, as obtained byt_empty := solve( V=0, {t} );The concentration is found by solving the (linear) IVP found in (c), which is done viasolC := dsolve( { odeC, icC }, c(t), [linear] );Thus, the concentration at the instant the tank empties issubs( t_empty, solC );The amount of sugar in the tank as the tank empties is obtained by evaluating the solutionsol2 := dsolve( {ode2,ic2}, x(t), [linear] );at the time the tank empties. This givessubs( t_empty, sol2 );which is exactly what one would expect. (If not, think about it!)<Text-field layout="Heading 3" style="Heading 3">(e)</Text-field>The requested plots areplot( rhs(sol2), t=0..40, title=`Amount of sugar` );and plot( rhs(solC), t=0..40, title=`Concentration of sugar` );The concentration remains positive until NiMvJSJ0RyIkPyI= , but after NiMvJSJ0RyIjUw==, the volume and amount of sugar become negative. Even though the IVPs have solutions for all time, for NiMqKCUidEciIiIlIj5HRiUiI1NGJQ== these results are not physically meaningful.<Text-field bookmark="5.C" layout="Heading 1" style="Heading 1">5.C Two-Tank Mixing Problem</Text-field><Text-field layout="Heading 2" style="Heading 2">Problem Statement</Text-field>Two tanks, tank I and tank II, are filled with NiMlIlZH gal of pure water. A solution containing NiMlImFH lb of salt per gallon is poured into tank I at a rate of NiMlImJH gal per minute. The solution leaves tank I at a rate of NiMlImJH gal/min and enters tank II at the same rate (NiMlImJH gal/min). A drain is adjusted on tank II and the solution leaves tank II at a rate of NiMlImJH gal/min. This keeps the volume of solution constant in both tanks (NiMlIlZH gal). Show that the amount of salt solution in tank II, as a function of time t, is given byNiMsKComJSJhRyIiIiUiVkdGJkYmKipGJUYmJSJiR0YmJSJ0R0YmLSUkZXhwRzYjLCQqKEYpRiZGJyEiIkYqRiZGMEYmRjAqKEYlRiZGJ0YmRitGJkYw.NOTE: This is Exercise 14 (p. 73) from Differential Equations, by Polking, Boggess, and Arnold (Prentice-Hall, 2001).<Text-field layout="Heading 2" style="Heading 2">Solution</Text-field>Let NiMtJSJ4RzYjJSJ0Rw== and NiMtJSJ5RzYjJSJ0Rw== denote the amount of salt, in pounds, in tanks I and II, respectively, at time NiMlInRH. The initial conditions for the two tanks are respectivelyicI := x(0) = 0;icII := y(0) = 0;The "rate in" for tank I is NiMlImFH lb/gal * NiMlImJH gal/min and the outflow is NiMqJi0lInhHNiMlInRHIiIiJSJWRyEiIg== lb/gal at a rate of NiMlImJH gal/min. Therefore, the ODE governing the amount of salt in tank I isunassign('V');odeI := diff( x(t), t ) = a*b - b*(x(t)/V);For tank II, the inflow is the same as the outflow from tank I and the outflow exactly matches the inflow. Thus, the ODE governing the amount of salt in tank II isodeII := diff( y(t), t ) = b*(x(t)/V) - b*(y(t)/V);The first equation in this pair is independent of the variable NiMtJSJ5RzYjJSJ0Rw==. Hence, it can be solved first for NiMtJSJ4RzYjJSJ0Rw==, and that result substituted into the second equation, making the second equation depend only on NiMtJSJ5RzYjJSJ0Rw==. In general, both equations of a system will contain both variables, and the equations will then be coupled. Solution techniques for such systems will be developed in succeeding lessons.In this example, the first equation is a first-order linear ODE with integrating factormu[1](t) = intfactor( odeI );The solution to the IVP for tank I is thereforesolI := dsolve( {odeI,icI}, x(t), [linear] );To find the amount of salt in tank II, substitute the solution for tank I into the ODE for tank II, obtainingodeIIa := subs( solI, odeII );Despite the somewhat complicated appearance of this ODE, note that it is linear, as is verified byodeadvisor( odeIIa );The integrating factor is then found to bemu[2](t) = intfactor( odeIIa );The solution to the IVP for tank II issolII := dsolve( {odeIIa,icII}, y(t), [linear] );Thus, the amount of salt in tank II at any time NiMlInRH, isexpand( solII );[Back to ODE Powertool Table of Contents]