Lesson 5 - Simulating Diffusion Through a Tube
In the previous Lesson, discussed a simple model in which we wanted to simulate a tube filled with sand that is saturated with water. The tube is 1 m long and has a radius of 5 cm. We assume one end of the tube is closed (no mass can move through that end) and 1 g of mass (of species X) is instantaneously injected at that end (uniformly over the entire area). The other end of the tube is connected (through a screen that holds the sand in the tube ) to a small tank filled with water that is rapidly flushed (effectively maintaining the concentration in that tank at zero). Our goal was to simulate the rate of diffusion of X out of the far end of the tube into the tank:
To model this, we have discretized the tube into 10 “slices” represented by Cells. The total volume of each Cell is simply L*A/N (where N = 10). In the previous Lesson we worked through the process together of creating a diffusive mass flux link between the first two Cells (i.e., the first two “slices”) of the tube. In this Lesson, we will look at the completed model with all 10 Cell pathways defined and all mass flux links created and explore its behavior.
Let’s open the completed model now. Go to the “Examples” subfolder of the “Contaminant Transport Course” folder you should have downloaded and unzipped to your Desktop, and open a model file named ExampleCT19_Diffusive_Tube.gsm.
The various inputs have all been defined in the Inputs Container, and the Species, Water and Sand can be found in the Material Container. We will focus on the Tube Container, where all the Cells are located:
In the previous Lesson we noted that each of the 10 Cells representing the tube were defined identically in terms of the amount of Water and Sand:
In that Lesson we also created a diffusive mass flux link between Cell1 and Cell2. If you look at Diffusive Fluxes tab for Cells 2 through 9, they all look identical (with a mass flux link between it and to the Cell to the left and to the right).
Open, for example, Cell3 and go to the Diffusive Fluxes tab:
We see two diffusive mass flux links (one from Cell3 to Cell4, and one from Cell2 to Cell3). Both are defined identically (since all three Cells are identical in terms of size, the Fluid they contain and the Solid they contain).
Cell1 and Cell10 look a bit different from the other Cells, since they represent the boundaries of the tube. Cell1 has an Initial Inventory specified (this is the mass that is added to the tube at the beginning of the simulation). In addition, if you look at the Diffusive Fluxes tab, you will note that unlike Cell2 through Cell9, there is only one diffusive flux link (from Cell1 to Cell2), since the other end of the tube is closed (mass cannot diffuse in that direction):
Cell10 is also different from the other Cells. It does have two diffusive mass flux links, and the mass flux link from Cell9 to Cell10 is identical to others. However, the link from Cell10 to the Tank looks like this:
As can be seen, this is a “one-sided” link. The diffusive distance on the Tank side is zero. Mass only has to diffuse from the middle of Cell10 to the edge of the Tank. In addition, the Tank itself is specified to have a Defined Concentration of zero:
These two items (zero diffusive length and zero concentration) have the effect of simulating a tank that flushes immediately.
Run the model now so we can look at some results. Let’s first click on the "Rate and Cumulative" Time History Result element. This shows the mass transfer rate into the tank, as well as the cumulative mass that enters the tank (recall that the Initial Inventory in Cell1 was 1g):
As can be seen, it takes on the order of 100 years for the mass to diffuse out of the tube (illustrating how slow diffusion through water is, particularly in the presence of a porous medium). Another way to view these results is to view the concentration in each Cell as a function of time (the "Concentration" Time History Result):
As we noted in a previous Lesson, discretizing the system into a number of “slices” (10 in this example) will produce some numerical errors (with the error decreasing as we increase the number of Cells). So how do we know that our level of discretization is appropriate? Although for some systems we might be able to provide a simple rule, in real-world models, the system you are simulating will likely be much more complex than this. It may include multiple fluids (e.g., air and water), the species could be decaying and ingrowing, and the nature of the system may be such that all Cells may not be the same size, or contain the same media and degrees of saturation. As a result, the only way to answer this question is to run some numerical experiments (in which you increase the level of discretization until it no longer significantly changes the result).
In this example, this was actually done (in a separate model). In this model, the number of Cells was varied from 1 to 40. The results (in terms of the mass transfer rate into the Tank) are shown below:
Zooming in on the peak rate, the plot looks like this:
Clearly, for this type of system (single species, no decay, one fluid) a very small number of Cells (perhaps 5) would be sufficient. However, in some cases, this may not be the case, so it is important to always carry out numerical experiments to select your discretization level.
Note: GoldSim provides a specialized element called a CellNet Generator to automate the creation of such Cell networks. The CellNet Generator discretizes a rectangular or cylindrical region of space and creates a one or two-dimensional array of Cell elements, including any necessary advective or diffusive mass flux links between them. Once the Cell elements have been generated, you can then manually edit them to add any flux links necessary to connect them to the rest of your model. This provides a very efficient way to carry out numerical experiments regarding the required discretization level (so you do not need to create the Cell network manually). We will discuss this element briefly in Unit 12. Note, however, that the CellNet Generator is only available within the RT Module. It is not available in the CT Module.