Lesson 5 - Understanding the Equations for Advective Transport Between Cells
As we have mentioned several times, as a general rule, you should not use “black boxes” to build models. If you don’t understand how a tool works, you should not use it. Hence, throughout the Course we will provide the actual equations that are incorporated into the Contaminant Transport Module elements, and will also discuss (in general terms) how GoldSim solves the equations numerically. In Unit 5, Lesson 9, we described the very simple equations for a single tank with no advective flows (just decay). In this Lesson, we will build on that and describe the equations for the Exercise we worked on in the previous Lesson (two flow-through tanks with a sink, but no decay).
Since we have three Cells (and just one species), we have three governing equations:
In these equations, M1, M2 and MSink represent the mass of X in Tank1, Tank2 and the Sink, respectively, and C1 and C2 represent the concentration of X in Tank1 and Tank2, respectively. Q represents the constant flow rate through the tanks.
The key point to note here is that:
Advective transfer rate = Flow rate * concentration
Hence, the advective mass transfer rate out of Tank1 is simply equal to the flow rate times the concentration in Tank1. The equation for Tank2 has two terms: one for the mass entering the tank, and one for the mass leaving the tank.
Since the Cells contain only Water, the concentrations C1 and C2 can be expressed as the mass in those tanks divided by the volume (V). The equations can then be rewritten as:
These are the equations that the Cell pathways must solve.
Note: As pointed out in Lesson 3, GoldSim assumes that “clean” water is entering Tank1. How is this actually reflected in the equation above? It is reflected in two ways: 1) there is no positive term (addition) in the first equation; and 2) V in this example is assumed constant. This equation then implies that clean water must be entering the tank to keep the volume constant.
As pointed out in the previous Unit, GoldSim solves these equations by discretizing time and using an approximation for the time derivative. GoldSim uses a (fully implicit) finite-difference approximation. In particular, we can approximate these equations as follows:
where the superscript k refers to the current timestep, k-1 refers to the previous timestep, and Δt is the timestep length. Since at any given time k we know what the value was at time k-1, at any given time k we have three equations in three unknowns. GoldSim can easily solve these coupled equations.
In fact, because these equations are representing only (uni-directional) advection, they are rather weakly coupled. As a result, if you rearrange the equations above, you would find that:
- M1 at time k can be determined as a function of the constants (Q, V and Δt) and M1 at k-1;
- M2 at time k can be determined as a function of the constants (Q, V and Δt), M2 at k-1 and M1 at time k (which you know from step 1); and
- MSink at time k can be determined as a function of the constants (Q, V and Δt), MSink at k-1 and M2 at time k (which you know from step 2).
We won’t bother to do so here, but because these equations are so simple in this case, you could easily program these into a spreadsheet and compare the result to GoldSim (keeping in mind how GoldSim subdivides the computational timestep depending on the Solution precision setting discussed in Unit 5, Lesson 9).
In this simple model, the equations were quite easy to solve. However, as the systems you simulate become more complex, solving the coupled equations would become more involved (e.g., you wouldn’t necessarily easily be able to solve them in a spreadsheet in the step-wise manner spelled out above). However, solving them is still straightforward using well-known numerical techniques, as we will always simply have a system of N (linear) equations in N unknowns.
In general, you don’t need to be concerned with how these equations are solved by GoldSim; that is a mathematical detail that is not necessary to understand in order to properly use the software. That is, it is certainly important to 1) understand the governing equations that GoldSim is solving; and 2) have an understanding of the approximations that are made to the equations in order to solve them (in fact, we will need to discuss some of these approximations in some detail in later Units, as they must be considered when you are representing certain types of processes). But it is not critical to understand how those approximated equations are subsequently solved (although if you are interested, these details are provided in the Appendices of the GoldSim Contaminant Transport User’s Guide).
Before leaving this Lesson, one other detail is worth discussing, as it provides a bit more insight into how GoldSim solves the equations. As pointed out above, the mass transfer rate from Tank1 is simply equal to the flow rate multiplied by the concentration. So, conceptually, we could compute the mass transfer rate directly ourselves by multiplying the computed concentration by the flow rate:
But GoldSim also computes and outputs this mass transfer rate directly, and we could find this in the Outflows folder of the output port:
How do these two results compare? The table below shows a result that compares the mass transfer rate from Tank1 computed by GoldSim (the first column) to the mass transfer rate computed using the Expression above (the second column). The third column shows the concentration in Tank1 computed by GoldSim.
You will see that the first two columns are in fact not identical. Why is this the case? We can get a hint at why by looking at the third column, which is the concentration in Tank1. You will note that as we would expect, the second column is simply the third column multiplied by the constant flow rate (0.1 m3/day). However, while the concentration in the third column represents the value at exactly that point in time, the mass transfer rate computed by GoldSim in the first column represents the effective rate over the previous timestep. The Expression essentially uses the value of the concentration at the end of the timestep to estimate the mass transfer rate over the previous timestep. But the concentration actually decreases with time during the timestep (i.e., it is higher at the beginning of the timestep). Recall (from Unit 5, Lesson 9) that GoldSim (when running with Medium or High Precision) effectively subdivides the computational timestep (1 day in this model) when solving the mass transport equations to more accurately solve them, so the reported mass transfer rate (in the first column) is more accurate (and correspondingly higher), since it captures the fact that the concentration was decreasing during the computational timestep (and was hence higher at the beginning of the timestep). So the Expression (which is based just on the final concentration) underestimates the actual mass transfer rate.