BIEN/CENG 2310 MODELING FOR CHEMICAL AND BIOLOGICAL ENGINEERING HONG KONG UNIVERSITY OF SCIENCE AND TECHNOLOGY, FALL 2021 HOMEWORK #6 (DUE OCT. 30, 2021) 1. A barge carrying chemical wastes, sitting in the middle of a narrow canal, leaked a toxic chemical to the water due to an accident. We would like to know the concentration profile of the chemical at different distances from the barge, over time. As a first approximation, we will assume that the canal is shallow and narrow enough that the concentration will only vary in the x-direction. We set our space domain of interest to be – ≤ ≤ , assuming that at = ± there will no longer be any flux. We will consider two scenarios: (i) the fixed amount of chemical is leaked in one instant, resulting in an initial concentration of within the region – ≤ ≤ , and no more chemical is leaked afterwards; and (ii) the chemical is leaked slowly and continuously, such that the concentration in – ≤ ≤ remains at indefinitely. (a) Assuming the chemical travels by diffusion (to both sides, along the x-axis) only according to Fick’s Law, write down a PDE to describe the dynamics of this process. Include also the initial conditions and boundary conditions as appropriate for scenario (i). (b) Use the method of lines to solve the PDE in Part (a) in MATLAB, allowing the user to specify , , , the time point to stop the simulation , and the diffusion coefficient . (c) Suppose there is a bulk flow of the water in the canal at velocity , which can be positive (meaning that the water is flowing in the +x direction) or negative. Thus, the chemical is transported by both diffusion and convection. Modify the PDE to account for this, and implement it in the MATLAB program, adding a new function argument for . (d) Add a new option to the program to model scenario (ii). Include a new function argument “indefinite” that takes on true/false value in the function definition, so that the user can opt for this indefinite leak scenario. + − 0 + − DELIVERABLES: Parts (a) and (b) will be done in class as a demo. Modify the provided program toxicLeakCanal.m to add the new options in Parts (c) and (d). Rename it “toxicLeakCanal_
_.m”. Test your program
thoroughly, and submit three 3-D surface plots to illustrate the various dynamics of the system for
parameters of your choice. Your plots should include titles with your name, and the parameters
used.
2. In the lecture video, we modeled heat transfer within a cylindrical metal rod by dividing it
into 3 pieces along its length, each assumed to have uniform temperature within it. We also
learned about the “no flux” boundary condition, which specifies that the temperature
gradients at the two ends of the rods are zero. This leads to the following system of ODEs:
1
=
(
−21 + 2
2
)
=
(
−1 − 2 + +1
2
) = 2, 3, 4, … , − 1
=
(
−1 −
2
)
where is the thermal conductivity of the metal, is the mass density, is the heat capacity
of the metal, and = / is the length of each piece.
(a) As mentioned, the solution will be more accurate if we divide into smaller pieces. Write a
MATLAB program that can simulate the same problem for pieces, which can have
different initial temperatures. The user will specify the initial temperatures of all the
pieces (counting from the left end to the right end) in a vector of elements, the thermal
diffusivity = /(), and the total length of the rod . Assume that all pieces have the
same length and mass, the thermal diffusivity is uniform everywhere, and there is no heat
exchange with the surroundings. Apply the “no flux” boundary conditions on the two
ends. Stop the simulation when the temperature of all pieces becomes steady, and plot the
temperature versus time profiles of all pieces in one plot. Your function should have the
following definition:
function [] = heatRod__(alpha, L, Tinit)
Your program should expect that Tinit is a column vector of elements, each element
containing the initial temperature of one piece.
Note: You may realize that by posing the problem this way, our MATLAB program is exactly
the same as if we try to solve the PDE with the “method of lines” using nodes:
=
(
2
2
)
(b) Suppose we now put a heat source on the left end of the rod, such that there is a constant
heat flux, , going into the rod. At steady state, the same amount of heat would flow out
of the rod per unit time. Modify the program to account for the following two possibilities.
You may still assume that temperature only varies along the length of the rod, and not
radially.
(i) The curved surface along the length of the rod is insulated, such that the only heat loss
will be on the right end of the rod, with heat flux equal to . Your function definition
should be:
function [] = heatRodAxialFlow__(alpha, L,
Tinit, phi)
where phi is a combined parameter, = ()⁄ . You should see this combination
emerge when you write the energy balance equation.
(ii) There is heat loss from the curved surface along the rod, with the heat flux, ,
modeled by Newton’s Law of cooling:
= ℎ( − )
where ℎ is the heat transfer coefficient (a constant), is the temperature of the rod at
that location, and is the temperature of the environment. Because the rod is long,
we can assume that most heat is lost radially in this way, and that the “no flux”
condition still applies for the right end of the rod. Your function definition should be:
function [] = heatRodRadialFlow__(alpha, L,
Tinit, phi, Tenv, beta)
where beta is a combined parameter, = 2ℎ ()⁄ ; is the radius of the rod. You
should see this combination emerge when you write the energy balance equation.
DELIVERABLES:
Submit the three required MATLAB programs “heatRod__.m”, for
Part (a), “heatRodAxialFlow__.m” for Part (b) (i) and
“heatRodRadialFlow__.m” for Part (b) (ii).
Also submit a typewritten or scanned handwritten write-up to show how you derive the ODEs.
Include some plots of each of the 3 cases to show the dynamics of the system.
学霸联盟