Concurrent/Countercurrent Flow
For Summer 1997 Envision-It! Workshop

The problem, as outlined by David Misemer, 3M, is to transfer material from a "source" stream to a "sink" stream which are separated by a semi-permeable membrane. In the concurrent flow case, these two streams are traveling in the same direction, and in the countercurrent case, they are traveling in opposite direction.

     -----------------------------------------------------------------------------
    |  MSrce(1)  |  MSrce(2)  |  MSrce(3)  |  MSrce(4)  |  MSrce(5)  |  MSrce(6)  | ->
     -----------------------------------------------------------------------------
     -----------------------------------------------------------------------------
    |  MSink(1)  |  MSink(2)  |  MSink(3)  |  MSink(4)  |  MSink(5)  |  MSink(6)  | ->
     -----------------------------------------------------------------------------
Material starts out with some initial concentration in cell MSrce(1) with some maximum value VMax. At each iteration, the material flows from MSrce(i) to MSink(i) where i runs from 1 to 6 in this case. The diffusion from one stream to another is based dependent on the relative concentrations of material in the two streams. One way to parameterize this would be the following:
dm = k(pSrce- pSink)
Where the relative concentrations pSrce and pSink are given by
pSrce=MSrce/VSrce
pSink=MSink/VSink
MSrceAmount of material at each cell in the source stream
MSinkAmount of material at each cell in the sink stream
kDiffusion Constant from one stream to other (start with k=0.1)
VSrceRelative Volume Flow rate (start with VSrce=1)
VSinkRelative Volume Flow rate (start with VSink=1)
dm Amount of material transfered from source cells to sink cells

After moving this material from the source to sink, we move the two streams by one cell to the right with the leftmost element of MSrce set to VMax and the leftmost element of MSink set to 0. We can now repeat this process.

This is somewhat similar to the One-Dimensional Diffusion Model which we studied earlier. You may want to modify your diff1.m or diff1b.m scripts to model this problem.

We will model this with the following algorithm:

  1. Initialize two arrays MSrce and MSink to be all zeros using
    MSrce = zeros(ncells,1);
    where ncells is the number of cells (start with about 25)
  2. Set the first element of MSrce to MSrce(1)=VMax; where VMax=100 is the initial concentration of the source stream
  3. Set the volume flow rates VSrce and VSink to be 1 (these can be modified to allow for different flow rates in each of the two streams).
  4. Perform a loop a total of NTimes which does the following:
  5. The mass transfered from the source to sink stream for each cell is
    dm = k*(MSrce/VSrce-MSink/VSink);
  6. Subtract this amount from MSrce and add this to MSink
  7. Shift the MSrce array one cell to the right and append VMax in the following way
    MSrce = [VMax ; MSrce(1:ncells-1)];
  8. Perform the same shift for MSink but appending a 0 on the left.
  9. Make a plot showing MSrce and MSink
  10. Repeat the loop from step 4 above
Try to construct this script file yourself. If you are stuck, you can refer to the script difflow.m

You can model countercurrent flow by shifting the 2nd through ncells element of MSink to the left by one cell and appending a 0 on the right.
There are many questions we can explore using this model. These include (but are not limited to)
  1. If the most material is to be transfered out of the source stream, is it better to have VSrce greater than, equal to, or less than VSink?
  2. Is it better to have concurrent or countercurrent flow?
  3. What is the effect of changing the diffusion constant k for both concurrent and countercurrent flow?
  4. What is the effect of changing the number of cells ncells for both concurrent and countercurrent flow?

To allow you to visualize the results in different ways, after each iteration you may want to append each successive concentration distribution after each onto a master array using, for example:
AllMSrce = [AllMsrce MSrce];
then by slicing this array in different ways, we can either plot the concentration versus time at some position, or the concentration versus position at some time, or make a surface plot showing concentration versus position versus time. (for more info, you may want to look at how we did this for the 1-D diffusion model or see the answers in difflow2.m, valmovi2.m, plotloc2.m and valsurf.m
Electronic Copy: http://physics.gac.edu/~huber/envision/flow/
Created: 14-JUL-97 by Tom Huber, Physics Department, Gustavus Adolphus College.